-->
Page 2 of 19

Re: PIR sensor - wake and sleep using CH_PD & thingspeak upd

PostPosted: Wed Aug 12, 2015 6:00 am
by Michaelo
Barnabybear wrote:I'm sure thats a good idear but way beyond my skills at this time.

Check out my git (https://github.com/NeuronTech/wifisensors), it has all the code necessary for a local or remote server...

There's more to do but as it stands, it's perfect for testing... also, here's a related post... viewtopic.php?f=11&t=521&start=5#p24830

In relation to fet gate capacitance, that's the main issue but with a little imagination I can over come that... a little experimenting this weekend I think...
Mike

PS, it's a little bit of work setting up a local server but once done, you have it for years... If you go that direction I can assist...

Re: PIR sensor - wake and sleep using CH_PD & thingspeak upd

PostPosted: Wed Aug 12, 2015 12:36 pm
by Barnabybear
Michaelo wrote:Looks interesting... have you determined the set up time for the ESP?

Barnabybear wrote:I don't have a scope so the only way I could think of to test the actual setup time would be to setup a second ESP with a loop taking a GPIO high for slowly increasing perids of time & using that as a trigger untill a stable value is reached.

Tested replacing the PIR with a second ESP, GPIO 2 was used in place of the PIR output running the code below:
Code: Select all//THIS CODE IS NOT PART OF THE SUBJECT OF THIS THREAD
//USED ONLY TO TEST THE DURATION OF TRIGGER NEEDED
//RUN ON A SECOND ESP TO TRIGGER THE FIRST IN PLACE OF A PIR

int GPIO2 = 2;
int val = 350;

void setup() {
  pinMode(2, OUTPUT);
  digitalWrite(GPIO2, LOW);
   
  Serial.begin(115200);
  Serial.println();
  Serial.println("setup");
}
void loop() {
  digitalWrite(GPIO2, HIGH);
  delay(val);
  digitalWrite(GPIO2, LOW);
  Serial.println(val);
  delay(60000);
  Serial.println();
}

The requirement was to boot and take GPIO 0 high to hold CH_PD keeping the ESP active when the trigger was removed.

Results:
300ms triggered exactly 50% of the time & was every other attempt (strange needs more investigation), (50 tests).
350ms triggered 100% of the time, (200 tests).
325ms triggered 100% of the time, (200 tests).
From this testing on 2 prototype boards with lots of link wires for connections & measurement, it looks like 325ms is the shortest reliable trigger pulse needed to boot & hold CH_CP high on an ESP running the code listed in the first post of this thread.

This could possably be speeded up as
Code: Select allWiFiClient client;  // starts a WiFi client.

& some other lines of code run before
Code: Select alldigitalWrite(holdPin, HIGH);  // sets GPIO 0 to high (this holds CH_PD high even if the PIR output goes low)

I'm not sure how long it takes to set up a WiFi client. If needed, rearranging the code could save this time, weather it makes a significant difference is to be proven.

Re: PIR sensor - wake and sleep using CH_PD & thingspeak upd

PostPosted: Tue Aug 18, 2015 1:17 am
by noelportugal
I was inspired by your project and used a button. So far so good!

Check more details here: viewtopic.php?f=11&t=4593

Image

Re: PIR sensor - wake and sleep using CH_PD & thingspeak upd

PostPosted: Wed Aug 19, 2015 4:12 pm
by tytower
If anyone is as confused by the above post as I was its a way to send a post/get statement at the push of a button to IFTTT or any other site whenever you want to. Follow the links above for the needed code to do so.
Don't know why he chose to post it in this thread . Just couldn't wait I suppose.

Further in it says
The key features are:
Energy efficient
OTA wifi configuration
IFTTT, but in reality you can GET/POST to anywhere