Introduction: Tiny ESP8266 Temperature Logger (Google Sheets)
This is a guide on how to make your very own, absolutely tiny WiFi enabled temperature logger. It is based on the ESP-01 module and the DS18B20 digital temperature sensor, packed into a tight 3D printed case with a 200mAh lithium battery and micro USB charger.
It really is an awesome project if done correctly, but word of warning it is very frustrating to solder everything manually and keep it so small without breaking anything and getting the software working is quite long-winded. So please read the whole instructable before giving it a go.
If anyone builds one I'd love to see it and what you're using it for, so far I've used it to determine the duty cycle of my A.C. on a typical summer day(50min on, 20min off) and will use it to monitor the temperature of sausages in the winter...
Step 1: Materials/Equipment
Although the components are few and the schematic quite simple, it takes a lot of effort to get them into a nice and functional form factor...
The components that you will need are:
- One ESP01
- One 200mAh LiPo Battery
- One TP4056 LiPo Charger Module
- One HT7333A 3.3V Voltage Regulator
- One DS18B20 Temperature Sensor
- Two SMD 4.7kΩ Resistors
- Two Tiny Push Buttons
Tools/Equipment that you will need are:
- Thin Insulated Wire (I used wire-wrapping wire)
- Soldering Iron/Station, Solder, Flux and a Desoldering Pump
- Snips/Wire Strippers, Tweezers
- A Computer
- An ESP01 Programming Board
- A 3D Printer
- Superglue/Cyanoacrylate adhesive
Step 2: Soldering: the Tiny Deep_Sleep Wire
One of the key features a battery powered logger needs to have is a low power mode so that it can last for as long as possible. The ESP8266 has the ESP.DeepSleep(); option, but it requires GPIO_16 to be connected to the EXT_RSTB(Reset) pin, which unfortunately for us is not broken out on an ESP01 module. This means we need to hand solder a thin wire to the correct pin on the SMD ESP8266 chip. This is quite challenging but can be done using just a regular soldering iron and a lot of patience and steady hands. GPIO_16 is the last pin on the side of the chip near the decoupling capacitor since it is on the edge it makes it a lot easier to solder on to. Good Luck!
Step 3: Prototype
Before compacting it down to the final electronics to go in the case I made a prototype using perf-board. This was an optional step to check that all the components would work together, as it will be much harder to troubleshoot once it is miniaturized and inside a tight case. Could also easily be done on a breadboard.
Step 4: Programming
To program the ESP8266 you can use a cheap programming module from China with a slight modification adding a pushbutton to connect GPIO_2 to ground. Flashing an ESP8266 is out of the scope of this instructable, but it can be easily done with the Arduino sketch found on the GitHub page. Make sure to install the ArduinoJSON and the OneWire library and of course the ESP cores.
IMPORTANT! Do not forget to upload the SPIFFS data onto the board. The logger will not boot without the configuration file stored in SPIFFS memory.
Step 5: Interwebz: Google Forms
The backend of our logger will be done with Google Forms and Sheets and IFTTT in between. Just following the pictures from here is the easiest thing to do.
- Make a new form.
- Capture form response request with Google Chrome's Developer Tools.
- Note request URL, and request data
- Connect Form to auto-updating Google Sheet
- Add graphs to sheets
Step 6: Interwebz: IFTTT Webhooks
Really just follow the step-by-step pictures at this point.
- Create a new IFTTT applet
- Select the trigger as a Webhook request event, note the event name.
- Select the action to be a Webhook request.
- Paste the request URL from the Developer Tools form the Google Forms.
- Set the request method to POST
- Set the content type to 'application/x-www-urlencoded'
- Paste the raw request data from the Developer Tools form the Google Forms.
- Find the fields for temperature and voltage and replace with 'Ingredients'; Value1 & Value2.
- Finish applet.
Step 7: Interwebz: Set-Up Your Logger
- Visit the IFTTT Maker Webhooks documentation here: https://ifttt.com/maker_webhooks
- Copy your trigger URL, after entering the event name.
- Enter setup mode on your TinyTempLogger by holding the setup button and pulsing the reset button, connect to ESP_Logger and open 192.168.4.1
- Enter you URL, split into Host and URI
- Enter 'value1' and 'value2' as the names for the parameters.
- Click on save then reset.
Your logger should now be able to post data to Google Sheets, through the IFTTT relay.
Step 8: Soldering: Battery, Charger and Regulator
By this point, you should have a fully functional prototype on breadboard/perf-board. During the next few steps, we will solder up all the components dead-bug style, into the smallest form factor we can.
Start by soldering the battery, regulator, and charger to each other, according to the schematic.
The schematic can also be found on the GitHub page. https://github.com/Gangster45671/ESP8266-Temperatu...
Step 9: Soldering: Remove Pin Headers
IMPORTANT! Before removing the pin headers make sure that you have flashed the program and the SPIFFS and have prototyped the circuit and confirmed that it works! Flashing memory after this step will be a pain!!
ONLY PROCEED if the circuit is fully functional as a prototype.
Removing the pin headers is a bit challenging, my strategy is to simply apply flux and try to heat all the pins at once with solder while using tweezers to pull out the pins. Then I use the soldering pump from below and the iron from the top to melt the solder that is stuck in the holes and suck it out. Be careful not to break the delicate deep sleep wire.
Step 10: SMD Resistor Soldering, Changing the Current of the Charger Module
Before we use the LiPo charging module with our small 200mAh battery we need to modify it. By default, these modules charge the cell at 500mA which is too high for small batteries. By changing the SMD current set resistor from 1.2kΩ(122) to 4.7kΩ(472) we can decrease the current to ~150mA. This way our cell will last longer.
Step 11: Soldering: Buttons
The first thing I soldered to the ESP-01 were the pushbuttons, I just used thin 'wire wrapping' wire and surface mount push buttons, just follow the schematic and keep everything as small as possible.
Step 12: Soldering: DS18B20
Next up I soldered the DS18B20 temperature sensor, first I trimmed its leads and soldered a surface mount 4.7kΩ resistor between the VCC and DATA pins, then it was just following the schematic to connect it to the ESP.
Step 13: Soldering: Attach It All Toghether
The last thing left to do soldering wise was to join the power wires coming from the battery to the ESP, then soldering was finally done!
Step 14: 3D Printing Time and Final Assembly
To finish up the assembly after making sure that everything still worked after it was soldered it was time to 3D print the case for it. I started by measuring out the dimensions and making the model in Fusion 360, unless you managed to make yours as small or the same size as mine you might need to tweak the Fusion 360 model. Otherwise, the STLs for the top and bottom of the case and the button pads are ready to print. I used Cura for slicing at 0.1mm resolution, 20% infill, ABS filament and "Print Thin Walls" enabled. Make sure to enable that or else the thin join that aligns the two halves of the case won't be printed.
STLs and fusion 360 files are on GitHub.
After printing it was just a case(pun intended) of stuffing everything into it and closing it up with super glue. It is a very tight fit and it will take lots of patience. I recommend something like Scotch Weld because it is slightly thicker, super glue tends to be really thin and cover everything and stick everywhere(including fingers).
Step 15: Complete
There you have it, an absolutely tiny WiFi enabled temperature logger. Good luck if you try assembling your own and much patience making these things small but still functional.