A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By Fed Co
#74161 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
User avatar
By Barnabybear
#74213 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.