{"id":1497,"date":"2018-01-09T20:37:56","date_gmt":"2018-01-09T18:37:56","guid":{"rendered":"https:\/\/kthemall.wordpress.com\/?p=1497"},"modified":"2021-01-26T07:18:21","modified_gmt":"2021-01-26T07:18:21","slug":"raspberry-pi-als-katzenfoen","status":"publish","type":"post","link":"https:\/\/kthemall.at\/?p=1497","title":{"rendered":"Raspberry PI als &quot;KatzenF\u00f6n&quot; [update 12.01.2018 &#8211; 26.01.2021]"},"content":{"rendered":"\n<p>mein n\u00e4chstes 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\u00fcre rausgehe und so ein bescheuerter kater hat wieder an meiner t\u00fcre markiert. nicht falsch verstehen, jedem sein revier, aber hier wohnen wir und nicht er. ich markiere ja auch nicht an seiner haust\u00fcr, da h\u00e4tte der nachbar bestimmt keine freude mit mir. daher folgende idee.<br>sobald sich ab einer gewissen uhrzeit drau\u00dfen was vor meiner haust\u00fcre bewegt gebe ich einen kurzen luftdruck ab. wie passiert das ganze.<br>&nbsp;<br>na ja so halt: ein pi \u00fcberwacht 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 \u00f6ffnet an dem ein kompressor h\u00e4ngt.<br>zutaten dazu: 1x raspi, 1x pir motion sensor, 1x magnetventil, 1x kompressor mit druckluftschlauch *G* und nat\u00fcrlich etwas code ups, nicht zu vergessen 1x zeitschaltur analog (der einfachheit halber).<br>kosten belaufen sich auf etwa 60 \u20ac. den kompressor mal nicht mitgerechnet, der hat ja auch noch andere aufgaben \ud83d\ude42<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-3 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img data-id=\"1499\" class=\"wp-image-1499\"\/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img data-id=\"1498\" class=\"wp-image-1498\"\/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img data-id=\"1501\" class=\"wp-image-1501\"\/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img data-id=\"1500\" class=\"wp-image-1500\"\/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p><br>beim magnetventil bin ich noch am gr\u00fcbeln, am besten aber wohl 220v denn power hab ich schon vorort \ud83d\ude42<br>der pi wurde konfiguriert auf autologon mit dem pi user:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Auto Login Setup (optional)<\/h2>\n\n\n\n<p>The first step is to enable the Pi to login automatically without requiring any user intervention. This step is optional.<br>At the command prompt or in a terminal window&nbsp;type :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo raspi-config<\/pre>\n\n\n\n<p>followed by Enter.<br>Select \u201cBoot Options\u201d then \u201cDesktop\/CLI\u201d then \u201cConsole Autologin\u201d<br>damit das script dann auch automatisch nach einem stromausfall oder beim aktivieren durch die zeitschaltuhr auch wieder l\u00e4uft:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Auto-run Script Setup<\/h2>\n\n\n\n<p>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 :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo nano \/etc\/profile<\/pre>\n\n\n\n<p>Scroll to the bottom and add the following line :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo python \/home\/pi\/myscript.py<\/pre>\n\n\n\n<p>where \u201c\/home\/pi\/myscript.py\u201d is the path to your script.<br>Type \u201cCtrl+X\u201d to exit, then \u201cY\u201d to save followed by \u201cEnter\u201d twice.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A Script Without End<\/h2>\n\n\n\n<p>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 :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo python \/home\/pi\/myscript.py &amp;<\/pre>\n\n\n\n<p>This will allow the script to run in the background but you will not see any text output from it.<br>&nbsp;<br>das hab ich \u00fcbrigens alles hier&nbsp;<a href=\"https:\/\/www.raspberrypi-spy.co.uk\/2015\/02\/how-to-autorun-a-python-script-on-raspberry-pi-boot\/\">PI_file_autostart<\/a>&nbsp;gestohlen<br>&nbsp;<br>l\u00e4uft jetzt mal ohne probleme mit der LED (<a href=\"https:\/\/youtu.be\/SaZQrZY2I7U\">Katzenf\u00f6n<\/a>), aber ob da jetzt ne LED oder irgendwas anderes angesteuert wird ist mal vorerst zweitrangig.<br>[update 12.01.2018]<br>weiter geht es mit der teilebestellung:<br><a href=\"https:\/\/www.amazon.de\/gp\/product\/B012CN952Q\/ref=oh_aui_detailpage_o01_s00?ie=UTF8&amp;psc=1\">Magnetventil<\/a><br><a href=\"https:\/\/www.amazon.de\/gp\/product\/B01G1ENSTS\/ref=oh_aui_detailpage_o02_s00?ie=UTF8&amp;psc=11\">Relais<\/a><br><a href=\"https:\/\/de.aliexpress.com\/item\/1-St-ck-Wasserdichte-Kunststoffgeh-use-Box-Elektronische-Projekt-Instrumentenkoffer-Elektrische-Projekt-Box-Au-en-Junction\/32844457360.html?spm=a2g0s.9042311.0.0.AhskYJ\">Kunststoffbox<\/a><br>&nbsp;<br>&nbsp;[26.01.2021]<br>&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/kthemall.at\/wp-content\/uploads\/2018\/01\/presence_26_01_2021_07_59.mp4\"><\/video><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>mein n\u00e4chstes 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\u00fcre rausgehe und so &hellip;<\/p>\n","protected":false},"author":1,"featured_media":1502,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_jetpack_memberships_contains_paid_content":false},"categories":[2],"tags":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/kthemall.at\/index.php?rest_route=\/wp\/v2\/posts\/1497"}],"collection":[{"href":"https:\/\/kthemall.at\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kthemall.at\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kthemall.at\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kthemall.at\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1497"}],"version-history":[{"count":3,"href":"https:\/\/kthemall.at\/index.php?rest_route=\/wp\/v2\/posts\/1497\/revisions"}],"predecessor-version":[{"id":2637,"href":"https:\/\/kthemall.at\/index.php?rest_route=\/wp\/v2\/posts\/1497\/revisions\/2637"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kthemall.at\/index.php?rest_route=\/"}],"wp:attachment":[{"href":"https:\/\/kthemall.at\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kthemall.at\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kthemall.at\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}