Digital output from PIR sensor does not go to low!

Hello people!

I am trying to read a digital input from a PIR sensor! I am using a Honeywell IS2535 PIR Radar and I have soldered two wires where its Led were.

When the radar senses something, the Led would light up. Removing the Led, I can now read through my multi meter up to 3.6 volts. The thing is that when I hook the two soldered wires to the digital input, there is a weird behaviour which I cannot really comprehend.

Here is a Video of the serial plotter. For the last two seconds in the video, the radar has correctly sensed me moving

The code I am using is quite simple really,

/*
  DigitalReadSerial

  Reads a digital input on pin 2, prints the result to the Serial Monitor. 

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/DigitalReadSerial
*/

// digital pin 2 has a pushbutton attached to it. Give it a name:
int pushButton = 2;

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(230400);
  // make the pushbutton's pin an input:
  pinMode(pushButton, INPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input pin:
  int buttonState = digitalRead(pushButton);
  // print out the state of the button:
  Serial.println(buttonState);
  delay(2);        // delay in between reads for stability
}

Would you please offer some advice? It feels like when the radar is idle, there is no 0 volts but something else.

Please halp! :slightly_frowning_face:

kaptsea:
The thing is that when I hook the two soldered wires to the digital input, there is a weird behaviour which I cannot really comprehend.

One can presume you mean one of the wires is to Arduino GND and the other to a digital pin. Can you make a drawing of your circuit? And, 'weird behaviour' is pretty subjective. Hard to know exactly what's meant by that.

dougp:
One can presume you mean one of the wires is to Arduino GND and the other to a digital pin. Can you make a drawing of your circuit?

Yes, exactly!

Here is the Drawing.

The radar in this schematic outputs anything between 0 and 3,1 volts, so the DC supply might not be ideal for a representation. I do not own an oscilloscope so I can only measure it with my multi meter.

dougp:
And, 'weird behaviour' is pretty subjective. Hard to know exactly what's meant by that.

Well, the input to the Pin 2 seems to oscillate uncontrollably. I read somewhere that people call this bouncing?

I thought of something and would really appreciate an opinion; a Schmitt trigger, hardware or software implemented. Adding hysteresis to the input could potentially solve the oscillations.

Thoughts?

Hi,
Why aren't you using the relay output?

Can you post a picture of the terminal strip in the PIR please?
Tom.. :slight_smile:

TomGeorge:
Can you post a picture of the terminal strip in the PIR please?
Tom.. :slight_smile:

Sure thing! Here it is

Please attach images to your post, or even better, inline them, rather than linking to some external resource that may be gone at any time. Like this:

kaptsea:


wvmarle:
Please attach images to your post, or even better, inline them, rather than linking to some external resource that may be gone at any time. Like this:

I am not sure how, but will! Cheers!

Ok, so I took the advice and I am now passing 5V through the PIR relay to the digital input pin 2 of the arduino. I noticed that when the output is high, the signal is oscillating with a constant f.

I have uploaded the new schematic and also another video with the input of the serial plotter!

Youtube Mirror of the Video

the PIR has a a VERY active motion sensor.
it also has circuitry to eleminate any bounce
and it has a delay so that one 'event' will not clear in a second, but rather stay for some set duration. this is a hysteresis in the output. it also prevents the relay from chattering.

the installation and setup instructions you got with the device should detail the timings.

in the alarm world, the only reason there is a 0 voltage is if the wires are cut, there is an alarm or if there is loss of power.

voltage present means the wires are connected and the devices are alive.

as for a scope, there are software programs that use your PC's serial port, or USB port for a slow, but useful scope program.

Hi,
Can you post a circuit diagram of how you are connected to the PIR, how you are powering it and how you are powering the Arduino.
Label pins and components, please do not use the simulator CAD. that you posted your last "circuit".

What model Arduino are you using?

Thanks.. Tom.. :slight_smile:

Hi,
That trace looks like you have your digital input open circuit.

Also why are you serial monitoring at that speed (230400), use 9600, its fast enough for this exercise.

I have run your code here, and connecting pin2 to gnd gives a 0, and 5V gives a 1.

Thanks.. Tom.. :slight_smile:

First of all, Thank you all for your help and advice, such a nice community!

I scrapped the old connections, but it was like this : Circuit

I have uploaded the new one. The PIR's relay is Normally Closed so when the PIR senses me it opens the circuit. The thin is that I still see oscillations when the input is low on the arduino

Hi,
Try this circuit and change the pinMode to

pinMode(pushButton,INPUT_PULLUP);


Tom... :slight_smile:

TomGeorge:
Hi,
Try this circuit and change the pinMode to

pinMode(pushButton,INPUT_PULLUP);


Tom... :slight_smile:

Woohoo! It seems to work, but I am not entirely sure as to why... What did the PULLUP do?

A pullup resistor makes sure the pin is pulled to HIGH level (Vcc) when there's nothing else connected.

PIRs are typically open drain, so they only pull a pin low by shorting it to GND.

So now: when the PIR is "HIGH" (i.e. not activated) the resistor makes sure your pin is always at +5V. When it's active, it shorts the pin to GND (and indeed a small current will flow through the resistor).

This way your pin is always in a defined state, never floating. Switches are connected the same way.