I’m doing a digitalRead on the Arduino pin but it’s jumping back and forth between 0 and 1 when the motion detector is completely shielded from any possible motion. My expectation was that the the alarm pin would go low when there is motion and otherwise stay at 5V.
The alarm pin (black) is an open collector meaning you will need a pull up resistor on the alarm pin. The open drain setup allows multiple motion sensors to be connected on a single input pin. If any of the motion sensors go off, the input pin will be pulled low.
Sorry for the duplicate post. I originally posted this in the AVR section.
I noticed that however the Sparkfun site says it works at 5V:
This unit works great from 5 to 12V (datasheet shows 12V). You can also install a jumper wire past the 5V regulator on board to make this unit work at 3.3V. Sensor uses 1.6mA@3.3V.
Check the voltage output of the on-board regulator when you have the board powered by 5V. The voltage should be 3.3V (according to what the product description states). Maybe the VR on the board you have is slightly out of spec and it’s unable to maintain 3.3V when only powered by 5V (voltage drop-out). It would be best to check the voltage using a scope if you have it as it may be cycling rapidly.
Of course you could just try powering the board from more than 5V to rule this out.
Thanks for the suggestion. I’ll give that a try. My primary concern was if I had correctly wired the circuit for an open collector. No one has mentioned any issues so I assume it is correct.
rappa:
Thanks for the suggestion. I’ll give that a try. My primary concern was if I had correctly wired the circuit for an open collector. No one has mentioned any issues so I assume it is correct.
Your drawing matches the description on the web site and the 4.7k pull-up seems reasonable. If you power the unit with more than 5v, you will want to connect the pull-up resistor to Arduino and not the power line of the sensor.
Why they chose brown for GND and not black is beyond me – but go with the documentation.
As it turns out, the motion detector doesn’t work at 5V or at least mine doesn’t. I hooked it up to 9V and it works great. It does take about 25 seconds to warmup, during which time it gives sporadic readings.