Post topics, source code that relate to the Arduino Platform

User avatar
By torntrousers
#25163 That is interesting. I've wanted to do the same - having a PIR sensor trigger an ESP to wake up, but i didn't find a good way to get it working very well.

I've not tried this yet but i wondered if you could connect the PIR output to the ESP CH_PD so when the PIR is triggered it sets CH_PD high so the ESP starts up and then have the ESP set a spare GPIO high and have that also connected to CH_PD so the ESP stays running after the PIR resets, and then when the ESP has done its stuff set the GPIO low and so the ESP powers down.
Last edited by torntrousers on Thu Aug 06, 2015 4:13 am, edited 1 time in total.
User avatar
By tytower
#25166
certeza wrote:By the way, the main reason I use the attiny is to prevent resetting the esp-12 when it has not finished its task. That can happen if you connect the pir directly to the esp-12.


Still interested in your code . Do you have any drafts yet?

Lets put the pir on say GPIO4 . The deepSleep is on GPIO16 -XPD - Now PIR goes high -Program is watching on 4 , sees high so triggers 16 -that brings it out of deepSleep() - finds and connects wifi says movement detected - checks if 4 high -if not goes back to sleep-if 4 high waits a time checks again -sends another message and loops until 4 low .

So what tasks are you referring to ?
User avatar
By tytower
#25167
torntrousers wrote:I've not tried this yet but i wondered if you could connect the PIR output to the ESP CH_PD so when the PIR is triggered it sets CH_PD high so the ESP starts up and then have the ESP set a spare GPIO high and have that also connected to CH_PD so the ESP stays running after the PIR resets, and then when the ESP has done its stuff set the GPIO low and so the ESP powers down.
its worth trying. I think you should set CH_PD low again you mean.
User avatar
By Barnabybear
#25168
torntrousers wrote:That is interesting. I've wanted to do the same - having a PIR sensor trigger an ESP to wake up, but i didn't find a way to get it working very well.

I've not tried this yet but i wondered if you could connect the PIR output to the ESP CH_PD so when the PIR is triggered it sets CH_PD high so the ESP starts up and then have the ESP set a spare GPIO high and have that also connected to CH_PD so the ESP stays running after the PIR resets, and then when the ESP has done its stuff set the GPIO low and so the ESP powers down.

If you connected the PIR and an GPIO via a diodes to CH_PD you could pull it independantly of the other:
PIR output -->|- ESP CH_PD
GPIO -->|- ESP CH_PD

The PIR should be able to pull CH_PD high to wake the ESP, then the GPIO should be able to take over holding CH_PD high even if the PIR returns to low untill the task is completed.
We proberbly need some resistors (deffinatly if using a -01); a pull down on CH_PD and a something on the GPIO to hold it high for boot up, not enough to deliver a logic 1 after it has passed through the diode during sleep.
I have parts to test if someone wants to wip up abit of code (I haven't used sleep functions yet). Should be able to post a diagram later.
Last edited by Barnabybear on Thu Aug 06, 2015 7:31 am, edited 1 time in total.