I am building a smart door at home. One of the features I am using is a PIR to detect if someone is staying behind the door. Unfortunately due to the facilities constraints the PIR and its cables will have be exposed.

I would like to make sure that I build a circuit resistant against malicious use. For example, someone connects the PIR wires into a 220V power plug.

Below you can see how I place all the components in my circuit:

enter image description here

I made sure to use some diodes and a resistor to ensure my Raspberry Pi doesn't get damaged. Is it enough to protect my system?

  • \$\begingroup\$ Is this the right schematic? There's no diode on the signal line. \$\endgroup\$
    – Chuck
    Oct 19, 2015 at 2:00

3 Answers 3


Aside: One of your diodes is the wrong way round.

Short answer - no. Even with a resistor in series, a Rasperry Pi isn't going to be happy with 220V AC shoved into one of the GPIO pins. And even with the diodes, the power supply pins are nowhere near protected.

I can't help thinking, though, that the easiest way to defeat your circuit is just to cut the wires. It doesn't appear to have any way to detect that.


Use optcoulpers to connect the sensor. These will give you several kilovolts of electrical isolation.

  1. Disguise the cable

Are you allowed to use paint? If so, then get some flat under-rug loudspeaker cables or flexible Kynar copper-foil cables, glue them down, and cover with (color matched) paint. You might even try using #35 magnet wire for connections, especially if you can find a crack to run it along. If paranoid give this treatment to the entire cable, but if not, only cover the part in direct view of any perp.

Once for an 'illegal' power cable (in undergrad college, prank,) I ran 10ft of thin zipcord along a crack in a concrete wall, glued down with epoxy, covered up with gray epoxy, and while still sticky, patted down with dirt from the steam tunnel floor so it was totally invisible.

  1. Disguise the sensor

White polyethelene plastic is transparent to thermal-IR. It can't be immensely thick, but a PE sheet < 1mm should be transparent. The "look" of an IR sensor may be recognizable to observers, but you can hide it behind a white flat plate or even behind a layer or two of white trash bag.

Or, even experiment with the actual stuff: IR-sensor white PE lens material. Here's one source: Surplus Shed L3480 Remove the existing lens from a commercial sensor and install you own. This lets you sculpt the angular view, making it sensitive only to the regions you want.


Or, much cheaper, block unwanted portions of the beam path by covering parts of the sensor-dome with opaque tape or thick black paint. Consider moving the sensor farther away from the target (so less visible,) and then black out the dome except for a small hole aimed at the target region.

These sensors are often piezo-capacitor types and so only put out AC. A wide view may "ignore" the slow changes from hot objects entering the field of view. So, thermal-IR sensors often break up their white fresnel polyethelene lens into many segments to give a line of focal spots at the sensor plane. That way a moving object makes a row of fast brief pulses in proportion to speed, rather than a single wide slow pulse which may not trigger. But, if you only want to cover an extremely narrow field, this slotted-fresnel trick isn't necessary: just mask down the field of view so any target passing through it gives a large brief pulse. You can even make it sensitive to directional motion: a very wide view in one axis and a very narrow view in the other will only give a large pulse if the target passes perpendicular to the slot-like view field.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.