mein nächstes Projekt mit dem Raspi soll ein Katzenschreck werden. warum mach ich sowas eigentlich? ganz einfach ich hasse den geruch von katzenpisse wenn ich morgens um 6 uhr bei der haustüre rausgehe und so ein bescheuerter kater hat wieder an meiner türe markiert. nicht falsch verstehen, jedem sein revier, aber hier wohnen wir und nicht er. ich markiere ja auch nicht an seiner haustür, da hätte der nachbar bestimmt keine freude mit mir. daher folgende idee.
sobald sich ab einer gewissen uhrzeit draußen was vor meiner haustüre bewegt gebe ich einen kurzen luftdruck ab. wie passiert das ganze.
na ja so halt: ein pi überwacht mit motion sensor das gefechtsfeld. sobald da drinnen bewegung ist, gibt er ein high-signal ab und mit diesem wird ein relais gesteuert, welches ein magnetventil öffnet an dem ein kompressor hängt.
zutaten dazu: 1x raspi, 1x pir motion sensor, 1x magnetventil, 1x kompressor mit druckluftschlauch *G* und natürlich etwas code ups, nicht zu vergessen 1x zeitschaltur analog (der einfachheit halber).
kosten belaufen sich auf etwa 60 €. den kompressor mal nicht mitgerechnet, der hat ja auch noch andere aufgaben 🙂
beim magnetventil bin ich noch am grübeln, am besten aber wohl 220v denn power hab ich schon vorort 🙂
der pi wurde konfiguriert auf autologon mit dem pi user:
Auto Login Setup (optional)
The first step is to enable the Pi to login automatically without requiring any user intervention. This step is optional.
At the command prompt or in a terminal window type :
sudo raspi-config
followed by Enter.
Select “Boot Options” then “Desktop/CLI” then “Console Autologin”
damit das script dann auch automatisch nach einem stromausfall oder beim aktivieren durch die zeitschaltuhr auch wieder läuft:
Auto-run Script Setup
Now we need to tell the operating system to run the script for the Pi user. In the command prompt or in a terminal window type :
sudo nano /etc/profile
Scroll to the bottom and add the following line :
sudo python /home/pi/myscript.py
where “/home/pi/myscript.py” is the path to your script.
Type “Ctrl+X” to exit, then “Y” to save followed by “Enter” twice.
A Script Without End
You will only be returned to the command line when your script is complete. If your script contains an endless loop then you may want to use this line in the profile file instead :
sudo python /home/pi/myscript.py &
This will allow the script to run in the background but you will not see any text output from it.
das hab ich übrigens alles hier PI_file_autostart gestohlen
läuft jetzt mal ohne probleme mit der LED (Katzenfön), aber ob da jetzt ne LED oder irgendwas anderes angesteuert wird ist mal vorerst zweitrangig.
[update 12.01.2018]
weiter geht es mit der teilebestellung:
Magnetventil
Relais
Kunststoffbox
[26.01.2021]