I'm making an IoT project for a friend, but I need some tips: I want to use an old mouse sensor and convert it to a movement sensor (just for a door) and if it's activated, a second device (an esp8266) needs to be powered for just a minute (to send an alarm state to his phone). The problem is that the sensor provides just a few seconds and the second device won't be able to finish its work. So I need something that provides energy to the second device. What can I use?

Because it's an IoT project, I need something that doesn't consume power when it's not activated.


How is your ESP8266 powered? Via the sensor? How far is the sensor from the ESP8266? How is the sensor powered?

It is not a good practice to power the micro controller through the sensor.

A good approach to this is to put your ESP8266 into "power saving mode" and let the signal from the sensor "wake-up" the ESP8266 via interrupts. this video explains on how this can be done

Edit: You could use a feature of the 555 timer IC along with a transistor/relay. called the 555 bistable mode connect the Trigger pin to your sensor and the reset pin to the ESP.

| improve this answer | |
  • \$\begingroup\$ The esp8266 is powered from a Powerbank. My esp8266 has problems with power saving mode: when it tries to sleep, it crashes. Probably it's a firmware problem, but i'm afraid to change it because i know that could brick the device \$\endgroup\$ – Robz Aug 21 '19 at 20:06
  • \$\begingroup\$ how is the sensor powered? through the same powerbank? ESP should be capable of power saving modes, have you tried checking with a different esp ? \$\endgroup\$ – Jake quin Aug 21 '19 at 20:07
  • \$\begingroup\$ The sensor is powered from the same powerbank. For now i have only this esp8266 nodemcu v1 and i tried only deep sleep mode, the most usefull \$\endgroup\$ – Robz Aug 21 '19 at 20:17
  • \$\begingroup\$ You could use a 555 timer IC to turn on a relay/transistor after it recieve a signal. Its called 555 timer bistable state, connect the trigger pin to the sensor and the reset pin to your esp, Just trigger the reset pin after your ESP is done with its job \$\endgroup\$ – Jake quin Aug 21 '19 at 20:23
  • \$\begingroup\$ Thank you, i think that I'll do this 👍 \$\endgroup\$ – Robz Aug 22 '19 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.