ThingSpeak temperature & pressure logger

Updated 31 March 2022

This project logs temperature and pressure observations to a ThingSpeak channel using an ESP8266 WiFi module.

For this project, I designed my circuit and ordered a PCB using easyEDA. The project gets power from a USB port and uses an HT7333 chip and a few capacitors to provide a regulated 3.3V supply.

The ESP8266 chip used has a few external resistors to ensure the correct boot mode and is connected to the BMP280 breakout board via I2C. Once the ESP8266 boots, it takes some readings, then connect to the WiFi and sends the values to the ThingSpeak channel. If the wifi connection fails it uses the WifiManager library to allow the user to set the WiFi settings. Between readings, the ESP8266 goes to sleep to save power.


To create this project the following components were used:

How I built this project:

Solder components to the PCB

When soldering the components first I clean the board with some isopropyl alcohol. I was using a recycled ESP8266 chip so it needed a bit of cleaning first. Next, I applied the solder paste to the top side of the board and used hot air to attach the chip. Components on the bottom side of the PCB were soldered using the same method. If you need any help with soldering, check out these tutorials.

The header that came with the BMP280 was soldered using a traditional iron, as was the programming header.


Testing connections

Once the board had been soldered, I tested the connections, unfortunately, I was a little too confident here and tested by first inserting the board into a USB power bank, the standard board was a little too thin for a PCB printed USB connector, though I was expecting this, and when I gave it a wiggle, suddenly I had a small puff of smoke - oh no...

Taking a step back, from the power bank also as I wasn't 100% sure that the smoke didn't come from its internals and I've always been a bit cautious of anything with Lithium batteries, I found that in my hurry to get the PCB's printed I had reversed the polarity of the USB connector on the board. I corrected this by sacrificing an old USB cable and soldering the wires to the PCB tracks with the correct polarity. I also used a USB power bank with removable AA batteries to test this time and this allowed me to do a continuity check using a multimeter first (GND is now GND - yay).

ThingSpeak Settings

Thingspeak is an IoT platform by Mathworks that is free for personal use. There is also a Thingview iPhone app that allows me to easily check on the status of my sensors. After logging into my ThingSpeak account, I created a new channel and added two fields, one for temperature and one for pressure. The APIwriteKey and channel number are needed in the program in the next section.

Programming the device

The ESP8266 was programmed using an FTDI breakout board and the Arduino ide. When programming the ESP8266 GPIO_0 was connected to GND via the programming header.


Code for the project is linked below. The code makes use of open source libraries available in the Arduino IDE, and I would like to thank the various library authors for their contributions.

Testing the final build

The first time the circuit was started the WiFi settings needed to be updated. The circuit was left on the bench for about an hour for testing. Data was sent correctly to the ThingSpeak channel at 1-minute intervals as designed. It was noticed though that the temperature values were a bit high. The circuit was placed in the fridge, which cycles between 1-4 °C, and while the readings dropped by approx. 20 °C the values were too high. (If this were real, my food would not be looking well). The atmospheric pressure readings looked reasonable, however.

I suspect that what has happened is the BMP280 has been damaged by the reverse polarity and needs to be replaced. Other than this the circuit appears to work well, the wifi connection appears reliable and most data points are being logged. I will order a new BMP280 breakout and see how it goes.



The new sensor has arrived, it is a BME280 as opposed to the BMP280 used previously, but the breakout has the same pinout for the power and I2C pins. I swapped out the sensor and made a quick change to the program to use the Adafruit BME280 library and add a humidity field to my ThingSpeak channel and did a test. Unfortunately, the temperature readings appeared about 10 degrees too high; so it's not the sensor.

A quick look on the internet shows a lot of people having trouble with the BMP/BME sensors and self-heating. Most cases report readings a couple of degrees higher, but some reports of more issues with the ESP8266 as opposed to Arduino. I know that the setup works as I have had a similar setup in another project working reliably for a few years.

To identify the issue I flipped the sensor to move it a bit away from the ESP8266. Still, readings are too high, but now with a bit more access, I can feel that the ESP8266, capacitor and regulator are warm, not hot, but warm. In this case, using the wifi every minute to report the values to ThingSpeak appears to be the most likely culprit.

Taking some ideas from a previous project I modified the code to take readings every minute and save them to ESP8266 RTC memory, the chip still uses deep sleep between samples and after 30 samples, connects via WiFi and uses the new ThingSpeak bulk update feature to send all 30 samples to the channel. Additionally, an updated AdaFruit BME280 library was found where the BME280 oversampling feature could be turned off. i.e. as opposed to the BMP/BME sampling continuously and the ESP8266 retrieving readings every minute, the new library can take a single sample on command.

As an added bonus the project now uses far less power. So much so that the smarts in my power bank turn off the USB output as the current is so low, and I have to operate it from a 'dumb' power bank, or appliance tv, pc etc. If more power saving was needed power for the BMP/BME sensor could be switched from an output of the ESP8266 which might result in even less self-heating, but for the moment the readings appear reasonable and its safe to say that most of the heat was from WiFi use.


Attachment - Project Files

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.



Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.