The security camera pole

06-10-2022
One button live stream.

I want to be able to see the image of the security camera in the garden at the touch of a nice button. And with a second press of the button, the image should go out again.

An additional HDMI monitor continuously shows the stream from the security camera. The monitor is controlled via a Raspberry Pi. The Pi runs VLC which shows the stream.

The button is on GPIO pin 4 and is read continuously with a simple shell script. If you press it, the monitor will turn off (it will automatically go into sleep mode) and if you press it again, the monitor will turn on again.

VLC itself is started when the Pi boots because I have a vlc.desktop in /home/pi/.config/autostart (create folder). file:
#Save under /home/pi/.config/autostart (create directory)
[Desktop Entry]
Type=Application
Name=VLC
Exec=vlc --fullscreen rtsp://camerauser:password@192.168.0.91:80/videoSub
The button is a triangular arcade button illuminated by an LED. The LED I believe is a 12V LED (it has a built-in series resistor) but it is powered from the Pi's 3.3V line so it becomes less bright. The security camera pole is in the Movie Cave and it is often dark there.

The script that reads the button and turns the monitor off and on on command:
#!/bin/bash

echo "4" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio4/direction

status=0 # Off

while :
do
button=$(cat /sys/class/gpio/gpio4/value)
if [[ $button == 0 ]] && [[ $status == 0 ]]; then
# Pressed and off: turn on
status=1
echo "Turn on"
xset s 180
xset s off
xdotool mouse move 100 100
sleep 0.6
elif [[ $button == 0 ]] && [[ $status == 1 ]]; then
# Button is pressed and screen is on: turn off
state=0
echo "Turn off"
xset s on
xset s 1
xset s blank
xdotool mouse move 120 100
sleep 0.6
fi

#echo $button
sleep 0.1
done
The script is executed by means of a desktop file that is also included in the above autostart folder is started automatically:
[Desktop Entry]
Type=Application
Name=Button
Exec=/home/pi/cam.sh
Download
OpenScad file to 3d print the pile.
This housing is suitable for a Raspberry Pi 3 Model A.

Appliances

All my appliances are working installations.

If you want to replicate an appliance and you need help, feel free to contact me.

View 32 appliances
 
×
×