Arduino Asked on January 2, 2022
I have a PIR sensor which I use to detect the motion and turn ON and OFF the lights on the basis of it.
I have PIR connected with NodeMCU (ESP8266) based board. I find that sometimes it trigger false positive value. Even when there is no motion. As per my understanding I think any of the following reasons can be there:
I am considering these scenarios correct? If yes then how can I prevent from them?
I tried to put it in a box and make it tightly pack. but still its false trigger. I checked even with multiple sensors and have same problem.
Any suggestions to protect this? I also check people put capacitor to smooth it. And put some resistance on Vin.
My Vin of PIR is connected to 5v and OUTPUT pin to D2.
For reference I am having this code for checking.
#define SIGNAL_PIN D2
void setup()
{
Serial.begin(115200);
pinMode(SIGNAL_PIN, INPUT_PULLUP);
// digitalWrite (SIGNAL_PIN, LOW);
}
void loop() {
static uint32_t lastSeenHigh = millis();
static bool pirState = false;
Serial.println(digitalRead(SIGNAL_PIN));
// If it's active then record that fact along with the time
if (digitalRead(SIGNAL_PIN) == HIGH) {
lastSeenHigh = millis();
pirState = true;
} else {
if ((millis() - lastSeenHigh) > 10000) {
pirState = false;
}
}
if (pirState == true) {
Serial.println("Pir Is active");
}
//
if (pirState == false) {
Serial.println("PIR sensor inactive");
}
delay(1000);
}
I glued some aluminum foil onto a piece of a cereal box and folded it around the PIR sensor. Works like a charm!
Answered by Arthur Smaal on January 2, 2022
I was also going through the same issue. But finally, the issue got resolved.
The issue is the PIR sensor that comes with ESP8266 can work with 3.3V as well as 5V. By default, the wiring is connected to the 5V which may work fine for the Arduino device but not for ESP8266.
I just removed the red cable (power cable) from the connector and connected to the other side where you can see H. That side also there are 3 pins. Remove the jumper completely and connect to the first PIN from top.
Just make sure you leave the GND and OUTPUT as it is, but only the RED wire will be connected to the first pin on the other side of the PIR sensor.
Answered by Minhaj Mohammad on January 2, 2022
I had the same issue. I tried various solutions on the net. Finally i solved my issue like this.
Actually, I'm applied that solution -> https://www.youtube.com/watch?v=2HbbQIqJHoE
Answered by Emrah AKBIYIK on January 2, 2022
I had the same issue. PIRs have very sensitive circuitry and can be triggered by the WiFi signal from the ESP8266. The answer is to move them apart and with some decoupling of the power supply lines you should see much better performance. My PIR and ESP are now a couple of metres apart and I use shielded cable to connect them together.
Answered by Bra1n on January 2, 2022
2 Asked on December 21, 2020 by renangm
0 Asked on December 21, 2020 by amy
1 Asked on December 19, 2020
1 Asked on December 19, 2020 by victorpacheco3107
1 Asked on December 13, 2020 by johnny-derpp
1 Asked on December 4, 2020 by michael-stachowsky
1 Asked on December 1, 2020 by shubham-bajaj
3 Asked on December 1, 2020 by user63158
1 Asked on November 30, 2020 by britton-kerin
1 Asked on November 10, 2020 by don
1 Asked on November 6, 2020 by omar_hussein
2 Asked on October 28, 2020 by thunder-dornhofer
1 Asked on October 20, 2020 by chetan-niradwar
1 Asked on September 15, 2020 by jabawokjayuk
Get help from others!
Recent Answers
Recent Questions
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP