Pir sensor, problem

Hi,

I’m trying to connect a pir sensor from adafruit to my electric imp but can’t get it to work. When measuring the data-pin when not connected to the imp the pir works fine and show 3.3 V. However, when it’s connected to the pin1 on the electric imp the voltage is only 0.8 V when there is movement. The code is really simple:

`motion <- hardware.pin1;

imp.setpowersave(false);

function motionSensorChanged()
{
local state = motion.read()
if (state == 1){
server.log(“Garage movement start”);
}
else{
server.log(“Garage movement stop”);
}
}

motion.configure(DIGITAL_IN_PULLUP, motionSensorChanged);`

Anyone have an idea how come?

Best regards, Hannes

I have used a PIR into a digital input with no problem, though I can’t remember which pin. Does your pin1 normally work okay, or might it be an Aria with a bad pin1 connection? What voltage does the input pin show with a voltmeter when not connected to the PIR? (clearly it should be pulled up to the 3.3v rail). I suggest trying with a different pin.

I think you want to use DIGITAL_IN as your config, though someone else should verify that. You shouldn’t have any problem reading a PIR.

Hi,

Thank you for your answers. I changed to pin2 and then it worked fine.

Is it most likely the breakout-board or the imp itself which is broken?

I’ve resoldered the pin 1 without success.

Best regards, Hannes

I have seen tales of pin1 connection problems on some Arias due to the SD socket. The imp itself should be fine.

Okey, I will try with another breakout-board then. I bought this one from adafruit.