espIOT code for PIC16F887 MCU is written in C language. It is compiled using MPLAB IDE version 8.91 and HI-TECH C compiler version The generated hex code is burnt into the MCU chip using MPLAB ICD 2 programmer board.

Fig. 6: Actual-size PCB layout of the Wi-Fi temperature-logging system
Fig. 6: PCB layout of the Wi-Fi temperature logging system
Fig. 7: Component layout of the PCB
Fig. 7: Component layout of the PCB

Download PCB and component layout PDFs: click here

Download source code: click here

Construction and testing

An actual-size, single-side PCB layout of the Wi-Fi temperature logger is shown in Fig. 6. and its component layout in Fig. 7. When the circuit is switched on, the program initialises the LCD and flashes welcome message ‘ESP Temp Logger’ on the LCD.

If there is any display problem on the LCD, check voltages at various points as listed in the test point table. If the LCD is showing a proper message, go to

Fig. 8: New channel
Fig. 8: New channel
Fig. 9: Temperature data plotted graph on
Fig. 9: Temperature data plotted graph on

First, sign in to and then create your own channel by creating a field as shown in Fig. 8.

After saving the channel, you will receive channel ID and two API keys—a write API key (it is to be used in our C code) and a read API key (it is used to check the data from website on your smartphone or PC). Make a note of these keys as you will need these later.

Before using the system, ensure that Esp8266 module baud rate is changed to 9600 as most of these have 115200. Also, a Wi-Fi modem with an Internet connection should be kept near your circuit board.

Next, make the following changes in the espIOT.C code:
1. Replace eRocks14 with your own Wi-Fi name
2. Replace erocks2014 with your own Wi-Fi password
3. Replace API key with your own API key received

ESP8266 works on basic AT commands similar to the ones used in any GSM module interfacing project. It can be easily checked and tested from HyperTerminal of Windows. The link to AT commands is

In the latest version of ESP8266 firmware, baud rate setting command AT+CIOBAUD is no longer supported. You can replace this command by AT+IPR. The detail of this command can be found on

When you open your channel under Data IMPORT/EXPORT section, you will get your API key. Call this link[THINGSPEAK_KEY]&field1=0 by changing the field value and give any number you want to upload. In Private View section, you will see a graph of the data as shown in Fig. 9.

For checking the results on a smartphone or PC, a link is provided in the respective channel. It would be something like

In this link, API key is replaced by Read API key and channel id is replaced by the user’s channel ID. Copy and paste this link in search bar of the browser in your smartphone or PC. You will get the recorded temperature data information.

If temperature data has been uploaded, you will be able to see the graph here. Temperature data on is shown in Fig. 9. You are now ready to go with your first IoT project.


This project can be used as a guide for various other related projects for your home systems; not just temperature but also energy consumption and many other interfaces that can be easily checked on your smartphone.

Osho Gera is a second-year B.Tech student, studying at Bharati Vidyapeeth’s College of Engineering, New Delhi



  1. It is very good project. please tell where can i get esp8266 chip. can I use another mcu for this project instead of pic.?

    • Here’s the reply from the author Osho Gera:
      “ESP8266 module is easily available on Internet, and any micro-controller can be used. I have developed the same project on ATmega16.”

    • No this is the easiest way, of course you can use resistors and transistors for signal level shifting application.

  2. Here’s the reply from author Osho to Siti Masliana.
    “If you look closely at the ASCII table , you would note that there are 31 characters that include some special characters like \t,\n,the actual characters starts from space i.e ASCII 32 also the output received from the strstr function is in char type pointer. Yes, I could compare with a null object (‘\0’) but I preferred to check with a threshold like space.
    I hope this clears the doubt.”

  3. i tried this project using PIC16F877A. while building strcat function is not it a syntax error i have done the same coding as you did strcat(value,”AT+CWJAP=\”eRocks14\”,\”erocks2014\””); but this is always getting error.

    • Please see the comments in the code. The ‘ erocks2014’ is the Wifi router name we used during testing. You need to replace it with the name of your Wifi.

  4. Hi, iv put the code in is there a reason u can think of that the ESP8266 only works after flashing the pic ? When i put it off and on again it fails to connect, unless i reflash it.

    • The output of the project is temperature value shown in the LCD and also live temperature data graph on the website.

  5. Why don’t you just use the ESP8266 for this project and drop the PIC proc?. ESP8266 is a complete microprocessor with WiFi which can be easily programmed with the Arduino IDE. Simply use the ESP8266 fitted on one the breakout boards commonly available, this will give you the I/O ports you need for your project.


Please enter your comment!
Please enter your name here