Stable ESP01 Motion Sensor for MQTT

Benny de Leeuw
2 min readJul 2, 2017

--

I tried some approaches to connect my motion sensor to an ESP8266. All of them were disappointments because of a lot of false positives. Even in complete dark spaces where no light changes or temp changes were.

Reading a lot of forum topics I found out it was the RF part of the ESP which triggered the motion sensor and so a false positive.

Eventually there was a short post of someone who used the OUT pin of the motion sensor to power up the ESP long enough to let it send a MQTT package. I tried this solution and it immediately was a success.

Below the scheme I used:

*JP1 is not really a jumper, just to add two pads for the power connection on the PCB.

The best thing of it is when you solder off the power LED from the ESP it will only draw 0.5 uA so it can run a long time on a 18650 battery.

So wrapping it all up, create software for your ESP which will publish some state to your MQTT broker and after that it will fall a sleep. Measure the time it takes for the ESP to boot, connect, send the message and fall a sleep (this will be approximately 3–5 seconds). Then make your motion sensor setting the output high for this time.

I’m used to creating my own PCB’s and so this is the (first) version I have build (this one had switches).

Update: I have to correct my findings of the amount of Amperes used…

The amount of mA used when sending, so when it is using WiFi
The amount of mA used when ESP is sleeping but still has a POWER LED.
The amount of mA used when ESP is sleeping but desoldered the POWER LED.

Yeah! 130 uA when nothing is happening and the motion sensor is enabled… I’m happy with it!

--

--