I am trying to set up my PIR Motion Sensor with arduino uno. I am following the post on bildr (http://bildr.org/2011/06/pir_arduino/) but came across some issues. When I had a 10k resistor coming from the signal pin to the 5v my readings were very erratic, saying there was motion and no motion regardless of whether I provided motion or not. So I removed the resistor and have the signal pin going straight into digital pin 2 on the arduino. This fixed the issue and now the sensor appears to be working fine. I don’t understand why this fixed the problem or why the resistor is needed. Everywhere I look says that you need to have a pull up resistor. Can anyone please explain to me why a pull up resistor is needed and how taking it out fixed my problem? The code that I used is the same as what is proved in the link I posted above. Thanks!
Not all PIR sensors have the same output or even output type. A pull-up resistor is needed when the output type is what’s known as a “open collector” (or open drain). These type outputs use a transistor (or a FET) to produce a short circuit to ground, generally when the PIR detects something. When there’s no detection, then the transistor is an open circuit and that leaves the Arduino input pin floating. When floating the pin may be a HIGH or a LOW or vary from one to the other. The pull-up resistor puts the pin in a definite HIGH situation and so prevents false detections.
But some PIRs don’t have an OC/OD type output. The drive the signal to be a high voltage, or ground, and quite often it’s a high voltage when detecting and a ground when not (the opposite of the above). Sometimes that high voltage is greater than the allowed input voltage of an Arduino, so you need to be careful which PIR you use.
As to why a 10k resistor caused your setup problems … I can’t say w/o more info on your PIR. It would seem unlikely that such a “weak” pull-up should cause a problem but … :think: