Using SIM900 board with analog input and output - RoEdAl/asterisk-chan-quectel GitHub Wiki
chan_quectel
with SIM900 board with analog input/output.
Using The basic idea is just using sound card in order to capture/playback audio from/to SIM900 board.
Additional sound card is required with microphone (or line) input and headphone (or line) output. Any cheap USB sound card should be fine.
Pros and cons.
Pros.
- This is a budget solution.
Cons.
-
In many countries 2G tehnology isn't available anymore. In many other countries 2G tehnology is considered as obsoleted and will be phased out soon.
So consider this solution as short-term one.
-
Using sound card to playback/capture audio seems redundant.
GSM chip performs digital ⟷ analog audio conversion and sound card do the same in reverse order. Eventually, digital audio returns to the digital domain, being converted to analog domain and back along the way.
That is true of course. But on the other hand even cheap USB sound card cannot degrade voice quality at all. Remember that we're talking about GSM technology with narrowband (<4kHz) speech-oriented codec. Sound card captures and plays audio with "fullband" 48kHz/16-bit quality.
Hardware.
Required hardware.
-
SIM900 board with analog headphone output and microphone input.
-
USB sound card with microphone input and headphone output.
Sound card must handle 48kHz/16bit recording/playback natively (full duplex). Special wiring is required (see below).
-
USB to TTL adapter (optional).
For SBCs such as Raspberry Pi you can use internal serial port but pay attention to used voltage logic. Many SIM900 boards have 5V TTL logic and many SBCs (such as Raspberry Pi) have 3V3 TTL logic so logic level shifter may be required!
-
Ground loop noise isolator for car audio (optional).
This device is also called:
- ground loop isolator,
- ground loop audio noise filter,
- noise filter,
- noise suppressor,
- buzz noise eliminator,
- etc….
Even cheap noise isolator may be helpful.
Connecting
If noise isolator is required put it in-between GSM module and sound card.
In order to connect GSM board headphone output with sound card microphone input you need special cable. This should be 3.5mm TRS Jack plug ⟷ 3.5mm TRS Jack plug without ring conductor (only tip and sleeve).
On the other hand in order to connect sound card headphone output with GSM board microphone input you can use ordinary 3.5mm TRS male Jack ⟷ 3.5 TRS male Jack cable!
Adjusting volume and gain levels.
SIM900 board.
Starting point:
- set headphone volume level to 100 (maximum value),
- set microphone gain level to 0 (minimum value).
Use AT command to adjust headphone volume level and microphone gain level:
AT+CLVL
- Loud Speaker Volume Level,AT+CMIC
- Microphone Gain Level.
It is also a good idea to turn off echo cancellation by AT+ECHO
command and set minimum side tone gain level by AT+SIDET
command.
AT+CLVL=100
AT+CMIC=0,0
AT+ECHO=0,0,0,0
AT+SIDET=0,0
See also: Sending AT commands via socat
and chat
.
Sound card.
Starting point:
- set main output to 0dB,
- set microphone gain to 0dB,
- turn off AGC (Auto Gain Control),
- turn off microphone monitoring if available.
Shell script:
#!/bin/sh
{
echo 'sset Speaker 0dB unmute'
echo 'sset Mic playback 0dB mute'
echo 'sset Mic capture 0dB unmute cap'
echo "sset 'Auto Gain Control' mute"
} | amixer -D hw:0 -s
Control names for your card may be different.
Configuration.
[simcom0]
data=/dev/ttyUSB0 ; TTL <--> USB
uac=ext ; use external sound card
alsadev=hw:0 ; sound card, default is hw:0