Readers' Choice
Popular articles
Review of GSM / GPRS SIM900 Shield board
The Arduino GPRS / GSM Shield board (Figure 1) provides us with the ability to use mobile GSM communication for remote reception and transmission of data. This can be done in three ways:
using sending / receiving short text messages (SMS);
sending voice (audio) commands based on CSD (standard GSM data transmission technology) and / or DTMF (two-tone multi-frequency analog signal used to dial a telephone number);
using packet data transmission based on GPRS technology.
The board is based on the SIMCom SIM900 module.
It also contains:
sIM card slot;
3.5 mm jack for audio input and output;
connector for an external antenna.
Communication with the board is carried out via a serial connection using a set of AT commands. With the help of jumpers on the board, it is possible to set the contacts used for communication: hardware contacts 0-1 or 2-3 (on some boards) 7-8 for work via SoftwareSerial.
Figure 1. GPS GPRS shield.
The GSM GPRS SIM900 Shield board can be turned on in two ways:
hardware (pressing the PWRKEY button);
software.
Connecting to Arduino board
The GSM GPRS SIM900 Shield is made in the Shield format for Arduino boards. The contacts of the shield (comb) are easily inserted into the board connectors, thus forming a "sandwich" (Figure 2).
Figure 2. Installing the GPS GPRS shield on the Arduino board.
Consider controlling the GSM GPRS shield module using AT commands. To do this, install the module on and connect it to the computer. An Arduino sketch of sending and receiving data between the computer and the GSM GPRS shield via the board is shown in Listing 1.
Listing 1
#include
// create object
SoftwareSerial grs (7, 8); // RX, TX
// exchange rate
#define GSMbaud 9600
Serial.begin (9600);
gsm.begin (GSMbaud);
Serial.println ("Start");
if (Serial.available ()) (
str1 \u003d Serial.readStringUntil ("\\ n");
str1.toCharArray (buffer, hh.length () + 1);
gsm.write (buffer);
gsm.board.write ("\\ n");
if (gsm.available ()) (
Serial.write (gprs.read ());
We load the sketch to the arduino board, open the serial port monitor and type the commands to set the mode:
The command for checking the module connection to the GPRS network, which must be repeated constantly when the COMMAND NO RESPONSE response
We connect to the access point of the telecom operator. For Beeline:
AT + CGDCONT \u003d 1, "IP", "internet.beeline.ru"
AT + CSTT \u003d "internet.beeline.ru", "", ""
Establishing an internet connection:
AT + CGACT \u003d 1.1
Referring to the Internet resource
The entire connection process is shown in Figure 3.
Figure 3. Process of working with the GSM GPRS SIM800 module in the serial port monitor.
Let's consider an example of using sending sms messages when the room temperature drops below a certain value. We need the following details:
gSM GPRS Shield module - 1 pc;
sIM card of a mobile operator with a positive balance;
power supply unit 12V - 1 piece;
The connection diagram is shown in Figure 4.
Figure 4. Connection diagram for sending sms messages at low air temperatures.
Let's start writing a sketch. Every 30 seconds we get humidity and temperature data from DHT11 sensor. We use the DHT library. If the temperature is below the critical one, we send sms to the number specified in the PHONE constant. And we pause for 10 minutes.
The contents of the sketch are shown in Listing 2.
Listing 2
// connecting libraries
#include
#include "DHT.h"
// phone for sending sms
#define PHONE_NUMBER "+7928222222"
// create objects
SoftwareSerial gsm (7, 8);
DHT sensorDHT (2, DHT22);
// temperature threshold
#define TEMPP 18
unsigned long millissend;
// start the serial port
Serial.begin (9600);
// start DHT sensor
sensorDHT.begin ();
// run SoftwareSerial
gsm.begin (9600);
if (millis () - millissend\u003e 30 * 1000) (// readings every 30 seconds?
// get data from DHT sensor
int h \u003d sensorDHT.readHumidity ();
int t \u003d sensorDHT.readTemperature ();
if (t // send sms // wait 10 minutes delay (10 * 60 * 1000); millissend \u003d millis (); // send sms void SendSMS (int t) ( // set text mode gsm.print ("AT + CMGF \u003d 1 \\ r"); // telephone gsm.println (PHONE_NUMBER); gsm.println ("\\" "); // send data t // end of transfer gsm.println ((char) 26); We load the sketch, check the event of the arrival of an SMS message to the selected phone number at a critical temperature value. Figure 5. Assembly diagram. Let's create a firmware for receiving data when sending an SMS message to the sim card located in the GSM GPRS shield module. The contents of the sketch are shown in Listing 3. Listing 3 // connecting libraries #include #include "DHT.h" // create objects SoftwareSerial gsm (7, 8); DHT sensorDHT (2, DHT22); // variables String phone \u003d "" String str1 \u003d ""; // boolean isSMS \u003d false; // connect the serial port Serial.begin (9600); // start DHT sensor // run SoftwareSerial gsm.begin (9600); // Configure message reception gsm.print ("AT + CMGF \u003d 1 \\ r"); gsm.print ("AT + IFC \u003d 1, 1 \\ r"); gsm.print ("AT + CPBS \u003d \\" SM \\ "\\ r"); gsm.print ("AT + CNMI \u003d 1,2,2,1,0 \\ r"); if (gsm.available ()) ( char c \u003d gsm.read (); if ("\\ r" \u003d\u003d c) ( if (isSMS) (// current line - sms message, if (! str1.compareTo ("tmp")) (// text sms - tmp // send sms to the incoming number // get data int t \u003d dht.readTemperature (); // AT command to set text mode gsm.print ("AT + CMGF \u003d 1 \\ r"); // recipient's phone number gsm.println ("AT + CMGS \u003d \\" "); gsm.println (phone); gsm.println ("\\" "); // message - temperature data // end of transfer gsm.println ((char) 26); Serial.println (currStr); if (str1.startsWith ("+ CMT")) ( Serial.println (str1); // extract the phone number from the message phone \u003d str1.substring (7,19); Serial.println (phone); // if the current line starts with "+ CMT", // then the next line is the message else if ("\\ n"! \u003d c) ( str1 + \u003d String (c); We load the sketch onto the board, send an SMS message with the text tmp to the sim card and receive an SMS message with temperature data in response. 1. There is no communication with the Arduino via the serial port. Check the board power supply. Check if the jumpers are set correctly. 2. SMS messages are not sent Check for external power supply GSM GPRS shield. Check your SIM card balance. Shield GPRS / GSM SIM900 with antenna A module for the operation of Arduino microcontroller devices and similar ones in cellular networks according to GSM and GPRS standards. Designed for use in automation and control systems. Data exchange with other modules occurs via the UART interface. Shield GPRS / GSM SIM900 with antenna can interface directly with the microcontroller via the UART interface or work in conjunction with a personal computer using a PC-UART interface converter. This is possible due to software compatibility at the level of the class of commands used to control modems - AT commands. An article in Russian from the magazine about the SIM900 component. The component was developed by SIMCom Wireless Solutions. The SIMCom website has a Russian-language version. The GSM module board on the component side contains connectors for connecting an antenna, headphones and a microphone. On the soldering side of the board, there is a 3-volt CR1220 battery holder that supports the operation of the module clock and a container for installing a sim card. Shield GPRS / GSM SIM900 with antenna provides ample opportunities to study the operation of the SIM900 component. The installation of the SIM900 component is carried out using the most modern technologies, which makes it very difficult to solder to the SIM900 printed circuit board in laboratory conditions. Having a module with SIM900 installed, you can experiment with using the SIM900 component. When using the SIM900 component in our own development, it becomes possible to debug software and check circuit solutions. Characteristics Food Control components The Power select switch sets the power source: external, connected to the coaxial connector, or the power supply of the Arduino microcontroller module. The Power key turns the power on or off when pressed and held for 2 seconds. Indication The module status is indicated by 3 LEDs: Contacts The SIM900 component contains a UART port, its signals are output to the component pins and are connected to jumpers that establish which contacts of the Shield GPRS / GSM SIM900 module will connect the SIM900 UART port to D0, D1 or D7, D8. Pin assignment of component SIM900. External power on and off You can turn on or turn off the power supply of the module using a signal at the control input D9. To change the state, a 1 s pulse is sent to D9. The change in state occurs 3.2 s after the start of the pulse. Enabling the module. Graphs of module supply voltage, external control pulse and STATUS power indicator. When the module is controlled by the master device, it should be turned on without using the Power key, i.e. immediately after power is applied. To do this, add several commands to the MK program. Void powerUpOrDown () This group of commands in the program can be used to turn off the module. You can also turn off the GSM module by sending an AT command. Finally, I was able to start studying perhaps the most popular GSM module in the DIY environment - GSM900. What is a GSM module? It is a device that implements the functions of a cell phone. In other words, GSM900 allows you to make calls to other subscribers of the cellular network, receive calls, send and receive SMS messages. And, of course, transfer data via GPRS. I needed this module for a very specific purpose: a project for a remotely controlled lighting system appeared. The easiest way to solve this problem is SMS-messages: sent one sms - the light turned on, sent another - turned off. No remote controls are needed, but everyone has a telephone (even homeless people). Actually, in this article I will consider this particular option for using the GSM900 module. Frequently Asked Questions FAQ
SIM900 GPRS / GSM Shield Development Board Quad-Band Kit For Arduino Compatible
Objects are monitored and managed through the exchange of data within the range of mobile communications. Provides voice communication, sending SMS, MMS and many other functions and services. The module is based on the SIM900 component.
One of the applications of the device is a tracking system for vehicle movements in conjunction with a GLONASS or GPS device. Sending SMS messages allows using the module in dispatching, wireless signaling and security systems. As a result of the events taking place, various SMS can be sent: “Emergency stop of elevator 2 of house No. 34”, “Car door open”, “Basement open”, “Voltage 220 V off”, “Front door of the cottage is open”, “Lighting is on”, “ The temperature in the greenhouse is below critical. ” The module is indispensable for monitoring and controlling moving objects moving over long distances. Or in the case of moving the operator a long distance from a stationary object.
voltage, V
nominal 5
range 4.8-5.2
current
normal mode 50-450 mA
in sleep mode 1.5 mA
limiting impulse 2 A
Supports sim cards with 1.8 and 3 V power supply
Communication ranges 850, 900, 1800, 1900 MHz
Supports 2G network
Transmission power in different bands
1W 1800 and 1900 MHz
2W 850 and 900 MHz
Compliant with GSM Phase 2/2 +
Built-in TCP and UDP protocols
Data transmission class GPRS multi-slot class 10/8
Audio codecs HR, FR, EFR, AMR, echo cancellation
CSD up to 14.4kbps
PPP stack
MUX (07.10)
HTTP and FTP protocols
It is possible to send DTMF signals and play records as on an answering machine
RTC support
Temperature, ℃
air during operation -30 ... 75
storage -45 ... 90
dimensions 86 x 58 x 19 mm
PWR (green) - module power indicator,
Status (red) - power indicator of SIM900 component,
Net Light (green) - network connection.
Net Light LED messages.
Off - SIM900 is not working.
Flashing at intervals, indicated in seconds:
0.064 on and 0.8 off - no network detected,
0.064 on and 0.3 off - network detected,
0.064 is enabled, 0.03 is disabled - GPRS is connected.
UART Shield GPRS / GSM can be connected: to the hardware interface of the MK through the TXD and RXD contacts of the Shield GPRS / GSM module, for this, D0, D1 are used. Or to the software emulated by means of arduino, for this, contacts D7 and D8 of the Shield GPRS / GSM module are used. The full UART interface has 10 signals pins in the corner of the board: R1, DCD, DSR, CTS, RTS, GND, 2V8, TX, RX, DTR.
The 12 signed GPIO digital I / O pins are located in the corner of the board. There are 2 PWM outputs PWM1, PWM2. ADC input pin ADC. The built-in time counter interface has 4 pins. Pin designation: DISP_CLK, DISP_DATA, DISP_D / C, DISP_CS.
Contact D9 is used for software control of switching the SIM900 on or off.
An antenna connector is installed on the board.
{
pinMode (9, OUTPUT);
digitalWrite (9, LOW);
delay (1000);
digitalWrite (9, HIGH);
delay (2000);
digitalWrite (9, LOW);
delay (3000);
}1. Firmware
As fate willed, I had a GSM900A module in my hands. After reading the first forum that came across about the revival of this thing, it turned out that the letter A in the name means that the module belongs to the Asian region. Therefore, he will not work with our operators. Despondency 🙁 Fortunately, the following posts on the same forum contained calming information :) It turned out that not everything is so bad, and for the module to work in our region, it simply needs to be reflashed. This process is well described in the blog of our colleague Alex-EXE: "all in one" firmware sim900 I'll try to do the same, but in even more detail, and taking into account the peculiarities of my module. If you have the correct module and firmware is not required, you can immediately jump to section # 2. Tools So, first, let's prepare all the necessary tools. First, the SIM900 Series download Tools Develop application, which can be easily found on the Internet (), is required directly for the firmware. Secondly, the firmware file 1137B02SIM900M64_ST_ENHANCE itself will come in handy, which is also easily extracted (). Finally, thirdly, we will need a good terminal for experimenting with the module. I usually use TeraTerm, but this time its capabilities were lacking (or I didn't figure it out). I had to install a monster with an ingenious name. Connection to USB-UART bridge Now we connect the RX and TX lines to the bridge. For the latter, I used the CP2102. In my case, contrary to logic, the RX and TX of the bridge were connected to the RX and TX of the GSM module symmetrically (and not crosswise, as is customary). You should also power the module from a stable and powerful source, since the peak current on the module can reach 2A (allegedly). 4 x AA batteries will do. The complete wiring diagram looks like this:
This model does not have a reset button, so for the firmware we need to drop the RST pin to the ground for a couple of seconds. To do this, we will leave it hanging in the air for now. Presetting the module Before proceeding with the firmware, we will connect to the module and change its UART speed. To do this, launch the Terminal, select the correct port, and set the baud rate - 9600. After that, click "Connect". All communication with the module occurs through AT commands. The first thing we will tell the module will be the most primitive AT command: "AT". This is a kind of ping, to which the module must respond with the word "OK". AT If everything went well, and the module really answered us "OK", send the command to set the speed: AT + IPR \u003d 115200 At the end of the command there should be a service carriage return - CR. In ASCII table, it has code 13 (or 0x0D in hexadecimal). The symbol will be substituted automatically if you put the "+ CR" checkbox opposite the input line in our terminal. Other terminals also have similar settings. In response to the entered command, we will again receive - "OK". We need this setting to speed up the firmware procedure. Otherwise, as Alex-EXE pointed out on his blog, the firmware will take about an hour. Program setting After all the wires are stuck in the right places, and the module is prepared for firmware, launch the SIM900 Series download Tools Develop application. Setting up the program consists of just a few points:
SIM900
CP2102 Gnd
Gnd
CP2102 + 5V
VCC_MCU
CP2102 RX
SIMR
CP2102 TX
SIMT
External source + 5V
VCC5
External Gnd source
Gnd
RST
With the setting everything. Firmware Now we carry out strictly and consistently six important steps.
We are waiting 6 minutes before the firmware is complete. What do we have after the firmware First, the module can now work with our operators. Secondly, we have installed extended firmware, which features, for example, obtaining module coordinates from cell towers, working with e-mail and access to an additional 2.5 MB of memory. 2. Experiments with the GSM module
Now let's try to perform various useful operations with the module. First, enter the PIN (if any): AT + CPIN \u003d 8899 The module's response will be: + CPIN: READY. After that, we get some information from the module. AT + GMR - firmware identifier. AT + GSN - IMEI. AT + CPAS - state (0 - ready to work, 2 - unknown, 3 - incoming call, 4 - voice connection). AT + COPS? - information about the operator. Phone calls Now we will dial some number. This is done using the command: ATD + 790XXXXXXXX; The semicolon at the end of a command is very important, don't forget about it! If during a UART session someone calls the device, the following message will return: RING You can answer the call (pick up the handset) with the command: ATA If headphones and a microphone are connected to the module, you can talk to the remote subscriber like using a regular cell phone. The command ends the call: ATH0 Sending SMS First, enable the text mode of messages: AT + CMGF \u003d 1 and set the encoding: AT + CSCS \u003d "GSM" The module also supports other encodings that are more convenient for automatic systems. But for experiments, it is most convenient for us to use the GSM mode, in which the phone is specified in numbers, and the text of messages is written in ASCII encoding. Now let's send a message to someone: AT + CMGS \u003d "+ 79123456789" At the end of the command, you need to add two service characters at once: CR and LF. In Terminal, this can be done by ticking CR \u003d CR + LF, or by manually adding at the end of the line: AT + CMGS \u003d "+ 79123456789 ″ & 0D & 0A After entering this command, a"\u003e "symbol will be received in response, indicating the start of a message. We write some text: Hello World! At the end of the message, we will need to transmit one of two special characters. To send a message, enter a character from the ASCII table with number 26. To cancel sending - a character with number 27. In the terminal we use, to send a character by code, you can use one of two expressions: in hexadecimal format: $ 1A, and in decimal: # 026 Receiving SMS If an SMS arrives at the device during the session, a message of the following format will be returned: + CMTI: "SM", 4 here 4 is the number of the incoming unread message. To read the text of this message, enter: AT + CMGR \u003d 4 In response, we receive: + CMGR: "REC READ", "+ 790XXXXXXXX", "", "13/09/21, 11: 57: 46 + 24" Hello World ! OK In general, everything is simple. This is quite enough for us to implement our plans. For a deeper study of the capabilities of the GFM900, I recommend reading another article by Alex-EXE: at-commands for gsm of the sim900 modem 3. Interaction with microcontrollers
In general, to control external devices it is not at all necessary to pair the GSM900 module with another microcontroller. You can sew your program into this module, which will do anything with free GPIO pins. However, in most ready-made boards, the GPIOs are not wired, so to create a prototype of the conceived device, we will use the simplest Arduino Uno / Nano. Arduino and GSM900 will communicate over the same UART interface. To do this, let's connect these two devices as follows:
Now we will compose a program that will catch SMS and turn on the LED on leg # 13 for a couple of seconds. This is how we imitate the control of some external device. const String spin \u003d "1234"; const int rel_pin \u003d 13; String ss \u003d ""; // Sending the pin code void sendPin () (String cmd \u003d "AT + CPIN \u003d" + spin + char (0x0D); Serial.print (cmd);) // Turning on the LED for 2 seconds void receiveSMS (String s) ( digitalWrite (rel_pin, HIGH); delay (2000); digitalWrite (rel_pin, LOW);) // Parse the string that came from the module void parseString (String src) (bool collect \u003d false; String s \u003d ""; for (byte i \u003d 0; i GSM900
GND
VCC_MCU
SIMT
SIMR
Arduino Uno
GND
+ 5V
RX
TX
I used the following components to connect:
We connect Arduino to a computer via a USB cable.
We supply power to the GSM module from a 12V battery through the converter:
The question arises: is it possible to supply power from the Arduino itself from 5V? I wouldn't risk it directly. But you can pick up a diode or voltage regulator.
Before connecting to the voltage converter, you must configure it by setting the output voltage to any in the range 3.7V - 4.2V. We connect the output contacts from the voltage converter to the GSM module, observing the polarity.
We connect TX and RX contacts on the GSM module with 2 and 3 digital contacts on the Arduino. If you need to connect several GSM modules to the Arduino, then use other pins and write in the sketch via SoftwareSerial.
Add a procedure to the end of the sketch and call it from the main loop like this: sms (String ("SMS text in English"), String ("+ 791212345678"));
Then turn on the power through the port monitor, setting the speed to 19200 and the "new line" option.
Enter the command "ATI" and press ENTER. Information from the module model should appear.
I tried to send an SMS to the module via a free service from Tele2, incomprehensible lines come. I tried to change the encoding in the module. The issue has not yet been resolved.
The GSM module for Starline A93 is a device, the installation of which will make it possible to turn a conventional alarm into a security complex with the ability to track the coordinates of a car. This device is installed additionally and can only be used with the "signaling" model A93.
[Hide]
The main advantage of connecting a GSM device to an alarm with auto start of the A93 engine through the software interface is to monitor the coordinates of the car. Thanks to the presence of the module, the car owner can receive data on the location of the car on his phone at any time. The error in identifying coordinates can be up to several meters, provided that there is a minimum of interference on the ground. This will allow you to timely determine the location of the car in case of theft and return the car.
The use of a GSM device for Starline A93 will provide the ability to monitor the vehicle within the mobile coverage area, that is, almost everywhere.
The M22 and GSM master modules installed in the A93 have the following advantages:
Stason Nissan gave a brief description of the configuration and main advantages of the Starline M22 device.
Overview of ways to control a GSM device:
Possibilities provided by the installation of GSM modules for signaling:
The AutoAudioCenter channel spoke about the main options and features of the Starline GSM module, model M22.
Let's analyze the procedure for installing a GSM device with our own hands using the example of a Mitsubishi Lancer car:
Dismantle the panel cladding to gain access to the processor Remove the unit from the installation site and disassemble it Connect the GSM module and insert the mobile operator card into it
It will be impossible to use the GSM module for Starline A93 after installation if you do not link it to the alarm.
To ensure high-quality communication of the GSM module with the car alarm, after installation the device must be registered:
The device itself is configured according to the operating instructions. To do this, you can use the voice interface. From your phone, make a call to the card number that is installed in the block. If the binding of the module was successful, the voice menu will be activated. After listening to the greeting, you can configure two passwords - PW and PS. Then the phone number from which the call was made will be automatically linked to the "signaling" as the main one, a confirmation SMS will be sent to it.
Mike Jackson's channel spoke about the specifics of setting up the GSM module before use.
Assigning passwords:
If the GLONASS module was connected, then it is necessary to activate the satellite geolocation function. To do this, send a message with the combination 00492 to the number of the SIM card installed in the module. If you do not do this, the procedure for determining the coordinates will be carried out not by the GLONASS satellite, but by the towers of the mobile network.
Read the instruction manual before using the module.
By sending messages with text to the number set in the device, you can configure the remote start of the internal combustion engine:
An overview of the main features and nuances of controlling the Starline GSM-master module is presented by the AutoAudioCenter channel.
Control commands:
To edit the password for management and configuration, use the following commands:
Channel CrossoveR 159 talked about telematics options and commands used to configure the Starline GSM device.
Other commands used for configuration:
By registering on the Starline-Online service, the consumer will be able to access the security complex from a computer or from a smartphone application.
The procedure for creating an account is as follows:
Related articles: | |
Win-win lottery in verse
Why is the anniversary so wonderful? The fact that the house of friends is full. Lots of toasts, games, ... Vocabulary dvacha What is soot dvach
Even if you have been surfing the Internet for ten years like ... Means and methods of dealing with snails in the garden
Seemingly harmless snails loved by children, but in fact - one of ... |