Automatic Door for the Cat – with HC-SR501 motion detector, without arduino


Even complex project can be done without an arduino. I built an automated door with two HC-SR501 infrared motion detectors.

I use a linear actuator to open the door. This one is from Aliexpress, like everything else, and has limit switches. That means when it reaches either end, it just stops.
In addition, two infrared motion detectors are used, which do not even cost one euro in China. The links are in the description.
We also need a relay with a double changeover switch, an NPN transistor, a diode, and a resistor.
Because the output signal of the motion detectors is not powerful enough to switch the relay, we use the transistor as an amplifier.
The diode is required to protect the rest of the electronics from voltage spikes produced by the relay.
On the switching side, the relay is also connected with plus and minus. In idle mode, the voltage is connected to the last two pins.
If one of the motion detectors detects a movement and outputs a voltage, the relay switches on and the voltage is applied to the other output pins. If we connect them crossed with the last pins, the polarity is reversed and the linear motor runs in the other direction until it stops at the end stop.
If the signal disappears after the time set on the motion detector, the relay switches back, the polarity of the motor is reversed again and it returns to the initial position.

I decided assemble the electronics with floating wiring on the relay. The transistor is connected between the plus pin of the coil and the common terminal (COM) of the switching part, which later becomes the minus terminal. The two pins of the coil are connected to the diode, and one end is connected directly to the switching part, where the positive pole of the 12v power supply is later connected.
With cut off wire from the diode I build half of the cross connection. For the other half I use a cable.
This is where the power supply is connected, and the motor is connected to the last pins.
I decided to use two resistors, one for each motion detector. The value doesn’t really matter, mine are 510 ohms.
And now it’s starting to get messy. I isolate the cable from the power supply unit in the middle to branch off the power supply for the motion detectors.
If the motion detector now detects a movement, it outputs +5v at the output, which switches the relay via the transistor and reverses the polarity of the motor. It extends until it just stops at the end.
If now after some time the motion detector switches off again, the time can be set at one of the two small potentiometers, the relay switches the polarity back again, and the linear motor moves in again until it stops in the end position. And the electronics are actually finished.

At the door I remove the lock, because if that snaps in, all the rest won’t work. A replacement is designed in Sketchup and printed with my 3d printer.
In the same way I also produce the mountings for the linear motor.

The STL files

I screw the mounting for the motor onto one end of an about 20cm long piece of strip and a hinge to the other end.
I add a strong pot magnet to the other side of the strip. The free end of the hinge is screwed to the door, next to it a perforated plate as a counterpart to the magnet.
The other end of the motor is mounted with a wooden plate to the door frame.
Thanks to the hinge and magnet, the door can now also be opened manually.
Now the electronics have to be installed on site. By the way, under the translucent cap of the motion detector you can read how the pins are connected.
This may look like a total mess, that’s because it is. Maybe I should have built a circuit board after all.
In principle, it works, but the motion detector outside the pantry interprets the closing door as movement and reopens it directly. So it gets “blinkers” to limit the angle of vision.
And now the cat can leave whenever he likes.