Sunday 6 April 2014

SE-10 Passive InfraRed sensor (PIR) & the RaspberryPi

The SE-10 is a commonly available PIR sensor produced by Hanse Electronics.

Having bought one of these from HobbyTronics, I tried to use it on a Raspberry Pi, but ran into problems.

A search of the net just reveals confusing and often contradictory information, so I did some investigation of my own.

The Manufacturers Data

Hanse Electronics is a company based in South Korea that specialise in cctv equipment. Their data sheet covers some detailed information, but (as is often the case) does not include some of the basics, such as the supply voltage range, output driver capabilities & so on.

The word on the street is that this device can be supplied from 5-12V and the output is open-collector. But my initial tests with the unit connected to 5 Volts via a RaspberryPi resulted in random triggering, often several times per minute.

A Closer Look

I decided to hook the unit up to a 9 Volt battery and use a simple program running on a RaspberryPi to check its operation.

Normally the output is high and switches low when it detects. In my circuit the open collector output (AL or alarm) is fed via a 4.7kOhm resistor from 3.3Volt RaspberryPi supply. This is because the GPIO operates at 3.3Volts, and I thought a current of around 0.5 to 1mA would be appropriate.

Under these conditions I found the unit was quite stable, and only triggered when I moved myself or my hand in front of the sensor.

On the PIR board near the power terminations there is a voltage regulator (IC2 - bottom left corner).

A quick check with a multimeter shows that the input voltage on my PIR is regulated down to 5 Volts. Elsewhere on the internet, others have said the voltage is 3.3 Volts.

It is quite possible that the circuit details vary (remember, the manufacturer only specifies the supply voltage, not the circuit voltage), so its worth checking your own PIR. It is also possible that Hanse Electronics simply source these boards from various manufacturers, and the circuit design varies within the wider specification.

In order to get this working with the RaspberryPi in a real application, I either need an additional power supply (say 9 to 12V) or I need it running from 5 Volts.

Get Out The Soldering Iron

By fitting a link across the regulator (input to output) I should be able to run directly from 5 Volts.

If you try this, don't allow the link to touch the centre pin of IC2 which is connected to 0 Volts.

Although this works, I get lots of false triggers with this arrangement. I think this is due to spikes/noise on the RaspberryPi 5 Volt supply.

I found that adding a capacitor across the 5 Volt supply to the PIR improved the situation considerably.

I started with a value of 0.1uF, and then ran a test with a 4.7uF capacitor. On balance I'd say the 4.7uF gave better results.

However, these tests were conducted with fairly long leads. It remains to be seen whether this simple fix will be so affective when built into a box with shorter connections.

My Application

I would like to try to use this in a robin box, in much the same way that I've used an led/photo-transisitor in BirdBoxPiCam2014. In this case it will be powered from 12V and used to switch the system on when a bird enters the nest.

But at this stage I have no idea whether this PIR can be triggered, close-up by a 12 gram garden bird!


  1. Did you ever get this circuit working? I'd like to use this same system, but instead to power a dash cam on and off

  2. Yes, it is more stable (i.e. less susceptible to electrical noise) if run from 12Volts:

    It detects large warm objects (like people) much easier than tiny ones (like garden birds).

    I guess you would need a circuit to switch power to the webcam (like a Mosfet) and to keep the power on for a minimum amount of time (e.g. our dash-cam takes a few seconds to boot up and start recording).