weird values with pir on xbee

Hi,

I'm getting started with arduino and I have a problem/question.

I have this simple setup to read values from a pir. (found somewhere on the internet and customised a little).
Basically, the pir is connected to 5V with the red wire, connected to ground with the brown, and I'm reading the values from the black wire, using a pull-up (or down?) 10K resistor.

I'm reading values from the pir and output them to the serial monitor. (arduino is connected to pc with usb-cable)
Besides some false positives and false negatives, this works fine: I'm getting mostly high values (1023 or 1022) when no movement, low values (circa 17 up to about 22) when movement.

But I want to transmit these values over xbee.
I put an xbee-shield on the arduino, and connect everything to the same pins (A2 to read the values, GND, 5V, and pin 11 and 12 going to a red and green LED)

In this setup, I'm getting weird values from the pir: instead of getting low and high, I'm getting values of about 400-500.
whether there is movement or not, the values dont change.

I have measured the voltage with a dmm. Without the xbee, the 5V outputs 5V, but on the Xbee, the 5V only gives 4.5V. Maybe this has something to do with it?
I have tried to use Vin (according to the datasheet, the pir voltage has to be between 5V and 12V), but when powered by usb, also vin gives less than 5V.

I tried to power it with a 12 V battery, and then it vin gives about 7 V. But then I can't read the values with the serial monitor.
Since this is all new to me, I'm trying to build it step by step. That is why I want to get correct values on my serial monitor before trying to actually send them over xbee.

I have been searching the internet and forums for a while, but could not find a solution.
I hope this is enough information :slight_smile:
So my question is: What can I do to make it work (which is: sending pir values over xbee, the goal is some kind of intrusion detection system)

Arduino:
uno

Pir:
http://www.pieterfloris.nl/shop/product.php?id_product=33

Xbee:
http://www.pieterfloris.nl/shop/product.php?id_product=262

Many thanks in advance,
Tim

motion_detection_2.ino (2.88 KB)