Basics: Project 105c
Project name: SIM900A GSM GPRS mini board – Control 5V relay module by SMS
Tags: SIM900A GSM GPRS module, Simcom, SIM900A GSM GPRS mini module, SIM900A GSM mini module, SIM900A mini module, Arduino Nano, Arduino IDE, Arduino, SIM900A GSM GPRS mini board, SIM900A mini v 3.8.2, SIM900A datasheet, SIM900A pinout, sim900a arduino code, sim900a gsm module pin diagram, gsm sim900a pin diagram, gsm sim900a interfacing with arduino, how to check sim900a gsm module, sim900a gsm module interfacing with arduino nano, sim900a gsm module interfacing with arduino uno, what is sim900a, does sim900a support 4G, doesn sim900a support 3G, what is GSM module, what is a sim900a GSM module, GSM SIM 900A module, sim900a gsm module, sim 900a gsm gprs module, SIM900A mini DEV board v 3.9.2, How to Use Arduino and a SIM900 to Control a Relay Through SMS, Arduino, Arduino Uno, GSM based Home Automation, Door Lock System using Arduino and GSM
Attachments: SIM900Acontrolrelaysketch
In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):
1. SIM900A GSM GPRS mini module 1 pc

2. Breadboard 1 pc

3. Jumper cables F-M, M-M

4. 5V relay module 1 pc

5. Standard SIM card 1pc

6. SIM card size adapter (optional) 1 pc

7. Arduino Uno R3 (you can also use the other version of Arduino) 1pc

8. Arduino IDE (you can download it here)
General
We will learn how to control a 5V relay module through the SMS messages which are sent from smartphone.
SIM900A GSM GPRS mini boards are handy for a variety of different applications including vehicle tracking, remote automation, or even for simple things like feeding your animals when you are not home.
Project steps:
- The smartphone will send the message and a SIM900A GSM GPRS mini board will receive the message.
- The SIM900A GSM GPRS mini board will communicate with Arduino Uno board through serial communication and the Arduino Uno board will turn the 5V relay module ON or OFF depending on the message it receives.

Understanding the 5V relay module
You can read more about it here.
Understanding the SIM900A GSM GPRS module
You can read more about it here.
Signals and connections of the 5V relay module
You can read more about it here.
Signals and connections of the SIM900A GSM GPRS module

RS232 RXD – RS232 receive pin
RS232 TXD – RS232 transmit pin
5VT – 5V TXD transmit pin
5VR – 5V RXD receive pin
3VT – 3V3 TXD (SIMT) transmit pin
3VR – 3V3 RXD (SIMR) receive pin
GND – ground pin
VCC – power supply 5V pin
SIM900A pinout

- VBAT – 3 VBAT pins are dedicated to connect the supply voltage. The power supply of SIM900A has to be a single voltage source of VBAT= 3.4V…4.5V. It must be able to provide sufficient current in a transmit burst which is typically rises to 2A
- VRTC – Current input for RTC when the battery is not supplied for the system. Current output for backup battery when the main battery is present and the backup battery is in low voltage state. If the RTC function is enabled, a battery or capacitor should be connected with the VRTC pin. Otherwise the VRTC pin can be keep open.
- VDD_EXT – 2.8V output power supply. If unused, keep open.
- GND – Ground
- PWRKEY – Voltage input for PWRKEY. PWRKEY should be pulled low to power on or power off the system. The user should keep pressing the key for a short time when power on or power off the system because the system need margin time in order to assert the software. It is already pulled up.
- PWRKEY_OUT – Connecting PWRKEY and PWRKEY_OUT for a short time then release also can power on or power off the module.
- MIC_P MIC_N – Positive and negative voice band input. If unused keep open
- SPK_P SPK_N – Positive and negative voice band output
- LINEIN_R LINEIN_L – Line input
- DISP_DATA DISP _CLK DISP _CS DISP _D/C – Display interface. If unused keep open
- STATUS – Indicate working status. If unused keep open
- NETLIGHT – Indicate net status. If unused keep open
- SCL – I2C bus clock. If unused keep open
- SDA – I2C bus data. If unused keep open
- KBR0~KBR4 – Keypad interface. If unused keep these pins open
- KBC0~KBC4 – Keypad interface. Pull up to VDD_EXT, if unused keep pins open
- RXD – Receive data. DTR Pin has been pulled up to VDD_EXT. If unused keep pin open
- TXD – Transmit data
- RTS – Request to send
- CTS – Clear to send
- RI – Ring indicator
- DSR – Data Set Ready
- DCD – Data carry detect
- DTR – Data terminal Ready
- DBG_TXD – Serial interface for debugging and firmware upgrade. If unused keep pins open
- DBG_RXD – Serial interface for debugging and firmware upgrade. If unused keep pins open
- SIM_VDD – Voltage supply for SIM card. The voltage can be select by software automatically either 1.8V or 3V
- SIM_DATA – SIM data output. All signals of SIM interface are protected against ESD with a TVS diode array. Maximum cable length 200mm from the module pad to SIM card holder.
- SIM_CLK – SIM clock
- SIM_RST – SIM reset
- SIM_PRESENCE – SIM detect. If unused keep open
- ADC – General purpose analog to digital converter. If unused keep open. Input voltage range: 0V ~ 3V
- NRESET – External reset input (Active low). If unused keep open.
- PWM1 – PWM Output. If unused keep open.
- PWM2 – PWM Output. If unused keep open.
Wiring

Step by step procedure
1.Download, install and open Arduino IDE.
2. Insert standard Sim Card to Sim Card holder of SIM900A GSM GPRS mini board and lock it. Sim card must be unlocked and with credit.

3.Attach GSM/GPRS antenna to SMA connector of SIM900A GSM GPRS mini board.
4. Power up with 5V DC not more than 2A external power supply or attach to Arduino Uno. The ‘status LED’ (D5) will be on.
5.Do wiring. Plug in Arduino Uno board to your PC USB port.
6. Wait for some time (approx. 1 minute) and see the blinking rate of ‘network LED’ (D6). GSM module will use some time to establish connection with mobile network.
7. Once the connection is established successfully, the status/network LED will blink continuously every 3 seconds. You may try making a call to the mobile number of the sim card inside SIM900A GSM GPRS mini board. If you hear a ring back, the SIM900A GSM GPRS mini board has successfully established network connection.
8.Select the correct board and com port in Arduino IDE.
9.Open, modify, verify and upload the SIM900Acontrolrelaysketch to your Adruino Uno board. Make sure to change the number in the code to your own phone number.

10. Open Serial monitor at 115200 bps. You can now control the 5V relay module by sending the SMS from your smartphone. Use this format for sending the text message for controlling the LED: “A.light_On” and “A.light_Off” When the light is on you will get SMS message back – “Light is ON” and when the light is off you will get SMS message back – “Light is OFF”.
11. That’s it! Happy coding!
Code
First, we need to add the software serial library so we won’t have to remove the TX or RX pins while uploading the code.
In the setup(), set the mode of the SIM900A to SMS and set the module to show the received message on the serial monitor.
In the loop(), we call the receive message function to check whether or not messages are received. Any message we receive will be stored in the incomingData string. Now set received commands to turn the relay on or off accordingly, i.e., “A.light_On*” and “#A.light_Off*”
After setting up relay commands, we need to set up the code for messages to be sent to your smartphone, which will let you know whether the relay is turned on or off.
Make sure to change the number in the code to your own phone number and use this format for sending the text message for controlling the LED: “A.light_On*” and “A.light_Off*”. Upload the code after making the changes and test if it works.
Summary
We have learnt how to control a 5V relay module through the SMS messages which are sent from smartphone.
Libraries
SoftwareSerial library included in Arduino IDE. The library has the following known limitations:If using multiple software serial ports, only one can receive data at a time.Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).On Arduino or Genuino 101 the current maximum RX speed is 57600bpsOn Arduino or Genuino 101 RX doesn’t work on Pin 13 The library has the following known limitations: If using multiple software serial ports, only one can receive data at a time;Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69);Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI);On Arduino or Genuino 101 the current maximum RX speed is 57600bps; On Arduino or Genuino 101 RX doesn’t work on Pin 13. You can read about it here.
Sketch
- See attachment on the begining of this project description.
Check for more DIY projects on Acoptex.lt and Acoptex.com!
If you are looking for high quality PCBs PCBWay is the best choice:

RELATED POSTS
Basics project 083d ESP8266 ESP-12E module and NRF24L01 2.4GHZ RF transceiver module – Button and LED
Basics project 083c ESP8266 ESP-12E module and NRF24L01 2.4GHZ RF transceiver module – DHT11 sensor readings on LCD1602 I2C module
Basic project 083b ESP8266 ESP-12E module and NRF24L01 2.4GHZ RF transceiver module – Time and Date on LCD1602 I2C module