ESP8266, Deep Sleep...
 
Notifications
Clear all

ESP8266, Deep Sleep mode test, wake up with a PIR motion detector

Page 3 / 4

c6c7458b487be6281e355e2b4c64bd50?s=80&d=mm&r=g
Posts: 1
 MT
Guest
(@MT)
Joined: 9 months ago

Hi!

I tried your example, but it didn't work for me, I used same components as you except the PIR, which i use is a HC-SR501 and the transistor from that i tried with bc337 and bc547 too. Is it possible i use PIR or transistor or both? Or something else the problem.

Reply
1 Reply
christophe
Admin
(@chris)
Joined: 5 years ago

Member
Posts: 253

Hello, did you check your HC-SR501 alone ?

Reply
d8e501b76d5a91fe7118626a28dd351b?s=80&d=mm&r=g
Posts: 2
 Laurens
Guest
(@Laurens)
Joined: 8 months ago

First of all thanks for this great review. After i changed the posetive and negative around on the NPN ( i used a 2n2222) it works like a charm.

For my specific project (bathroom) i want to also add a humidity sensor. My hope is that i can still use a timer aswell. So i want the ESP to wake up every minute to check and log the humidity to MQTT (to switch on the ventilation if needed) but if somebody walks in I want the ESP to wake up immediate so i can turn on tights. Obviously it would not be very usefull if it takes (in worst case a minute) for the lights to switch on.

With the help of this articel I've got the PIR to work. But as soon as the timer goes off it's keeps resetting itself like every 100ms. I've tried different things which capacitors an extra NPN and even diodes but i can't find a way to make both the timer and the PIR work as a trigger at the same time. Any help would be greatly appriciated.

Reply
3 Replies
christophe
Admin
(@chris)
Joined: 5 years ago

Member
Posts: 253

Hello Laurens. Have you considered switching to an esp32? I wonder if there is not a problem with the power supply of your ESP8266 which causes it to restart every 100ms (it is a hypothesis). It's much easier to manage multiple sleep / wake sources with the ESP32

Reply
d8e501b76d5a91fe7118626a28dd351b?s=80&d=mm&r=g
 Laurens
Guest
(@Laurens)
Joined: 8 months ago

Posts: 2

Hi Christophe,

I haven't considered ESP32 so thanks for the tip. Might be a nice POC for the future.

Currently I'm working on a solution by using an ATTiny13 (It's still in breadboard status).

I connected the PIR to the ATTiny and programmed an interupt on it so it will wake up when the PIR goes HIGH. I also programmed a watchdog so if the PIR doesn't switch on it still wakes every 2 minutes. When the ATTiny wakes up i send a High to a transitor which connects the ESP to GND and so it I’ll boot. From the ATTiny I also forward the digitalRead of the PIR to a GPIO on the ESP so the ESP knows if the ATTiny woke up because of the timer or the PIR. First step of the ESP is to put a Signal high back to the ATTiny so the ATTiny knows the ESP Is a wake. Then it reads the PIR value and the DHT Sensor puts it on a MQTT Topic. Last step before the ESP.deepSleep command is to put the signal to Attiny to LOW so the Attiny Knows it can go to sleep as well.

The Attiny is an extra component but it does solve the issue for about 40 cents and the circuit consumes less power because the ESP is not sleeping but completely turned off. THe Attiny only consumes about 5 uF while sleeping so that's kind of the best you can get i think.

Extra bonus is that my family thinks I'm some kind of wizard when they see me program such a small chip :).

Regards,

Laurens.

Reply
christophe
Admin
(@chris)
Joined: 5 years ago

Member
Posts: 253

Hello Laurens. That's a great idea ! the best of both worlds 🙂 It's true that the ATTiny is great, it's a shame that there is only Espressif which offers economical WiFi connectivity. The other MCU makers have passed by.

Reply
f57b3f77f79b0064e183de31f89216e5?s=80&d=mm&r=g
Posts: 1
 John Belding
Guest
(@John Belding)
Joined: 8 months ago

Thanks for the project description and example.
I am attempting to use the RTC DS3231 in my project and haven't found a way to wire it, but maybe a mod of your schematic will allow it to work.
If I hook the SQW output to the Base of the transistor(where you have the pir signal) will that trigger a wakeup when the alarm goes off?
Any help is appreciated.

John B.

Reply
6be3d77e6abd8f4bf60ff7e0a0fe709b?s=80&d=mm&r=g
Posts: 1
 Uwe Zimmermann
Guest
(@Uwe Zimmermann)
Joined: 6 months ago

The Fritzing view of the breadboard with the capacitor not only gets the pinout of the transistor wrong, the resistor is also shown at the wrong leg of the electrolytic capacitor.

Reply
1 Reply
christophe
Admin
(@chris)
Joined: 5 years ago

Member
Posts: 253

Oops, thanks you Uwe!

Reply
64b4ad48c403b9a1de336168ba07dc42?s=80&d=mm&r=g
Posts: 1
 Fixingthingsguy
Guest
(@Fixingthingsguy)
Joined: 4 months ago

Hello Christophe, Joining late here so a bit off.
=Does the Fritzing reflect Uwe's comment.
Thanks for a well written article. I realize this kind of attempt
is a bit tenuous with all sorts of software that is interfaced that
we only see the api's for.
Regards
SB

Reply
Page 3 / 4
Share:
Join Us!
Recent Posts
Last Articles
DIY Projects
DIY Projects