Introduction: How to Build a WiFi Thermometer
In this instructable, you will learn how to build a WiFi Thermometer.
Source code is also included.
Step 1: Overview
I built a WiFi IoT board called WiThumb and would like to show you one of the many applications enabled by WiThumb. It is currently listed on KickStarter to make it available to more people. Check it out.
In short, WiThumb is an Arduino compatible WiFi IoT board with integrated high precision temperature sensor and 6-axis IMU (gyroscope + accelerometer). An optional plastic case could be ordered through KickStarter as well.
- 32-bit MCU with 802.11b/g/n WiFi (ESP8266)
- Integrated TCP/IP protocol stack
- 4MB Flash memory
- Precision temperature sensor (+/- 0.25C typical accuracy)
- 6-axis Gyroscope + Accelerometer
- IO pins: One 10-bit ADC, I2C and GPIOs
- Breadboard friendly (0.1" pitch header holes)
- Optional plastic case
- Compact (1.9 inch x 0.85 inch PCB)
- USB Powered. Plug in anywhere.
- Large community (Arduino, ESP8266 WiFi)
- Easy to program
- Easy to carry
- Low cost
- Low power (deep sleep mode)
- Plastic case protects the electronics
Step 2: Flash the WiThumb
(If you are familiar with ESP8266, you may skip step 2 and 3)
WiThumb is compatible with Arduino. However, it needs to be flashed before the first use. Here is how:
- Download and install the NodeMCU flasher program here : https://github.com/nodemcu/nodemcu-flasher
- Plug in WiThumb to your PC
- Run NodeMCU flasher
- Select the COM port that corresponds to WiThumb
- Press the "Flash(F)" button in the program
- Press the "flash" button on WiThumb for about 1 seconds and release it
- It will take about 1 minute to complete the flash process.
Step 3: Install Arduino Core Libraries for ESP8266
In order to compile and load the executable to WiThumb through Arduino IDE, you need to add the core libraries for ESP8266 to Arduino environment. To do so, simply follow the instructions on this GitHub page.
Once it is done, invoke Arduino and select "NodeMCU 1.0" as your board. Now, you should be able to compile and load the executable to WiThumb.
Step 4: Download Temperature Sensor Library
The temperature sensor used in WiThumb is MCP9808 from Microchip.
There is a library written by Adafruit for MCP9808. Download it from here and add it to your Arduino IDE:
Step 5: Download My Code
The code could be downloaded from here:
It should be pretty self-explanatory. It measures the temperature every 2 minutes (roughly).
Here are the steps:
- initializes the temperature sensor and reads the temperature
- logs into the WiFi network (you need to fill in the SSID and password in lines 28,29)
- post the readings to the cloud (hosted on https://data.sparkfun.com). But before you can do that, you need to create a data stream and obtain a public key and a private key. Don't worry, I'll show you how in the next step.
Step 6: Upload Readings to the Cloud
To create a data stream, follow these steps
- Go to https://data.sparkfun.com
- Create a new data stream (by clicking 'create' button on the right)
- Fill in all the mandatory entries. In the 'Fields' entry, enter 'temp'
- Once you save it, a public key and a private key will be assigned. Private key is like the password. Don't share it with anyone else.
- Now, enter both keys in lines 35 and 36 in the Arduino program
- Once you saved, compiled and uploaded the program to WiThumb, it will start logging the temperature to Sparkfun every 2 minutes.
- You may also open the Serial Monitor in Arduino to review the debug messages.
- Once everything looks good, you could unplug WiThumb from your PC and plug it in to any USB type A connector to measure the temperature at any location interested.
Step 7: Plot the Graph
To see the temperature readings, you can simply go to
(where is your public key you obtained in the previous step)
One of the benefits is that you could export the data to analog.io to plot the temperature online.
Here is how:
- Click on "Export to Analog.io" button on the upper right corner
- Select "temp" and click "load all" button on Analog.io website
In my case, I put WiThumb in the freezer to see how cold it can get . It went all the way to 0 degree F. Impressive!
Step 8: Where to Buy
If you want to build a WiFi thermometer but don't want to deal with messy wiring, you may want to buy a WiThumb.
We are currently accepting pre-orders on KickStarter.com
Please help us spread the word. Thanks!
We have a be nice policy.
Please be positive and constructive.