GSM Based Temperature Data Logger with PIC Microcontroller Block Diagram

           Figure 1: GSM Based Temperature Data Logger with PIC Microcontroller Block Diagram

A GSM modem is a wireless modem that works with a GSM wireless network. GSM stands for Global System for Mobile communications, this architecture is used for mobile communication in most of the countries in the world. 

A wireless modem acts basically like the traditional dial-up modem, the main difference is that a dial-up modem sends and receives data through a fixed telephone line while a wireless modem sends and receives data through radio waves. Besides the dial-up connection, GSM modem can also be used for sending and receiving SMS which is also one of the key features of GSM modem.

The operation of a GSM modem requires a SIM (Subscriber Identity Module) card just like mobile phones to identify a subscriber to the cellular network and to store the subscriber information. Also they have IMEI (International Mobile Equipment Identity) number similar to mobile phones for their identification. 

>>> To learn more on Interfacing a GSM mode: Interfacing GSM Modem with PIC Microcontroller 

The LM35 series are precision integrated-circuit temperature sensors from Texas Instruments, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. Its output is linearly proportional to Centigrade temperature Scale and it changes by 10 mV per °C.

>>> To learn more on how to use the LM35 Temperature Sensor: Digital Thermometer using PIC Microcontroller and LM35 Temperature Sensor

Connections

It is very easy to interface a GSM Modem to a PIC Microcontroller as most GSM modems have a serial interface. The USART serial input pin RX and TX of the microcontroller are connected to the TXD and RXD pins of the GSM Modem. Some GSM modems have PCMCIA Type II or USB interfaces. Figure 2 below shows a block diagram of a GSM module connected to USART module of a PIC Microcontroller.

GSM module connected to a PIC Microcontroller

Figure 2: GSM module connected to a PIC Microcontroller

NB: Depending on the GSM module used, a voltage level translator circuit may be needed to make the system work with a microcontroller. Microcontroller USART voltage level is 5V in most of the cases while most GSM/GPRS modems voltage level is about 2.8V – 3V, you need a voltage level translator circuit.

You can use any Logic Level Converter, like the SparkFun bi-directional Logic Level Converter which is a small device that safely steps down 5V signals to 3.3V AND steps up 3.3V to 5V at the same time. This level converter also works with 2.8V and 1.8V devices.

Figure 3: SparkFun bi-directional Logic Level Converter

A simple diodes/resistors network could do the job as well as shown on figure 4 below.

Three diode in series are used to drop down voltage of TX pin of microcontroller to to 2.9 volt (each diode drops 0.7V) which is in acceptable range for RXD pin of GSM module. Similarly a diode, a resistor and 5 volt source is used to increase voltage of TXD pin of GSM module to 5 volt which is logic high for RX pin of pic microcontroller.

Figure 4: A simple diodes/resistors voltage level translator circuit

>>> To learn more on Interfacing a GSM mode: Interfacing GSM Modem with PIC Microcontroller 

There are GSM boards on the market  that one can use to quickly interface to a PIC. For example the SmartGM862 Board from Mikroelekronika is one example of many boards. The SmartGM862 is a full-featured development tool for Telit GM862-QUAD GSM/GPRS module or the GM862-GPS version. It features GM862 module connector, voltage regulator, antenna holders, speaker and microphone screw terminals and more. DIP switch is provided for configuring UART communication lines with the target microcontroller. It can be connected to development boards via IDC10 connnector.

Connecting the SmartGM862 Board to EasyPIC7 V7 Development Board

Figure 3: Connecting the SmartGM862 Board to EasyPIC7 V7 Development Board

Figure 4 below shows the GSM Based Temperature Data Logger with PIC Microcontroller circuit Diagram.

GSM Based Temperature Data Logger with PIC Microcontroller Circuit Diagram

Figure 4: GSM Based Temperature Data Logger with PIC Microcontroller circuit Diagram

In this project, The ambient Temperature is read every Hour then sent to a specified mobile phone number as SMS Text Messages.

When the device is turned on, The GSM module is initialized, then the program goes into an endless loop. The Temperature is read, sent  to a specified mobile phone number as an SMS Text Message, then the program wait for one hour before reading the next temperature value.

The LM35 Precision Temperature sensor is connected to analog channel AN0 (PORTA.0). All the Microcontroller pins are set to Digital Input/Output except pin RA0 which is analog pin. The USART Interrupts are used to receive the modem responses. A response could be “OK” or “> ” and is terminated with a carriage-return and line-feed character pair. After sending an AT command, the program waits until a successful response is received from the modem.

MikroC Source Code

You can download the full project files (MikroC source code and Proteus Schematic design) below here. All the files are zipped, you will need to unzip them (Download a free version of the Winzip utility to unzip files).

MikroC Source Code: GSM_Logger