ESPMobes – The Sensors

I made my first IOT experiences with the ESP8266 with the ESP-Easy firmware. Therefore, I wanted to keep the hardware compatible. For performance reasons, I later switched to my own code (which I will publish in the future after an extensive code review ;)). ESP-Easy supports a variety of sensors. I chose the following:

For measuring temperature, humidity and air pressure. This sensor combines the most important data sources in one tiny package. In fact, it’s so small you can hardly solder it yourself but there are some small breakout boards which costs about $5. It can communicate over I2C und SPI.

To acquire information about the current light level, I use a BH1750 or the newer variant BH1751. It gives me a lux-reading according to the human eye response for about $1. Communication over I2C.

After a long research phase, I found a good deal for a bunch of these PIR sensors. There are many small chinese PIR sensors as well. And they work alright. But their current draw is about 60 µA. For them to work, they have to be active all the time, so they make a big mark on the power bill. Over a period of one year (which is the design goal for the battery life) this would sum up to 525 mAh. The power consumption of the Panasonic EKMA 1101111 is negligible 1 µA! Unfortunately, I haven’t found a good source yet to get them for a reasonable price from a major supplier. For my PCB design, I will include an alternative.

The output of the PIR sensor is easy. As long as it detects movement, it will give a HIGH on its output pin. Since the ESP8266 consumes about 80 mA at normal operation, there is no way that it can monitor the PIR state itself. The battery would be empty in no time. So I chose a second microcontroller to do that job. A ATTINY25 (which will be in deep sleep and will woken via a pin change interrupt from the PIR) reports the state of the PIR sensor and wakes the ESP from deep sleep, if there’s new movement or no movement anymore. To minimise the wakeups, not every movement is reported. Because I want to use it as some kind of presence detection, an initial motion will trigger the ESP and if there’s no motion for 5 minutes (of course you can change it) it will be triggered again to report the LOW state. If during this period motion occurs, the time to report the LOW state will be extended by another 5 minutes.

Flattr this!

Leave a Reply

Your email address will not be published. Required fields are marked *