Problem With PIR Motion Sensor - RNT Lab
Maybe your like
- Skip to main content
- Skip to primary sidebar
Hello. I am using “Build a Home Automation System for $100” and have some problem to get motion sensor work.I dont get any motion detected, the sensor is tested Ok with Arduino. The sensor is connected to 5v and all other as described in course.I can arm and disarm, all works fine except motion detecting.Any ideas?
Question Tags: PIR ESP12E 9 Answers 0 Vote Up Vote DownHello Peter, thank you for taking the time to post your question.
- Can you tell me which ESP8266 development board version are you using?
- How are you powering your ESP8266 board?
- Which GPIO are you connecting the PIR motion sensor to?
- Which PIR motion sensor are you using? HC-SR501 or AM312?
Note: The sensor should only be triggered while armed. Thanks!
0 Vote Up Vote DownHello Rui I am using a ESP12-E NodeMCU 1.0. Powered via USB Connected to GPIO D2 (pin 4) PIR is HC-SR501 I have tries two different ESP12-E with same result.
0 Vote Up Vote DownHello Peter, these errors are quite frustrating. It looks like you’re doing everything right.
I would probably test just one more thing: I would power the ESP with an external power supply that can supply more current…
To be honest I don’t know what’s missing to make it work based on those details. If the ESP8266 was not being armed, if the DHT sensor was crashing for example, or if the PIR sensor didn’t work with an Arduino that would be easier to understand…
0 Vote Up Vote DownHi Rui Ok, I will test with external power this weekend and be back with results.
0 Vote Up Vote DownYou can use a power adapter from a smartphone (it needs to supply 5V). Then, you need to arm the sensor through the Node-RED Dashboard. Also double-check the PIR sensor is well connected. Let me know your results!
0 Vote Up Vote DownHello I have tried with a power adapter 5v 2.0A and it is the same problem. I can arm and disarm from Node-RED, led lights up when armed. But no motion detected. DHT sensor works fine also. I have loaded original mqtt_esp8266_final from github and tried with same result. Is there a sketch or way to test only PIR with esp8266?
0 Vote Up Vote DownHi Peter, The PIR should work with only 5V and ground all by itself. To test, you could add about a 330 ohm resistor to a LED and put it on the output of the PIR to ground. It doesn’t matter which lead the resistor is attached to, but the anode of the LED should connect to the output pin on the PIR, (longer lead of a new LED is the anode), and the cathode toward ground. Then apply power and wait about 60 seconds before providing the motion. If it doesn’t work, try turning the LED around just to be sure. Connecting it backwards won’t hurt it, but connecting it without a 220-100 ohm resistor will hurt either the LED, or the PIR. It also may only light dimly, depending on the PIR’s output current abilities.
0 Vote Up Vote DownHi David Ok.I can test it that way, but PIR works fine when connected to a Arduino Uno.But when connected with ESP-12E it´s not detect any motion.
0 Vote Up Vote DownTo be honest, I don’t know what it can be. Did you try with multiple PIR motion sensors (just to double-check)? Can you try with a different GPIO in your ESP-12E? For example:
- GPIO 5 (D1)
- GPIO 14 (D5)
- GPIO 12 (D6)
Can you test the following code? Just change the variable inputPin with different GPIO pins to test (in that example, it’s using GPIO 14 (D5): http://bit.ly/2X1EugS
Note: please try with GPIO 4 (D2) too.
It should read LOW, then when motion is detected it should read HIGH.
Regards, Rui
Primary Sidebar
Login to Ask or Answer Questions
This Forum is private and it’s only available for members enrolled in our Courses. Login »
Latest Course Updates
- [eBook Updated] Smart Home with Raspberry Pi, ESP32, and ESP8266 Version 1.7 November 28, 2025
- [eBook Updated] Smart Home with Raspberry Pi, ESP32, and ESP8266 V1.6 September 9, 2025
You must be logged in to view this content.
Insert/edit link CloseEnter the destination URL
URL Link Text Open link in a new tabOr link to existing content
Search No search term specified. Showing recent items. Search or use up and down arrow keys to select an item. CancelTag » Arduino Pir Motion Sensor Not Working
-
Troubleshooting PIR Sensor And Sensitivity Adjustment
-
PIR Sensor Not Working - Programming Questions - Arduino Forum
-
PIR Motion Sensor Code Not Working Well - Arduino Forum
-
HC-SR501 PIR Motion Sensor Does NOT Work As Expected! How To ...
-
How To Fix PIR Motion Detector Sensor - YouTube
-
Testing Motion Pir Sensor Is Working Or Not - YouTube
-
Arduino - PIR Sensor Doesn't Work Properly - Stack Overflow
-
Arduino With PIR Motion Sensor - Random Nerd Tutorials
-
PIR Motion Sensor With Arduino In Tinkercad - Instructables
-
Testing A PIR | PIR Motion Sensor - Adafruit Learning System
-
Pir-sensor · GitHub Topics
-
How HC-SR501 PIR Sensor Works & How To Interface It With Arduino
-
PIR Motion Sensor Connected To Arduino Sometimes Does Not Detect ...
-
Motion Sensor | Arduino Tutorial