Send GSM SIM800 900 GPRS Data To Thingspeak With Arduino
Send GSM SIM800 900 GPRS Data To Thingspeak With Arduino
In this project we will learn about IoT using GSM Module. We will
use SIM900/800 GSM Module with Arduino and send the DHT11
1 Overview
2 Bill of Materials
5 Setting up Thingspeak
6 Source Code/Program
Overview
Nowadays we use ESP8266 or ESP32 or any other wifi Modules to
send any sensor data to the Internet wirelessly. Hence Wifi comes
order to use IoT Connectivity and to get data from the farmer’s
river zone, mountains are the areas where wifi connection is not
available.
So, GSM GPRS is the only alternative left as per the present
everywhere.
for the Internet of Things that enables you to collect, store, analyze,
visualize, and act on data from sensors. So let us learn all about
If you want to send the data in JSON format using any API Server
you can check our post here: SIM900/800 HTTP post request in
Bill of Materials
Following are the components required for learning the Cellular IoT
R3 /388eC7D
Development
Board
Module
Humidity /2Tqsyo3
Temperature
Sensor
Supply /2Pxqfym
Wires /2L8Xc1p
6 Breadboard - 1 https://amzn.to
/2YM6YyS
many mobile phones and PDA. The module can also be used for
connect with the internet via GPRS. It is suitable for SMS, Voice as
make & receive audio calls, Send & Read SMS, GPRS Internet, etc
kit
7. SIM Cardholder
over GPRS
max 42.8KBps
with Arduino & DHT11 for Sending data to Thingspeak Server. The
9V/12V Power supply. Similarly, connect the VCC & GND Pin of
of Arduino.
Setting up Thingspeak
ThingSpeak provides very good tool for IoT based projects. By
using ThingSpeak site, we can monitor our data and control our
system over the Internet, using the Channels and web pages
Then create a new channel and set up what you want. The tutorial
Then create the API keys. This key is required for programming
Now click on channels so that you can see the online data
streaming
Source Code/Program
The source code/program to Send GSM SIM800/900 GPRS Data to
You can simply copy the code and upload to the Arduino Board.
But before that, you have to make two changes in the code. Change
your APN Services first. In my case, I am using Airtel SIM and the
default APN for Airtel is airtelgprs.com. You can check your SIM APN
You also need to make changes to the API key from thingspeak.
#include <SoftwareSerial.h>
SoftwareSerial gprsSerial(2,3);
#include <String.h>
#include <DHT.h>
#define DHTPIN A0
void setup()
{
gprsSerial.begin(9600); // the GPRS baud rate
Serial.begin(9600); // the GPRS baud rate
dht.begin();
delay(1000);
}
void loop()
{
float h = dht.readHumidity();
float t = dht.readTemperature();
delay(100);
Serial.print("Temperature = ");
Serial.print(t);
S e r i a l . p r i n t l n ( " °C
C" ) ;
Serial.print("Humidity = ");
Serial.print(h);
Serial.println(" %");
if (gprsSerial.available())
Serial.write(gprsSerial.read());
gprsSerial.println("AT");
delay(1000);
gprsSerial.println("AT+CPIN?");
delay(1000);
gprsSerial.println("AT+CREG?");
delay(1000);
gprsSerial.println("AT+CGATT?");
delay(1000);
gprsSerial.println("AT+CIPSHUT");
delay(1000);
gprsSerial.println("AT+CIPSTATUS");
delay(2000);
gprsSerial.println("AT+CIPMUX=0");
delay(2000);
ShowSerialData();
ShowSerialData();
delay(3000);
ShowSerialData();
ShowSerialData();
gprsSerial.println("AT+CIPSPRT=0");
delay(3000);
ShowSerialData();
gprsSerial.println("AT+CIPSTART=\"TCP\",\"api.thingspeak.com\",\"80\"
delay(6000);
ShowSerialData();
delay(4000);
ShowSerialData();
gprsSerial.println((char)26);//sending
delay(5000);//waitting for reply, important! the time is base on the
gprsSerial.println();
ShowSerialData();
Serial.write(gprsSerial.read());
delay(5000);
start responding. You can open the Serial Monitor and see the
Similarly, you can open the Thingspeak private view and see the
If you want to send the data in JSON format using any API Server
you can check our post here: SIM900/800 HTTP post request in
GSM/GPRS Module
17 Comments
Toni
July 27, 2020 at 7:18 PM
Loading...
Reply
GAURAV PIPLANI
August 7, 2020 at 4:10 PM
When i use GET instruction and then send 026 i get SEND OK from the
modem and then CLOSED but thingspeak channel is not updated.
Please help
Loading...
Reply
bwengye duncan
November 18, 2020 at 9:23 PM
T
oni the line means you are terminating the message being sent. It
basically tells the GSm that the message ends here hence executing the
send command
Loading...
Reply
Al Diman
February 1, 2021 at 5:42 PM
Loading...
Reply
Mr. Alam
February 1, 2021 at 5:44 PM
Loading...
Reply
Al Diman
February 13, 2021 at 1:42 PM
Hi,
Thanks on your reply. The data on my channel are now updating. The
data are updated every 1.5 minutes (about 88 seconds). Is it possible to
have data updated every 60 seconds? What part in the code should I
change? Thanks again for the help.
Loading...
Reply
Andrew
March 25, 2021 at 1:30 AM
Hi, I noticed that the GSM module needs an external power supply
rather than being powered from the arduino board. What sort of
current does the GSM module draw? I was hoping to power this from a
battery and place the node in a remote area with small solar panel to
trickle feed the battery.
Loading...
Reply
Mr. Alam
March 25, 2021 at 10:26 AM
Loading...
Reply
Andrew
March 26, 2021 at 7:21 PM
Thanks for the reply. I have got it up and running now but it seems to
be updating things speak at random intervals with some gaps as big as
25 minutes. Is this because the delays are not long enough and it times
out before making connection?
Loading...
Reply
Andy
March 29, 2021 at 7:29 PM
Hi, I have the same issue. Can you please confirm exactly where this
extra delay should be?
Loading...
Reply
Mr. Alam
March 29, 2021 at 8:42 PM
Loading...
Reply
Andrew
March 29, 2021 at 11:34 PM
Hi, I have uploaded the same code and thingspeak updates but at
random intervals. What delays should I adjust to make sure I get data
sent everytime the program runs. I have ‘send Ok’ back but thingspeak
does not update and it tends to randomly update now and then.
Loading...
Reply
srikanth
April 1, 2021 at 11:26 AM
Loading...
Reply
Loading...
Reply
stevejferry
June 28, 2021 at 7:33 PM
Hello, is there a way to get the http status from ThingSpeak ie the 200
code ThingSpeak sends back when the post has been successful? I am
using an A9 GSM/GPRS module with an ESP32 board to receive LoRa
packets from my nodes and forward them to ThingSpeak. Thanks, Steve.
Loading...
Reply
samarjeetchavan
October 28, 2021 at 2:47 PM
Loading...
Reply
Srikanth n
June 30, 2022 at 1:35 PM
Loading...
Reply