Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » Send SIM800/900 GSM/GPRS Data to Thingspeak with STM32
IoT Projects STM32 Projects

Send SIM800/900 GSM/GPRS Data to Thingspeak with STM32

Mamtaz AlamBy Mamtaz AlamUpdated:August 21, 20221 Comment5 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
STM32 SIM900 GPRS
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

In this project we will learn about IoT using GSM Module. We will use SIM800/900 GSM Module with STM32 Microcontroller, i.e STM32F103C8T6 and send the DHT11 Sensor data to Thingspeak Server.


Overview

Nowadays we use ESP8266 or ESP32 or any other wifi Modules to send any sensor data to the Internet wirelessly. Hence Wifi comes into action and thus we need Wifi Connection for wireless communication with any server. But the disadvantage of using Wifi is, it is not available everywhere. The wifi signal is limited to certain locations and to a certain range up to a few meters. For example, in order to use IoT Connectivity and to get data from the farmer’s fields, we can’t rely on Wifi due to unavailability. Similarly forest, river zone, mountains are the areas where wifi connection is not available.

So, GSM GPRS is the only alternative left as per the present scenario and current technology. GSM GPRS Module allows you to add location-tracking, voice, text, SMS, and data to your application. The big advantage of GSM/GPRS Connectivity is, it covers a wide area and signal/connectivity is available almost everywhere.


So in this project, we will learn about the Internet of Things using GSM GPRS Module, i.e Cellular IoT. We will take SIM900A as a reference GSM GPRS Module and Interface it with STM32 Microcontroller, i.e STM32F103C8T6. We will sense the surrounding humidity and temperature using DHT11 Humidity/Temperature Sensor. The humidity & temperature data will be sent to Thingspeak server using AT Commands for GSM Module. ThingSpeak server is an open data platform and API 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 GSM Module with Thingspeak & STM32.

You can check one of our post related to similar system where the data is sent in JSON Format to any server: STM32 & SIM900/800 HTTP Post Request in JSON Format


Bill of Materials

Following are the components required for learning the Cellular IoT project. All the components can be easily purchased from Amazon. The component purchase link is given below.

S.N.Components QuantityPurchase Links
1STM32F103C Microcontroller1Amazon | AliExpress
2SIM800/900 GSM Module1Amazon | AliExpress
3DHT11 Sensor1Amazon | AliExpress
412/9V Power Supply1Amazon | AliExpress
5Connecting Wires10Amazon | AliExpress
6Breadboard1Amazon | AliExpress

SIM900A GSM/GPRS Module

The SIM900A is a readily available GSM/GPRS module, used in many mobile phones and PDA. The module can also be used for developing IoT (Internet of Things) and Embedded Applications. It works on frequencies 900/ 1800 MHz. The Modem comes with an RS232 interface, which allows you to connect PC as well as a microcontroller with RS232 Chip(MAX232). The baud rate is configurable from 9600-115200 through AT command. The GSM/GPRS Modem is having internal TCP/IP stack to enable you to connect with the internet via GPRS. It is suitable for SMS, Voice as well as DATA transfer applications in the M2M interface.

SIM900A GSM Module

The onboard Regulated Power supply allows you to connect a wide range of unregulated power supply. Using this modem, you can make & receive audio calls, Send & Read SMS, GPRS Internet, etc through simple AT commands.



SIM900A GSM/GPRS Modem Fetures

1. Input Voltage: 12V DC
2. Supports MIC, Audio Input & Speakers
3. Dual-Band GSM/GPRS 900/ 1800 MHz
4. RS232 interface for direct communication with computer or MCU kit
5. Configurable baud rate
6. Wire Antenna ( SMA connector with GSM Antenna Optional )
7. SIM Cardholder
8. Built-in Network Status LED
9. Inbuilt Powerful TCP/IP protocol stack for internet data transfer over GPRS
01. DATA GPRS: download transfer max is 85.6KBps, Upload transfer max 42.8KBps


Circuit/Connection between GSM Module STM32 & DHT11

Here is a circuit diagram for interfacing SIM800/900 GSM Module with STM32 (STM32F103C8T6) & DHT11 for Sending data to Thingspeak Server. The connection is fairly simple as shown below.

STM32 GSM Module

SIM800/900 is a UART Module. We need to connect SIM900A with STM32 UART Pin for Serial Communication. STM32F103C8T6 has 4 UART Pins. So I will use UART 3 for interfacing SIM900A. So, connect the SIM900 TX & RX Pins to STM32F103C8T6 pin PB10 & PB11 respectively. Supply the GSM Module with 9V/12V Power supply. Similarly, connect the VCC & GND Pin of DHT11 Sensor to STM32F103C8T6 5V & GND. Connect its output pin to PA0 of STM32F103C8T6.

SIM800 GSM Module STM32F103C




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 provided by ThingSpeak. So first you need to sign up for ThingSpeak. So visit https://thingspeak.com and create an account.

