-->
Page 1 of 1

Nodemcu and PIR Sensor False Triggering

PostPosted: Fri Feb 23, 2018 11:52 pm
by Fed Co
Hi everyone!
I am trying to connect a PIR sensor to my Nodemcu board. However, the serial monitor only displays ones. I have literally tried everything, also level converters to go from the 3.3v of the board to the 5v of the sensor. Nothing, still always ones.
here is the code:

void setup()
{Serial.begin(9600);
pinMode(5, INPUT);


}


void loop()
{

Serial.println(digitalRead(5));
delay(1000);

}
Do you have any suggestions?
Thank you a lot

Re: Nodemcu and PIR Sensor False Triggering

PostPosted: Mon Feb 26, 2018 5:36 pm
by Barnabybear
Hi, I’m not sure which PIR you are using but from my experience the radio from the ESP sets off the PIR. You can wrap the PIR circuit board both sides with an insulating material, just exposing a round hole of the lens on the front; I’ve used normal electrical insulation tape. Then cover this with aluminium baking foil and make sure a ground lead is pressed up against it. Finally ensure the ESP is positioned behind the PIR in such a way that that the PIR doesn’t block the radio signal but it can’t enter the uncovered lens area. It should be fine then.

Re: Nodemcu and PIR Sensor False Triggering

PostPosted: Tue Feb 27, 2018 3:37 am
by gdsports
NodeMCU boards have misleading labels. The pin labelled D5 is not Arduino pin 5.

https://raw.githubusercontent.com/nodemcu/nodemcu-devkit-v1.0/master/Documents/NODEMCU_DEVKIT_V1.0_PINMAP.png