Close
0%
0%

ESPmobe - battery powered ESP8266 IoT-sensor

A compact, battery powered IOT multi sensor module with wifi & MQTT support. Feat. temperature, humiditity, lux, air pressure, PIR & more

Similar projects worth following

A smart home offers the possibility of making your life easier and save energy.

For this purpose you have to gather data of your home (the more, the better ;)).

Unfortunately, there are no combined sensors, which fulfil all of my requirements - so I have design it myself - and share it with the community. of course!

Let’s summarize my objectives for this project.

  • Battery powered (battery life better than 6 months)
  • Wifi and MQTT support
  • PIR sensor
  • Ambient light sensor
  • Temperature and humidity
  • Not that expensive
  • Small form factor

ESPmobePCBv1.pdf

Schematic

Adobe Portable Document Format - 70.49 kB - 05/09/2017 at 18:02

Preview
Download

  • The Batteries

    Michael05/27/2017 at 10:38 1 comment

    I designed the circuit with the idea to use batteries without a voltage regulator, because they use current every time. The sensor board should stay in low power mode most of the time, so a voltage regulator (even the ultra low power ones) could be responsible to a significant amount of power drain.

    Not long ago, Espressif updated their datasheet of the ESP8266. Now they state the operating voltage is between 2.5 V and 3.6 V (in the past, they only guaranteed a minimum voltage of 3.0 V).

    By my own experiments, I found a working minimum voltage of 2.3 V using different modules. This allows to use different battery technologies directly. Sadly, the wide known LiPo batteries are no candidates, because their voltage ranges from 3.0 V (drained, better go not lower than that) to 4.2 V fully charged.

    For microcontroller circuits there is another interesting alternative: LiFePO4. The nominal voltage of one cell is 3.2 V, which is near the 3.3 V of modern electronics. They are fully charged at 3.6 V (perfect) and can be discharged to 2.5 V – 2.0 V (depends on the manufacturer). I managed to get cells in the AA-battery size with 700 mAh capacity and used two in parallel.

    The next possibility are NiMH-cells. You have to use two cells in series because their nominal voltage is 1.2 V per cell. Fully charged they are near 3 V, then they have a long plateau around their nominal voltage and at 2.3 V they are over 90 % drained. Sounds good. I used Eneloops which have a low self-discharge rate. Their capacity is araound 2000 mAh.

    As alternative you could also use alkaline batteries. If they last long enough, they could be an option because they are way cheaper than the rechargable NiMH-cells. 1.5 V is their nominal voltage, which is slightly higher if they are new. They can be drained until no voltage remaines, but they are quite dead at 2.3 V (or 1.15 V per cell). The capacitiy is a bit higher than the Eneloops at around 2500 mAh.

    I programmed a test procedure to get battery life results in time-lapse: The sensor board wakes up, connects to my Wifi, reads the sensors, reports the states to my MQTT broker, sleeps for 5 seconds an repeats everything. At every wakeup it increments the reboot number and stores it in the RTC memory to last between the wakeups.

    I got the following results:

    Battery Voltage Range RebootsLifetime (10 reboots/h)
    LiFePO4 (2P)3.5 V – 2,26 V53706223 days
    Eneloop (2S)2.9 V – 2.27 V82883345 days
    Alkaline (2S)3.3 V – 2.26 V91652381 days

    :

    At a wakeup rate of 10 wakes per hour or every 6 minutes, every battery technology can achieve the desired goal of 6 months of operation. Of course the lifetime will be lower in the real usecase, because the test didn’t acount for the standby currents. The winners are clearly the alkaline cells, followed by the Eneloops. For environemntal reasons, I will choose the NiMH, because they are rechargable.

  • The Prototype

    Michael05/09/2017 at 18:31 0 comments

    This is the first and unexpectedly working (!) prototype:

    It has a dimension of 80 mm x 80 mm. The strange shape is because a had a case in mind. Therefore, I had to align the batteries this way because there are studs in the corners.

    The board is populated with ready-made modules which take a lot of space. The light sensor module was even bigger, so I had to cut it brutally with my pliers into shape.

    Beneath the Wemos D1 module, there resides a ATTiny85 for the PIR sensor interaction.

    The PIR sensor is connected via cable, so I can interchange it.

    It turns out that the PIR sensor is very sensitive to voltage variations on the power rail.

    Every time the ESP connected to the network, the PIR sensor was triggered.

    Finally I was able to get rid of it with a bigger capacitor on the ESP power input and a 33 pF capacitor directly on the pins of the PIR sensor for fast spikes.

  • The Sensors

    Michael05/05/2017 at 14:08 0 comments

    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.

  • The Goals

    Michael04/14/2017 at 17:34 0 comments

    I like home automation a lot. For automation purposes data must be collected. I also like open software. But mostly I do like my own data not being on any strange servers outside my home.

    So my goal is to design a sensor node to gather mostly useful data, that can be used to automate everything in my home (like lights, heating, blinds, media etc). They should speak MQTT, so I can easily integrate them in my home automation server (I use home assistant).

    For my first tries I used NRF24l01-modules, they are cheap and have low power consumption, but you need an extra controller and a gateway to the host system. In the last years the ESP8266s showed up. Cheap, with Wifi, own microcontroller and a growing software environment and community. Great! But they are power hungry and bad for battery applications. But there are ways to deal with it - more of that later ;)

    Let’s summarize my objectives for this project.

    • Battery powered (battery life better than 6 months)
    • PIR sensor
    • Ambient light sensor
    • Temperature and humidity
    • Not that expensive
    • Small form factor

