How to Send Data to Web Server using Arduino and SIM900A GPRS/GSM Module

Today we are here with an interesting project in which we will Send Data to the SparkFun server using Arduino and GPRS. This is an IoT based project in which we will use GPRS, present on the GSM Module SIM900A board, to send some data to the web service on the internet.

In this project, we will simply enter some text using 4×4 Alphanumeric keypad and send it to SparkFun website using Arduino and GPRS, from where you can see that data from anywhere in the word through internet. Here we have also attached a 16×2 LCD to see the data locally. This data sending technique is very useful in IoT projects where you want to monitor things from anywhere in the world like Monitoring Temperature & Humidity, Monitor Vehicle Location, Monitor Heart Beat, Monitor Air pollution level etc.

How to Send Data to Web Server using Arduino and SIM900A GPRS GSM Module

Components Required:

  1. Arduino
  2. GSM Module SIM900A
  3. 16×2 LCD
  4. 4×4 Matrix Keypad
  5. Breadboard or PCB
  6. Connecting jumper wire
  7. Power supply 12v
  8. SIM Card

Using GPRS in GSM Module:

Here we have used a normal GSM Module with a SIM card for GPRS connection. In this project, GPRS is responsible for sending data to the Sparkfun server. Previously we have done many projects where we have used Wi-Fi module ESP8266 to send data to different servers over internet. But this time we have used GPRS. Check the detailed Video at the end of this tutorial.

GPRS stands for General Packet Radio Services which is a packet based wireless communication service that works with data rate of 56-114kbps and provides a connection to the internet.

For GPRS, we do not need to buy any special module or hardware because GSM already has GPRS facilities inbuilt. We only need to access it by using the same method or AT commands that we used for GSM interfacing in our previous projects. There are many AT commands already mentioned in the datasheet of SIMCOM SIM900A GSM module.

READ  Converting infrared to RF signals with Arduino

Now for sending data to server by using GPRS, first we need to initialize GSM module.

Commands for initializing GSM:

AT :- this command is used to check whether GSM module is responding or not.

AT+CPIN? :- this command is used to check whether SIM card is inserted in GSM Module or not.
ATE0 :- is used for disabling echo

ATE1 :- is used for enabling echo

Commands for initializing GPRS internet connection:

AT+CIPSHUT :- to close TCP Port Explicitly means disconnect connection if any

AT+CGATT? :- Checking SIM card has internet connection or not

AT+CSTT = "APN","userName","Pass" :- connect to internet

(ex; AT+CSTT="","","")

AT+CIICR :- bring up with the wireless network. Checking SIM card has data pack or balance

AT+CIFSR :- get IP (sometimes without this command GSM do not work so use this command)

AT+CIPSTART = ”TCP”,”SERVER IP”,”PORT” :- is used for creating TCP connection with the server that we provide in place of SERVER IP

AT+CIPSEND :- this command is used for sending data to the server. After input, this command server asks for data.

After inputting the data we send 26 to the server. If everything will be fine then data will be posted successfully to the server and SparkFun server responds with a pass or fail string.

Working Explanation:

Process of Sending Data from GPRS of GSM Module is easy. Here in this project, we are sending some string or words to the server by typing using keypad. Same string or word will appear over the LCD, then press D/OK to send the input string to the server. Here we have created an Alphanumeric Keypad for inputting the characters or numeric values to Arduino or LCD. C/clear is programmed for backspace.

READ  Project: Car Speed Detector Using Arduino

Alphanumeric is a method to enter numbers and alphabets both by using the same 4×4 matrix Kepad keypad. Here we have coded the same 4×4 keypad for Arduino to accept alphabets also. Check the full code at the end of the article.

Circuit Explanation:

 For Sending Data to SparkFun Server, we need to interface Keypad and GSM module to Arduino. In this project we have used Arduino to taking input string from the keypad and sending commands to GSM/GPRS module. GSM/GPRS is used to communicate with the Internet for sending data to the Sparkfun server. GSM Module’s Rx and Tx pin is directly connected with Arduino’s pin D3 and D2 respectively (Ground of Arduino and GSM must be connected with each other). A 16×2 LCD is used for displaying input strings and showing welcome message and data sending status as well.  Pins of this 16×2 LCD namely Rs, en, d4, d5, d6, and d7 are connected with pin number 14, 15, 16, 17, 18 and 19 of Arduino respectively. A 4×4 keypad is used for input string to Arduino and its  Row pins R1, R2, R3, R4 are directly linked to pin number 11,10, 9, 8 of Arduino and Colum pin of keypad C1, C2, C3 are linked with pin number 7, 6, 5,4 of Arduino.

Here we have also connected GSM Tx pin to Tx of Arduino to get response data over the serial monitor.

Programming Explanation:

Programming part of this project is a little complex for beginners but by doing a little bit practice and paying attention you can understand it. In this code, we have used keypad library for interfacing simple keypad for entering numbers. And for entering alphabets we have used the same library and keypad but used one more function to make it alphanumeric keypad. Means we have made every key multi-functioning and can enter all the characters and integers by using only 10 keys.

READ  Kaosduino: Create your own kaosillitaor using Arduino

How to Send Data to Web Server using Arduino and SIM900A GPRS GSM Module schematic

If we press key 2 (ABC2), it will show ‘A’ and if we press it again then it will replace ‘A’ with ‘B’ and if again we press it then it will show ‘C’ at the same place in LCD. If we wait for some time after pressing a key, the cursor will automatically move to next position in LCD. Now we can enter next char or number. And same procedure is applied to other keys. It works same as keypad in old mobile phones.

Below we have included Keypad.h library and define array matrix for the keys:

#include <Keypad.h>               // keypad library for interfacing keypad
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
int x=0;
int y=0;
int n=0;
int minValue=0;
int maxValue=0;
char keyPress=0;
int keyPressTime=100;
String msg="";

char hexaKeys[ROWS][COLS] = 

byte rowPins[ROWS] = {11, 10, 9, 8}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad

And given void getkey function is used for input alphabets

Read more: How to Send Data to Web Server using Arduino and SIM900A GPRS/GSM Module

This Post / Project can also be found using search terms:

  • using gsm sim900a to connect arduino board to the internet
  • aboutx9h
  • cipsend error arduino and sim900A
  • gprs send data to server using arduino

Leave a Comment

= 3 + 9

(Spamcheck Enabled)

Read previous post:
ESP12e + OLED display – a try to make a smartwatch
ESP12e + OLED display – a try to make a smartwatch

Description Recently I bought two ESP12e, wanted to see how those IoT things work. One thing I know for sure,...

Scroll to top