This post originated from an RSS feed registered with Python Buzz
by Aaron Brady.
Original Post: ESP8266 and MicroPython Temperature Logger
Feed Title: insom.me.uk
Feed URL: http://feeds2.feedburner.com/insommeuk
Feed Description: Posts related to using Python. Some tricks and tips, observations, hacks, and the Brand New Things.
I have internal temperature graphs that show what’s going on, courtesy
of a BME280 Adafruit board that I bought:
You can see the slow build up to temperature, the rapid cycling at or
near the top of the cycle and when the furnace gives up and the
temperature creeps down. Oh, and by the way, it’s pretty cold out.
Google reckoned it was down to -20 last night, but I honestly can’t
get my brain around a temperature like that and I always feel it’s
milder at my house than Google (or the Weather Channel) say it is.
It’s time to science this up.
I had actually ordered another BME280 board from eBay more than a
month ago, at the same time as the Adafruit order from BuyAPi.ca, and
it just showed up yesterday. What perfect timing.
I needed to use the WebREPL server to upload both the library and my
new boot.py file which contains all of the Python I had to write for
this. Basically it just sends a UDP packet to my Raspberry Pi every
few seconds.
I used the Xiaomi battery pack I blogged about before to power
the whole lot. As that previous post mentions, the battery pack will
turn off if there isn’t enough current being drawn. Unfortunately the
ESP8266 and the BME280 are too damned power efficient, only drawing
73mA. This is less than the 90mA that we need.
I added the four-200Ω resistor pack, bringing the consumption
(according to my ammeter) to 170mA total. This is wasteful but, meh,
this is a quick hack. It also gives me a nice LED to see that the
power is on.
This is a useful feature because I threw the whole thing into a
transparent box to weather proof it, and now I can see if it’s on or
not without going out into the cold.
Here’s the completed graph:
You can see that it took a little while for the unit to get down to
outside temperature, it dropped to -18C at the lowest point, and the
battery ran for 16 hours.
The current consumption is (0.17A × 5.1V) 0.87W, so the power
should have run for ~18 hours, but given that it was -18C below, I
think it’s fair to say that the battery did pretty well.