View all 4 project logs

Enjoy this project?

Share

Discussions

Michael Haas wrote 04/25/2018 at 03:36 point

Very interesting project. For my own sensor node project (not posted on hackaday.io), I use three NIMH batteries along with a LDO with very low quiescent current.


My batteries last about three months, with one wakeup every 15 minutes. I do have a transistor to turn off the sensors while the ESP is sleeping.

Connecting to the WiFi is usually faster than 1s for me, but can also take up to 5s. This is also a big drain on the battery.

One issue that I have that is the batteries can become deeply discharged, breaking my precious Eneloops. I use the built-in ADC to measure battery voltage - I want to add some code that turns the ESP off forever if it gets too low.

I am very interested to hear about your battery life time in the field in a couple of months!

  Are you sure? yes | no

Michael wrote 05/14/2018 at 18:14 point

Hello Michael,

sadly I had to postpone my project in the past. 

But I plan to revive it next months and will gladly report my results!

  Are you sure? yes | no

Michael wrote 08/14/2017 at 11:54 point

Regarding the attiny again:

I programmed it the way, that if new movement is sensed, it wakes up the ESP one time. The ESP sends the state to the MQTT-broker and goes into deepsleep again.  If the movement stops, there is a delay of 5 minutes. If in this period was no movement, the ESP is woken up again to report the OFF state. If movement is registered in this period, the delay will be extended by additional 5 minutes. So the ESP has to be active only the minimum amount of time. The Attiny itself also goes into deep sleep, but will be woken up by the pin change interrupt through the PIR.

  Are you sure? yes | no

Michael wrote 08/14/2017 at 11:43 point

Hello Björn, 

thanks for your input! First I planned to use lipos with ultra-low quiescent current LDOs and a usb charger circuit. (Microchip has some nice ones, I didn't know of the 7333 series - thank you!). But than I realised, that for the costs of the lipo-system, I could buy alkaline batteries for about 10 years or more. So I changed my concept regarding  the KISS principle (keep it simple and stupid) reducing the initial costs. The board also got significantly smaller. And if you want it rechargeable, you could always use NiMH batteries.

I use the Attiny to deal with  the PIR sensor. The PIR-sensor itself is stupid and with no movement its output is LOW and with every small movement its HIGH. It can change very rapidly between these states. If I use a simple reset circuit, it would wake up the ESP multiple times a second. On the other hand, if I detect the movement directly with the ESP, it has to be always on and drains the battery in no time. To deal with that, I first used a 74HC123D, which is a retriggerable astable multivibrator. That worked, but to change the delay times, I would have to change components or use a potentiometer. For only the double price of one of that IC, I get a Attiny, which has a lower parts count, full flexibility and uses fewer power. So I settled with that. Later it may possible collect also other sensor data with the Attiny, so the ESP has to be woken up even fewer times.

To the EKMAs: Yes, the german ebay is where I ordered a bunch of them :) . But you never know how long this source is will last.

At the moment, I have some working PCBs (you see a picture of the CAD model in this project) and I will update my hackaday project in the near future with new information about it. :)

Greetings,

Michael

  Are you sure? yes | no

Björn wrote 06/25/2017 at 08:54 point

Hi Michael, just came across your project while trying something similar. Just some hints regarding the batteries: If you do not use a voltage regulator like the usual am1117-3.3 and instead use a 7333 series ldo which consumes around 2µA while idling you might reach your goal even with the usual lipo battery packs+ldo. It even follows the input voltage up to 2.5v ( with a 0.1v drop).

Another thing: i currently do not understand why you use the attiny. it should be possible to use the pir directly on the reset pin of the 8266, perhaps with a small circuit, a transistor/fet and a capacitor or something like this to achieve the same functionality.

Btw.: The panasonic ekma's are available on ebay for cheap, even with delivery sources in germany, only the preferred black version isn't available anywhere :)

Best regards,

Björn

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates