close
KnowledgeBase

Measuring Temperature and Humidity using DHT22 and Sending data via SMS using SIM800C module

31641883_2059849784028409_9202668915803553792_n

Overview

This project measures the temperature and humidity of the surroundings using the DHT22 sensor. Also, the gathered data is then sent to the user’s mobile phone using the SIM800C GSM module.

SIM800C is a type of module that uses GSM to communicate. GSM, or Global System for Mobile Communications, is the most popular cell phone standard in the world. Data transmission uses GSM to send and receive data across the globe through mobile networks.

On the other hand, a DHT22 sensor measures temperature and humidity of the area that surrounds it. When compared to the DHT11 sensor, the DHT22 sensor is more accurate and more efficient because of its capability to measure more extensive temperature ranges with minimal error percentage.

Hardware Used

Software Used

  • Arduino IDE
  • Mobile Phone Messaging Application

Libraries Used

  • SoftwareSerial.h
  • DHT.h

Application Description

This project utilizes the capabilities of the SIM900C GSM module to transmit and receive data. Also, this project uses the ability of the DHT22 module to measure temperature and humidity. This project gathers the data from the DHT22 module and sends it to the user using the GSM module. But, the user can only access the data by texting the Arduino Uno. Once the text is received by the Arduino Uno, it transmits the gathered data to the user through a text.

Set-up the Hardware

Figure 1 – Schematic Diagram

Figure 2 – SIM800C GSM Module Front View

Figure 3 – SIM800C GSM Module Back View

Figure 1 shows the connections between the different equipment used in this project. The RX and TX pins of the SIM900C module are connected to pins 10 and 9 of the Arduino Uno, respectively. The RX pin of the GSM module should be connected to the TX pin of the Arduino and the TX pin of the module to the Arduino’s RX pin. This allows the data to be transmitted and received in both sources.

Set-up the Software

The code shown above is the program needed for this project. It is divided into five major parts. These are the initialization, setup, loop, SendTextMessage(); function, and the receivedMessage(); function. These five parts will be thoroughly explained below.

The first significant part of the code is the initialization of variables. This is where the variables are given an initial value. These values may change as the code progresses.

Also, this is where the libraries are declared and defined. The SoftwareSerial.h and DHT.h are the libraries used in this project. The SoftwareSerial library is used to incorporate serial communication onto the different pins of the Arduino Uno rather than using pins 0 and 1 for serial communication. Serial communication is a type of communication wherein data is transmitted and received using a communication channel one bit at a time. In the code shown above, the pins used for serial communication are pins 9 and 10. The pin 9 is the RX pin, and pin 10 is the TX pin.

On the other hand, the DHT library is defined to allow the DHT22 sensor to measure the temperature and humidity of its surroundings. This part also establishes the pin used for the DHT22 sensor, specifically pin 2. The DHT22 library can be downloaded here.

The second significant part of the code is the setup function. From the name itself, this is where the set-up is created. This is where the baud rate is initialized. Baud rate is defined as the rate of transfer of information in a communication channel. In this project, a baud rate of 9600 is used. This means that the serial port is capable of sending and receiving a maximum of 9600 bits per second.

Moreover, the setup function contains the AT commands. AT commands are instructions needed to control the modem to perform a specific operation. In this project, the AT commands instructs the SIM800C module to set itself to SMS Text Mode, allows itself to receive messages and read the unread ones. Furthermore, the AT commands also tells the module to set the mobile operating band to DCS. This allows the module to connect to a network faster since it is instructed to only connect to GSM frequencies inside the DCS frequency band.

The third part of the code is the loop function. This is where the Arduino does its processes and repeats it continuously. In this project, the loop function contains the process when the Arduino senses the availability of the software serial communication.

Furthermore, the loop function contains the if-statement which allows the Arduino Uno to send the data gathered in the DHT22 module to the user via a text. Once the GSM module receives a text, the received message is compared to the word “SEND”. If the received message is the word “SEND”, the Arduino sends the data obtained from the DHT22 sensor to the user.

The fourth part of the code is the SendTextMessage() function. This function allows the Arduino Uno to send the data to the user. The first portion of this function is the acquisition of data from the DHT22 sensor. Also, this is where the Arduino prints the message to the GSM module before transmission.

When receiving the message, it is vital to change the phone number to ensure proper transmission and reception of data. You may change the phone number in the given code.

The fifth and final part of the code is the receivedMessage() function. This function gets the message and number of the sender. The importance of the message to the overall project was explained in the earlier portions of this tutorial, wherein the Arduino send the data if and only if the message is the word “SEND”.

Conclusion

The SIM800C GSM module can be interfaced with different sensors as a way to gather and send real-time data. The DHT22 sensor is just one of them. It is always up to you to think of different methods to fully harness the capabilities of the GSM module.

References

 

Tags : arduinoDHTDHT22GPRSGSMhumiditySIM800Csmstemperature

Leave a Response


Warning: Cannot assign an empty string to a string offset in /home/createl1/public_html/community/wp-includes/class.wp-scripts.php on line 454

Warning: Cannot assign an empty string to a string offset in /home/createl1/public_html/community/wp-includes/class.wp-scripts.php on line 454