Thingspeak Setup

Then create a new channel and set up what you want. The tutorial in the video below. Follow the video for more clarifications.

Then create the API keys. This key is required for programming modifications and setting your data.

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 Thingspeak with STM32 (STM32F103C8T6) is given below. No libraries are required. You can simply copy the code and upload to the STM32 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 from your google or cellular provider.

You also need to make changes to the API key from thingspeak.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#define BOARD_USART3_TX_PIN PB10
#define BOARD_USART3_RX_PIN PB11
 
#include <String.h>
 
#include <DHT.h>
#define DHTPIN PA0
#define DHTTYPE DHT11
 
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
  Serial3.begin(9600);               // the GPRS baud rate  
  Serial.begin(9600);
  dht.begin();  
  delay(1000);
}
void loop()
{
      float humidity = dht.readHumidity();
      float temperature = dht.readTemperature();
      delay(100);  
        
      Serial.print("Temperature: ");
      Serial.print(temperature);
      Serial.println(" °C");
      Serial.print("Humidity: ");
      Serial.print(humidity);
      Serial.println(" %");
  
  if (Serial3.available())
    Serial.write(Serial3.read());
 
  Serial3.println("AT");
  delay(1000);
 
  Serial3.println("AT+CPIN?");
  delay(1000);
 
  Serial3.println("AT+CREG?");
  delay(1000);
 
  Serial3.println("AT+CGATT?");
  delay(1000);
 
  Serial3.println("AT+CIPSHUT");
  delay(1000);
 
  Serial3.println("AT+CIPSTATUS");
  delay(2000);
 
  Serial3.println("AT+CIPMUX=0");
  delay(2000);
  ShowSerialData();
  Serial3.println("AT+CSTT=\"airtelgprs.com\"");//start task and setting the APN,
  delay(1000);
  ShowSerialData();
  Serial3.println("AT+CIICR");//bring up wireless connection
  delay(3000);
  ShowSerialData();
  Serial3.println("AT+CIFSR");//get local IP adress
  delay(2000);
  ShowSerialData();
  Serial3.println("AT+CIPSPRT=0");
  delay(3000);
  ShowSerialData();
  
  Serial3.println("AT+CIPSTART=\"TCP\",\"api.thingspeak.com\",\"80\"");//start up the connection
  delay(6000);
  ShowSerialData();
  Serial3.println("AT+CIPSEND");//begin send data to remote server
  delay(4000);
  ShowSerialData();
  
  String str="GET https://api.thingspeak.com/update?api_key=O13AOCHYYNU2LQ19&field1=" + String(temperature) +"&field2="+String(humidity);
  Serial.println(str);
  Serial3.println(str);//begin send data to remote server
  
  delay(4000);
  ShowSerialData();
 
  Serial3.println((char)26);//sending
  delay(5000);//waitting for reply, important! the time is base on the condition of internet
  Serial3.println();
  ShowSerialData();
  Serial3.println("AT+CIPSHUT");//close the connection
  delay(100);
  ShowSerialData();
}
void ShowSerialData()
{
  while(Serial3.available()!=0)
  Serial.write(Serial3.read());
  delay(5000);
  
}


Results & Observations

Once the code is uploaded to STM32F103C8T6 Board, the module will start responding. You can open the Serial Monitor and see the following responses there.

STM32 GSM Serial

Similarly, you can open the Thingspeak private view and see the temperature and humidity logged data there.

So this is how you can Send GSM SIM800/900 GPRS Data to Thingspeak with STM32.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleCellular IoT: Send SIM800/900 GPRS Data to Thingspeak with Arduino
Next Article TDS Sensor & Arduino Interfacing for Water Quality Monitoring

Related Posts

ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

Updated:June 21, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

Updated:June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

Updated:May 10, 20262K
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

Updated:May 2, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

Updated:April 27, 20261K
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

Updated:April 27, 20262K
View 1 Comment

1 Comment

  1. Hiten sharma on September 22, 2021 8:51 PM

    i tried running the code, but it says serial3 is undefined, how can i fix this?

    Reply

CommentsCancel reply

Latest Posts
ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

June 21, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
Top Posts & Pages
  • ESP32 Fingerprint Attendance System with Live Web Dashboard
    ESP32 Fingerprint Attendance System with Live Web Dashboard
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • How to use Modbus RTU with ESP32 to read Sensor Data
    How to use Modbus RTU with ESP32 to read Sensor Data
  • ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
    ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
  • Half Wave Rectifier Basics, Circuit, Working & Applications
    Half Wave Rectifier Basics, Circuit, Working & Applications
  • How to use INA226 DC Current Sensor with Arduino
    How to use INA226 DC Current Sensor with Arduino
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (205)
    • ESP32 MicroPython (7)
    • ESP32 Projects (82)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.