You are on page 1of 2

Working perfect with PI 3! Thanks a lot!

I combined it with a bash script and a PIR


sensor, so the screen auto turns-off after 10min without any movement around...

Thanks to https://www.raspberrypi.org/forums/viewtopic.php?t=147311

PIR: https://www.amazon.com/HC-SR501-Sensor-Module-Pyroelectric-
Infrared/dp/B007XQRKD4

1. Install light-locker:

sudo apt-get install light-locker

2. Setup light-locker

sudo nano /boot/config.txt

# uncomment to put the monitor into power saving mode (DPMS)

hdmi_blanking=1

sudo nano /etc/xdg/autostart/light-locker.desktop

Exec=light-locker --lock-after-screensaver=0 --no-lock-on-suspend --no-late-locking

3. Adjust autostart script

sudo nano ~/.config/lxsession/LXDE-pi/autostart

@lxpanel --profile LXDE-pi

@pcmanfm --desktop --profile LXDE-pi

@xscreensaver -no-splash

@point-rpi

@xset s 0 0

@xset s noblank

@xset s noexpose

@xset dpms 0 0 300

@bash /etc/pir_wake.ch &

@chromium-browser --noerrdialogs --incognito --kiosk http://dakboard.com/?


p=xxxxxxxxxxxxxxxxxxxxxxxxx

4. create bash script

sudo nano /etc/pir_wake.ch

#!/bin/bash

echo "4" > /sys/class/gpio/export

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


while [ true ] ; do

state=$(cat /sys/class/gpio/gpio4/value)

if [ "$state" = "1" ]; then

light-locker-command -p

echo "Wake"

sleep 280

fi

sleep 0.3

done

5. Make script executable:

sudo chmod +x /etc/pir_wake.ch

6. Connect PIR sensor:

PIR Vcc: to any +5V pin on PI header

PIR GND: to any GND pin on PI header

PIR OUT: to GPIO4 pin on PI header

7. Reboot

sudo reboot

You might also like