Programação RPi Python 20: Interface do modem SIM900A GSM-GPRS e hackeamento de fones de ouvido

RPi Python 20 Programming: SIM900A GSM-GPRS Modem Interface and Headphone Hacking

In the previous tutorial , we learned how to use the Raspberry Pi (RPi) serial hardware port for serial data communication via the Universal Asynchronous Receiver/Transmitter (UART) protocol. Most embedded devices have the UART port for exchanging console data . In fact, most sensor modules designed for point-to-point communication with controllers/computers have the UART port for data communication. Therefore, there are several sensor modules that can be interfaced with Raspberry Pi using its UART port.

Remember that the RPi's UART port is 3.3V and must be connected to the compatible serial port. If the other device has a different UART voltage level, the voltage level changer or suitable serial adapter must be used. For example, a device with a 5V TTL UART port can connect to the RPi's serial port using a 5 to 3.3V TTL Logic Shifter.

Similarly, the RPi's UART port can be connected to a device's USB interface using a USB serial card. It can also be connected to a device's RS-232 port using the RS-232 serial converter.

The serial ports of the sensors and modules can be interfaced directly or indirectly with those on the Raspberry Pi and with any desktop computer using a USB serial board.

Like Python is platform independent, the script that runs on the RPi to receive serial data from a sensor can be used on any desktop computer by simply changing the name of the serial port.

In this tutorial, we will learn how to connect a SIM900A GSM-GPRS modem with Raspberry Pi and with any desktop computer. We will also discuss how to hack a regular headset to make and receive voice calls through a SIM900A modem.

Wireless Modems
Wireless connectivity is a widely accepted solution for data communication over long distances. For M2M IoT solutions, mobile connectivity is the only resource to ensure data transfer with mobile devices and remotely deployed “things”. There are many wireless modules available from different vendors that can be used for data communication over a mobile network. These wireless modules are generally classified by the mobile network technology (2G, 3G, 4G or 5G) or the technology platform they use (GSM/GPRS, GSM/GPRS+GNSS, WCDMA/HSPA/HSPA+, LTE, NB-IoT or GNSS).

These wireless modules are capable of communicating data in the form of voice calls, SMS, GPRS, fax and Internet (TCP/IP, IP, HTTP and FTP protocols).

SIMCOM is one of the largest suppliers of wireless modules. Different wireless modems available from SIMCOM Limited for mobile connectivity are listed in this table:

Based on the technology platform, SIMCOM modules are listed in this table:

Although 4G and 5G wireless modules are advanced modems that offer the high speeds and features of 4G and 5G technologies, 2G wireless modules are still widely used in embedded applications. 2G wireless modules are cheaper and offer an ideal wireless solution where speed and latency are not an issue.

The SIM900A GSM-GPRS modem
SIM900 is a 2G wireless module that offers a GSM-GPRS Quad-Band 850/900/1800/1900 MHz solution. The modem features multi-slot GPRS class 10/class 8 (optional) and supports GPRS CS-1 coding schemes , CS-2, CS-3 and CS-4.

This ultra-compact modem requires a supply voltage of 3.2 to 4.8V. It can be controlled via AT commands (GSM 07.07, 07.05 and SIMCOM enhanced AT commands), which can be communicated via the serial interface (UART), I2C and SPI.

It also has a single interface for an external 3V/1.8V SIM in which the Mini-SIM (2FF form factor), Micro-SIM (3FF form factor) and NanoSIM (4FF form factor) can be connected.

The modem is equipped with GPIO, PWM, ADC and an analog audio interface so it can have MIC and audio input and speaker as well as display and keyboard interface. It also comes with a built-in RTC.

Some of the important features of the SIM900A modem are listed here:

The SIM900A modem has this pin diagram:

The SIM900A modem has this pin configuration:

Hardware and wiring
It is quite easy to connect the modem.

  • Power supply pins 57, 56 and 55 must be connected to a 5 VDC source capable of 2 A bursts.
  • Ground can be provided at pin 54 of the modem.
  • The SIM card slot must be connected to pins 30 (the SIM card voltage supply), 31 (the SIM data output), 32 (the SIM clock), 33 (the SIM reset), and 34 (the SIM detection).

Connections to the SIM card slot will depend on the type of SIM card holder used to mount the module. The image below shows the reference circuit for connections between the SIM900A and an 8-pin SIM card holder.

Now, the antenna must be connected to pin 60. To turn the modem on/off, a button can be connected between pin 1 (PWRKEY) and pin 2 (PWRKEY_OUT). For the MIC input, pins 19 (microphone positive) and 20 (microphone negative) must be connected to a connector.

Similarly, for speaker connections, pins 21 (positive speaker) and 22 (negative speaker) must also be connected to a connector. To communicate with the modem via the UART protocol, pins 9 (serial transmission), 10 (serial reception) and 17 (ground) must be connected to a header.

