Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

GSM Based Temperature Data Logger with PIC Microcontroller – MikroC

GSM Based Temperature Data Logger with PIC Microcontroller – MikroC

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 how to use a GSM modem with PIC Microcontroller, please read: 

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, please read: 

Digital Thermometer using PIC Microcontroller and LM35 Temperature Sensor


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: A 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.

SparkFun bi-directional Logic Level ConverterFigure 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.

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

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 5: Connecting the SmartGM862 Board to EasyPIC7 V7 Development Board

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

GSM Based Temperature Data Logger with PIC Microcontroller Circuit Diagram

Figure 6: 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.

Nowadays prototyping PCBs are getting cheaper, a very good news for makers, hobbyists and electronic startups with a limited budget. You can get 10 PCBs (1-2 layers) for only $5 with PCBWay.com , a China Shenzhen-based manufacturer specializing in PCB prototyping, small-volume production and PCB Assembly service all under one roof.

You can also earn some money by referring someone like a friend to order their PCB through them. You will gain $20 discount coupon when you propose one person registration , the award will be available when your friend book an order successfully in PCBWay.com. You will also earn 10% of what they (1st order) spends cash. Your friend will also get $5 coupon when registers in PCBWay.

So what are you waiting for? Go to Invite a Friend page and send an invitation to your friends and get $20 coupon.

For more information, please visit their website by clicking on the image below:

PCBWay Home Page

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

Share this post

Select your currency
EUR Euro
USD United States (US) dollar