💬 Motion Sensor
-
Since it is a powered node, you don't need to put it to sleep. As for the pir you can do as you like: check pin status during loop, use an attach interrupt function on pin change, etc
@gohan ok thank you for answering. if i do this:
void loop() { // Read digital motion value bool tripped = digitalRead(DIGITAL_INPUT_SENSOR)== HIGH; Serial.println("coucou"); Serial.println(tripped); send(msg.set(tripped?"1":"0")); // Send tripped value to gw } // Sleep until interrupt comes in on motion sensor. Send update every two minute. //sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); }the node never stop to send message to the gateway. i would like to send something only if D1 goes to high, is that possible ? (i'm starting combinating exemple and i want to understand what i do now!!)
-
@siod The HC-SR501 actually runs on 3.3VDC but has a 5VDC-3.3VDC regulator on board.
There are several ways to bypass this regulator, but the easiest is to connect your 3.3VDC supply to pin 3 of JP3 (the one marked "H").
You must make sure that your 3.3VDC supply is very stable, otherwise you will get false activations.
See:
https://randomnerdtutorials.com/modifying-cheap-pir-motion-sensor-to-work-at-3-3v/
https://www.youtube.com/watch?v=5jhTQAV-hg0
https://www.mpja.com/download/31227sc.pdf -
So i was testing out the motionsensor sketch and it kept giving me "!TSF:MSG:SEND" after the initial 0 had been sent.
Finding no answers on here i tested loads of things until i tried a delay after the sleep command.
Running fine now with a 5msec delay.Just thought i would share.
-
I connected a 12v DC input and no matter what I do the output always shows 12V. It never goes to a "low" 0V output. From what I read these can use between a 5v and 20v input so I'm assuming a 12v input should not be an issue and still produce a High when triggered and Low 0V when not triggered output. What am I doing wrong?
-
So i was testing out the motionsensor sketch and it kept giving me "!TSF:MSG:SEND" after the initial 0 had been sent.
Finding no answers on here i tested loads of things until i tried a delay after the sleep command.
Running fine now with a 5msec delay.Just thought i would share.
@patrikr76 thank you so much. I had the same issue with my motion sensor and spent 2 days pulling my hair out)