The project ESP8266 Temperature Logger using PIC16F887 is build up using PIC16F887 microcontroller (MCU), ESP8266 WiFi module and a ThingSpeak API. Previously, we posted Arduino and ESP8266 based webserver and this project is somehow similar.
Here is a PIC16F887 microcontroller and ESP8266 based temperature logging system. The project; ‘ESP8266 Temperature Logger using PIC16F887’ monitors temperature of the vicinity simultaneously and provides details of information collected. Well, the project also incorporates a modern concept; ThingSpeak which ensures safe storage and retrieval of data from things over the wide internet zone. It is an IOT(Internet of things) application and API, it is an open source platform and is gaining more popularity for the reason. This platform ensures possibility to make use of data from different electronic devices, sensors etc., by storing it on the internet and then make required observations to reach a conclusion after proper analysis of those information.
So as to obtain the temperature details from the project ESP8266 Temperature Logger using PIC16F887, you can login into browser on your device and use ThingSpeak API through Wifi.
Circuit Description of ESP8266 Temperature Logger using PIC16F887
Fig. 1 below gives details of the circuit layout of this project. The project includes microcontroller PIC16F887 MCU (IC4), ESP8266 Wi-Fi module, logic-level shifter, LM35 temperature sensor (IC3), 3.3V regulator LM1117-3.3 (IC2), 5V regulator 7805 (IC1) and 16×2 LCD module (LCD1) as the building blocks.
The entire circuit is powered using two power sources; 5V is required for PIC16F887, LCD and Logic-Level Shifter IC where ESP8266 module requires 3.3V. Since this ESP WiFi module intakes a regulated 3.3V altogether, you can replace IC2 with an adjustable voltage regulator, but be sure the voltage is precisely 3.3V.
The temperature sensor IC3 collects data and then forwards as input to IC4 through pin 2. The IC4 is responsible to transmit data to the Wifi module(ESP8266) via a logic level shifter. Finally, we can read the recorded temperature details on the screen of our gadgets; smartphone and laptops browsing through ThingSpeak website once the WiFi module executes data transmission process.
We establish the connection between the Wi-Fi modem of the user to ESP8266 Wi-Fi module and the temperature details are loaded onto the website of ThingSpeak, and it allows us to view the statics of temperature data on our devices through browser.
For visual interpretation of the project, LCD(pins D0-D7) is interfaced to IC4 (port B) which displays information about the circuit status and recorded data.
Software of ESP8266 Temperature Logger using PIC16F887
The programming is done in C language which makes its simpler to understand. We used MPLAB IDE version 8.9.1 and HI-TECH C compiler version 22.214.171.12420 to compile the source code. MPLAB ICD 2 programmer board was used to load the program onto the microcontroller.
Initially, when the project is executed a welcome message; ‘WiFi Temp Logger’ is displayed on the LCD which ensures the circuit is triggered.
Now, proceed with the ThingSpeak website; www.thingspeak.com
Now follow these steps:
- Sign Up into ThingSpeak using your email ID and fill up the required field as shown in figure 2.
- Create a field as shown in fig.3 to create your own channel and hit the save button.
- Now open your created channel and get your API key by clicking API key tab you will get two API key i.e. Write API key and Read API key as shown in figure 4.
- Now you have three things; channel ID, a write API key and Read API key; use channel ID and write API key to use in C code and a read API key; to use in observing data on our cellphones or laptop. Store them carefully.
- Set the baud rate of the ESP8266 Wi-Fi module to 9600. Place a Wi-Fi modem which has internet connection next to the set up.
- Open Temp-data-log.C source code and make following changes: put your Wi-Fi name, Wi-Fi password and API key in places of BEPWifi, BEP12345 and API key respectively in previously listed code.
The Wi-Fi module ESP8266 performs task on basic AT commands. You can use hyper terminal of window in order to test ESP8266. The complete command of ESP8266 can be downloaded from the given link. www.pridopia.co.uk/pi-doc/ESP8266ATCommandsSet.pdf
To set the baud rate on the latest ESP8266 platform, use AT+IPR command as AT+CIOBAUD no longer works in modern versions. Use the below link for detail view of command. www.esp8266.com/viewtopic.php?f=13&t=718
To obtain the API keys, visit Data IMPORT/EXPORT section and open your channel. Alter the field value and provide number you want to upload in this link https://api.thingspeak.com/update?api_key=4L77HR0XBBBVZNVU&field1=0
Then will find a graph of data of temperature details under Private View Section similar to one shown in fig. 5.
The link for cellphone and PC observation is provided in respective channels.
After the API key and channel id in that link is replaced by read API key and user’s channel ID, open that link on your device through browsers to get recorded graphic details of the temperature.
PARTS LIST OF ESP8266 TEMPERATURE LOGGER USING PIC16F887
|Resistors (all ¼-watt, ± 5% Carbon)|
|R1 = 1 KΩ
R2, R4, R5 = 10 KΩ
R3 = 470 Ω
VR1 = 10 KΩ Potmeter
|C1 = 1000 µF, 35V (Electrolytic Capacitor)
C2, C3 = 0.1 µF (Ceramic Disc)
C4 = 100 µF, 16V (Electrolytic Capacitor)
C5, C6 = 10 µF, 16V (Electrolytic Capacitor)
|IC1 = 7805 (5V series voltage regulator)
IC2 = LM1117-3.3 (3.3V Linear Regulator)
IC3 = LM35 (Temperature Sensor IC)
IC4 = PIC16F887 (Microcontroller)
Logic-Level-Shifter = 8-pin logic-level shifter
WiFi Module = 8-pin ESP8266 Wi-Fi Module
LCD1 = 16×2 Alphanumeric LED
|SW1 – SW2 – Tactile Push-to-on Switch
CON1 = DC Adapter Connector