I know I know what your thinking, Here’s another temp logger based on the esp8266. After looking around on the internet it looks like every man and his dog are making temp loggers powered by everyone’s favourite IoT dev board, the esp8266. Ever since the esp8266 came out I wanted to do a project with it, I’m glad I delayed until now before starting to develop my temp logger. Looking back I first ordered a esp-01 way back in Nov of 2014 but back then there wasn’t really much to do with them since they didn’t have a replacement firmware they have now, You still had to use a micro to control it via AT commands.
I started home brewing my own cider/beer after getting all the kit needed for a birthday present in august of 2015, I’ve always wanted to get into it be never took the plunge to get set up. All was going well in the nice weather of the summer and I was brewing in the garage. This came to a stop when I realised that winter was drawing in and the temp was dropping below the recommended temp of 15C. Long story short I moved to another room in the house but still I was curious as to how cold it would get when it was frosty out. This is when I quickly knocked together a temp sensor/logger using my raspberry pi.
I knew the raspberry pi was over kill but it did what I needed to do in pinch. I knew I need to move over to using the esp8266 and found the Nodemcu firmware and started developing the temp logger.
Final hardware I settled on was
- WS2812 x 1
- AMS1117 3.3v regulator
- CP2102 usb to serial
- 10k resisors x 2
- Male usb port
I decided to use the esp-01 module because I only need 2 GPIO pins since I was using the DS18B20 temp sensor and the WS2812 LED. This made the hardware really cheap and easy to reproduce too. I normally use FTDI boards when it comes to the USB to serial on my projects but I couldn’t find a FTDI board with micro USB that didn’t cost the earth. That’s why I went with the CP2102 which I hadn’t used before.
I think what really made me feel good about this project was the fact that I came up with the idea to use a Full sided male USB port for power teamed with a AMS1117 3.3v voltage regulator. This would allow me to just plug this straight into a USB wall wart or a phone charger battery bank.
I added a switch so that I could switch between uploading code mode and flashing a new firmware. While I was at it I added a reset button.
My temp sensor hell
I’ve using temp sensors with the arduino platform before but didn’t give too much thought to how accurate they were this is until now. I used a BMP180 temp sensor on the raspberry pi set up and it seamed really accurate and was i2c so really easy to interface with. On moving to the esp8266 I quickly realised that with the nodemcu firmware I would be short on RAM and run into errors.
The RAM problem was because I wanted to add the ssd1306 oled screen which uses a lot of RAM its self
First I tried the BMP180 which was really accurate but would run into the dreaded ‘out of memory’ error using this library. Again I believe this was to do with me using the ssd1306 OLED screen.
next up I tried the DHT11 temp and humidity sensor but found it to be too inaccurate being at least 2 degrees out. Even with the suggested 10k pull up resistor It didn’t seem to make a difference. This sensor I didnt run into any memory errors because It has the library built into the nodemcu firmware.
With the DS18B20 sensor I also ran into the ‘out of memory’ error while using it with the ssd1306 OLED screen. It was as accurate as the BMP180 sensor but only need VCC, GND and a single data line. Library can be found here
I found some really cool projects that I borrowed some code from. Firstly I found this guy that made a IFTTT button what had some wi-fi configurable code in his project. Basically if it can’t find the present WiFi network it will turn its self into an access point that allows you to set new WiFi credentials from the web browser on your phone or laptop.
Also I found A great blog post about controlling LED’s via a web server. I incorporated the web server to display the current temp and to turn the WS2812 on or off.
As usual all my code is available over at Github
Lua code – https://github.com/facelessloser/temp_logger_esp8266/tree/master/final_temp_logger
Gerbers files – https://github.com/facelessloser/temp_logger_esp8266/tree/master/gerbers
Time lapse build –
Hardware walk thought –