The Txd and Rxd of SIM900A must connect to the Rxd and Txd of the controller/computer respectively. Headers for serial communication over other protocols (I2C and SPI) can also be provided in a similar way. Additionally, circuit connections for UART hardware and software flow control can be provided via a header if required.

A reference circuit for the SIM900A module is shown here:

You can design your own SIM900A module. The SIM900 Reference Design Guide is very helpful in this process. There are several ready-to-use modules for the SIM900A GSM-GPRS modem available on the market.

Here is an example:

Note that this module has:

  • A power supply socket that can be connected to an AC to DC adapter
  • A SIM card holder on the back
  • Headers for UART communication
  • A MIC and speaker input, as well as serial modem lines.
  • Additionally, the status LEDs and buzzer are connected to the module.

SIM900A GSM-GPRS Module Interface
It's easy to connect the SIM900A module with Raspberry Pi, microcontrollers and even desktop computers. You can use UART, I2C or SPI interfaces to connect the module serially to a control device.

To communicate via the UART protocol, simply connect the Txd and Rxd of the module with the Rxd and Txd of the RPi using a TTL logic shifter from 5 to 3.3V.

Remember that the SIM900A is a 5V device with a 5V UART port. Therefore, its UART port cannot directly interface with the RPi's hardware serial port. But a simple 5V-3V3 voltage shifter can be designed using a 1N4148 diode.

Here is a circuit diagram:

To make and receive voice calls, the MIC and speaker input can be used…

Then insert a SIM card into the SIM card holder, power the module with an adapter and it is ready to operate.

To connect the module to Arduino or any other 5V microcontroller, the UART port of the SIM900A modem can be connected directly to the Arduino serial port (or to a 5V controller).

You can also connect the modem to any desktop computer. It can be serially connected to any desktop system using a USB serial card. However, the board must be configured to use 5V UART signals

Hacking headphones to receive/make voice calls
A typical headphone jack can serve as a MIC and speaker input for the SIM900A modem.

This image shows the pin configuration of common headphone jacks:

For MIC and speaker input, a headset or headphones with microphone and speakers are required. The standard (Apple) connector is quite common in headsets and headphones for computers and cell phones.

The microphone and speaker are internally connected to the jack like this:

Here are the next steps:

  • Solder two wires/jumper wires to the connector ground (for MIC negative and speaker negative)
  • Short-circuit the right and left audio jack (since there is only one speaker input on the jack)
  • Solder a wire/jumper (for speaker positive) to the right and left audio short of the connector
  • Solder a wire/jumper wire (to MIC positive) to the microphone connector.

For clean soldering, the connector can be removed from the headphone/headphone wire and the jumper wires can be soldered directly to the respective wires of the microphone and speaker connections.

Typically, your headset/headphone cable will be color coded:

After soldering the jumper wires to the headset/headphone, it should look something like this:

Most computer/mobile headphones and earbuds consume low current and are already 5V TTL compatible.

Any 8 ohm speakers can also be connected to the SIM900A. However, to hack and connect the headset/headphone to the SIM900A, it must have an impedance of 8 ohms.

For a better audio experience, the headset reference circuit or 1 Watt audio power amplifier is recommended (and supported in the SIM900A Reference Design Guide).

How the SIM900A modem works
The SIM900A GSM-GPRS modem can be controlled via UART, I2C or SPI interfaces. It simply needs to be connected serially to a control device, which can be RPi, Arduino, a microcontroller or any desktop computer (via the USB serial board).

The modem understands AT commands that can be transmitted to it via the UART , I2C or SPI protocol. The control device is called terminal equipment (TE) or data terminal equipment (DTE). The modem may be referred to as mobile equipment (ME), mobile station (MS), terminal adapter (TA), or data communications equipment (DCE).

With the help of AT commands, the modem can be checked, configured and operated to make and receive voice calls, faxes, GPRS data (SMS), MMS as well as data over TCP/IP, IP, HTTP and FTP. protocols.

In the next tutorial, we will cover many of the AT commands of the SIM900A GSM-GPRS modem.

Conteúdo Relacionado

A network of sensors is embedded in every vehicle,...
The motor controller is one of the most important...
ESP32-CAM is a compact camera module that combines the...
A evolução dos padrões USB foi fundamental para moldar...
A SCHURTER anuncia um aprimoramento para sua conhecida série...
A Sealevel Systems anuncia o lançamento da Interface Serial...
A STMicroelectronics introduziu Diodos retificadores Schottky de trincheira de...
Determinar uma localização precisa é necessário em várias indústrias...
O novo VIPerGaN50 da STMicroelectronics simplifica a construção de...
A Samsung Electronics, fornecedora de tecnologia de memória avançada,...
O mercado embarcado tem uma necessidade de soluções de...
You have probably come across the term ' drag...
You probably have a support insulator if you've noticed...
You've probably seen stand an insulator sit on power...
You've probably seen shackle insulators enthroned on electricity poles,...
You have probably experienced situations where controlling a circuit...
Back to blog

Leave a comment

Please note, comments need to be approved before they are published.