RaspberryPiWorkshopEinsteiger: Unterschied zwischen den Versionen
Jochen (Diskussion | Beiträge) Die Seite wurde neu angelegt: „Ein paar Informationen zum Raspberry Pi Workshop für Einsteiger. Node-RED Flow Lichtschalter: <pre> [{"id":"48a6df2a.b7592","type":"function","z":"cce966b8.…“ |
Jochen (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
(9 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
Ergänzende Informationen zum Raspberry Pi Workshop für Einsteiger. | |||
== Links == | |||
https://www.raspberrypi.org/help/noobs-setup/ | |||
https://downloads.raspberrypi.org/NOOBS_latest | |||
https://wiki.ubuntuusers.de/verzeichnisstruktur | |||
http://gitlab.brokenpipe.de/jochen/webiopi.git | |||
http://wiringpi.com/the-gpio-utility | |||
http://wiringpi.com/pins/ | |||
http://nodered.org/ | |||
http://flows.nodered.org/ | |||
Diese Links dienen nur als Beispiel im Workshop und sind nicht, oder nur über ipv6 zu erreichen: | |||
http://jochenpi.fablab-rothenburg.de:8000/ | |||
http://raspberrypi.local:8000/ | |||
http://jochenpi.fablab-rothenburg.de:1880/ | |||
http://raspberrypi.local:1880/ | |||
Android APP für http requests: | |||
https://play.google.com/store/apps/details?id=ch.rmy.android.http_shortcuts | |||
Raspberry Pi 2 Gehäuse, das auch Platz bietet für 2 x 2 Relais: | |||
https://drive.google.com/file/d/0B8lf2p3s7l3kTXoyWmpYWE5wYkE/view?usp=sharing | |||
== Ein paar Fragen == | |||
http://goo.gl/forms/1Ze5ClOjBj | |||
Antworten Auswertung: | |||
{| {{table}} | |||
| align="center" style="background:#f0f0f0;"|'''Zeitstempel''' | |||
| align="center" style="background:#f0f0f0;"|'''Installation''' | |||
| align="center" style="background:#f0f0f0;"|'''Bootvorgang''' | |||
| align="center" style="background:#f0f0f0;"|'''Linux steuern''' | |||
| align="center" style="background:#f0f0f0;"|'''Linux Dateisystem''' | |||
| align="center" style="background:#f0f0f0;"|'''System/Dienste (Start)''' | |||
| align="center" style="background:#f0f0f0;"|'''Software Installation''' | |||
| align="center" style="background:#f0f0f0;"|'''Wichtige Tools''' | |||
| align="center" style="background:#f0f0f0;"|'''GPIO Hardware''' | |||
| align="center" style="background:#f0f0f0;"|'''Andere Anschlüsse''' | |||
| align="center" style="background:#f0f0f0;"|'''GPIO Kommando''' | |||
| align="center" style="background:#f0f0f0;"|'''Webiopi''' | |||
| align="center" style="background:#f0f0f0;"|'''Node-RED''' | |||
| align="center" style="background:#f0f0f0;"|'''War der Workshop unterhaltsam''' | |||
| align="center" style="background:#f0f0f0;"|'''War der Workshop informativ''' | |||
| align="center" style="background:#f0f0f0;"|'''Würdest du den Workshop jemanden empfehlen''' | |||
| align="center" style="background:#f0f0f0;"|'''Bietet das Lab eine gute Workshopatmosphäre''' | |||
|- | |||
| 23.01.2016 17:43:23||5||4||4||3||3||4||3||4||2||4||5||3||5||5||5||5 | |||
|- | |||
| 23.01.2016 17:44:01||4||4||4||4||4||4||4||4||3||4||4||3||5||5||5||5 | |||
|- | |||
| 23.01.2016 17:44:23||5||5||5||5||5||5||5||5||5||5||4||2||5||5||5||5 | |||
|- | |||
| 23.01.2016 17:45:14||5||4||5||5||5||4||4||3||3||4||5||4||4||4||4||3 | |||
|- | |||
| 23.01.2016 17:46:05||4||4||3||2||4||3||3||4||3||3||4||3||4||4||4||3 | |||
|- | |||
| 23.01.2016 17:46:19||4||3||2||4||3||4||4||3||1||4||4||2||5||3||5||4 | |||
|- | |||
| Durchschnitt||4,5||4,0||3,8||3,8||4,0||4,0||3,8||3,8||2,8||4,0||4,3||2,8||4,7||4,3||4,7||4,2 | |||
|} | |||
== Node-RED Flow == | |||
Erstes Primitiv: | |||
<pre> | |||
[{"id":"8686fcf5.7979","type":"inject","z":"cce966b8.331698","name":"","topic":"","payload":"0","payloadType":"string","repeat":"","crontab":"","once":false,"x":277,"y":720,"wires":[["9488a3d8.6b776"]]},{"id":"9488a3d8.6b776","type":"rpi-gpio out","z":"cce966b8.331698","name":"","pin":"3","set":true,"level":"0","out":"out","x":495,"y":719,"wires":[]},{"id":"27724249.d88dbe","type":"inject","z":"cce966b8.331698","name":"","topic":"","payload":"1","payloadType":"string","repeat":"","crontab":"","once":false,"x":276,"y":669,"wires":[["9488a3d8.6b776"]]}] | |||
</pre> | |||
Lichtschalter: | Lichtschalter: | ||
<pre> | <pre> | ||
[{"id":"48a6df2a.b7592","type":"function","z":"cce966b8.331698","name":"Lichtschalter","func":"context.state = context.state || 0;\n//nachricht = Object.create(msg);\n//schalter = Object.create(msg);\n\nif (msg.payload.state) {\n if (msg.payload.state == \"toggle\") {\n (context.state == 0) ? context.state = 1 : context.state = 0;\n }\n if (msg.payload.state == \"on\") {\n context.state = 0;\n }\n if (msg.payload.state == \"off\") {\n context.state = 1;\n }\n}\nif (context.state == 0)\n msg.text = \"on\"\nif (context.state == 1)\n msg.text = \"off\"\nmsg.payload = context.state;\n\nreturn msg;","outputs":"1","noerr":0,"x":439,"y":441,"wires":[["a0846992.5f7b98","d861ecaa.279e1","24b4eac5.db4b16"]]}] | [{"id":"48a6df2a.b7592","type":"function","z":"cce966b8.331698","name":"Lichtschalter","func":"context.state = context.state || 0;\n//nachricht = Object.create(msg);\n//schalter = Object.create(msg);\n\nif (msg.payload.state) {\n if (msg.payload.state == \"toggle\") {\n (context.state == 0) ? context.state = 1 : context.state = 0;\n }\n if (msg.payload.state == \"on\") {\n context.state = 0;\n }\n if (msg.payload.state == \"off\") {\n context.state = 1;\n }\n}\nif (context.state == 0)\n msg.text = \"on\"\nif (context.state == 1)\n msg.text = \"off\"\nmsg.payload = context.state;\n\nreturn msg;","outputs":"1","noerr":0,"x":439,"y":441,"wires":[["a0846992.5f7b98","d861ecaa.279e1","24b4eac5.db4b16"]]}] | ||
</pre> | |||
Schalterstatus: | |||
<pre> | |||
[{"id":"24b4eac5.db4b16","type":"function","z":"cce966b8.331698","name":"Schalterstatus","func":"if (msg.payload == 1) \n msg.payload = \"off\"\nif (msg.payload == 0) \n msg.payload = \"on\"\n\nreturn msg;","outputs":"1","noerr":0,"x":582,"y":520,"wires":[["12dc73d7.ed238c","2981565a.d67eaa"]]}] | |||
</pre> | |||
Lichttemplate: | |||
<pre> | |||
[{"id":"12dc73d7.ed238c","type":"template","z":"cce966b8.331698","name":"Lichttemplate","field":"","template":"Licht: {{ payload }}","x":748,"y":520,"wires":[["69b1560f.964ea8"]]}] | |||
</pre> | |||
Komplett incl. Debug: | |||
<pre> | |||
[{"id":"d861ecaa.279e1","type":"rpi-gpio out","z":"cce966b8.331698","name":"Plasmakugel","pin":"5","set":"","level":"0","out":"out","x":647,"y":289,"wires":[]},{"id":"b80debab.47f218","type":"debug","z":"cce966b8.331698","name":"","active":false,"x":437,"y":399,"wires":[]},{"id":"df1d5ea3.20e2a","type":"inject","z":"cce966b8.331698","name":"","topic":"","payload":"toggle","payloadType":"string","repeat":"","crontab":"","once":false,"x":115,"y":514,"wires":[["25878f59.da787","156d0c37.ea92f4"]]},{"id":"ff1805cc.00e7f8","type":"http in","z":"cce966b8.331698","name":"","url":"/licht","method":"get","swaggerDoc":"","x":104,"y":390,"wires":[["163cbf6c.e9c341"]]},{"id":"69b1560f.964ea8","type":"http response","z":"cce966b8.331698","name":"","x":883,"y":518,"wires":[]},{"id":"163cbf6c.e9c341","type":"node-red-contrib-httpauth","z":"cce966b8.331698","name":"","file":"","cred":"","authType":"Basic","realm":"licht","username":"jochen","password":"foobar","hashed":false,"x":264,"y":357,"wires":[["b80debab.47f218","48a6df2a.b7592"]]},{"id":"12dc73d7.ed238c","type":"template","z":"cce966b8.331698","name":"Lichttemplate","field":"","template":"Licht: {{ payload }}","x":748,"y":520,"wires":[["69b1560f.964ea8"]]},{"id":"48a6df2a.b7592","type":"function","z":"cce966b8.331698","name":"Lichtschalter","func":"context.state = context.state || 0;\n//nachricht = Object.create(msg);\n//schalter = Object.create(msg);\n\nif (msg.payload.state) {\n if (msg.payload.state == \"toggle\") {\n (context.state == 0) ? context.state = 1 : context.state = 0;\n }\n if (msg.payload.state == \"on\") {\n context.state = 0;\n }\n if (msg.payload.state == \"off\") {\n context.state = 1;\n }\n}\nif (context.state == 0)\n msg.text = \"on\"\nif (context.state == 1)\n msg.text = \"off\"\nmsg.payload = context.state;\n\nreturn msg;","outputs":"1","noerr":0,"x":439,"y":441,"wires":[["a0846992.5f7b98","d861ecaa.279e1","24b4eac5.db4b16"]]},{"id":"a0846992.5f7b98","type":"debug","z":"cce966b8.331698","name":"","active":false,"console":"false","complete":"payload","x":645,"y":251,"wires":[]},{"id":"24b4eac5.db4b16","type":"function","z":"cce966b8.331698","name":"Schalterstatus","func":"if (msg.payload == 1) \n msg.payload = \"off\"\nif (msg.payload == 0) \n msg.payload = \"on\"\n\nreturn msg;","outputs":"1","noerr":0,"x":582,"y":520,"wires":[["12dc73d7.ed238c","2981565a.d67eaa"]]},{"id":"2981565a.d67eaa","type":"debug","z":"cce966b8.331698","name":"","active":false,"console":"false","complete":"payload","x":747,"y":481,"wires":[]},{"id":"25878f59.da787","type":"debug","z":"cce966b8.331698","name":"","active":false,"x":266,"y":519,"wires":[]},{"id":"156d0c37.ea92f4","type":"function","z":"cce966b8.331698","name":"payload convert","func":"msg.payload = { \"state\": msg.payload };\nreturn msg;","outputs":1,"noerr":0,"x":273,"y":481,"wires":[["48a6df2a.b7592"]]}] | |||
</pre> | </pre> |
Aktuelle Version vom 8. April 2016, 14:52 Uhr
Ergänzende Informationen zum Raspberry Pi Workshop für Einsteiger.
Links
https://www.raspberrypi.org/help/noobs-setup/
https://downloads.raspberrypi.org/NOOBS_latest
https://wiki.ubuntuusers.de/verzeichnisstruktur
http://gitlab.brokenpipe.de/jochen/webiopi.git
http://wiringpi.com/the-gpio-utility
Diese Links dienen nur als Beispiel im Workshop und sind nicht, oder nur über ipv6 zu erreichen:
http://jochenpi.fablab-rothenburg.de:8000/
http://raspberrypi.local:8000/
http://jochenpi.fablab-rothenburg.de:1880/
http://raspberrypi.local:1880/
Android APP für http requests:
https://play.google.com/store/apps/details?id=ch.rmy.android.http_shortcuts
Raspberry Pi 2 Gehäuse, das auch Platz bietet für 2 x 2 Relais:
https://drive.google.com/file/d/0B8lf2p3s7l3kTXoyWmpYWE5wYkE/view?usp=sharing
Ein paar Fragen
http://goo.gl/forms/1Ze5ClOjBj
Antworten Auswertung:
Zeitstempel | Installation | Bootvorgang | Linux steuern | Linux Dateisystem | System/Dienste (Start) | Software Installation | Wichtige Tools | GPIO Hardware | Andere Anschlüsse | GPIO Kommando | Webiopi | Node-RED | War der Workshop unterhaltsam | War der Workshop informativ | Würdest du den Workshop jemanden empfehlen | Bietet das Lab eine gute Workshopatmosphäre |
23.01.2016 17:43:23 | 5 | 4 | 4 | 3 | 3 | 4 | 3 | 4 | 2 | 4 | 5 | 3 | 5 | 5 | 5 | 5 |
23.01.2016 17:44:01 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 3 | 4 | 4 | 3 | 5 | 5 | 5 | 5 |
23.01.2016 17:44:23 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 4 | 2 | 5 | 5 | 5 | 5 |
23.01.2016 17:45:14 | 5 | 4 | 5 | 5 | 5 | 4 | 4 | 3 | 3 | 4 | 5 | 4 | 4 | 4 | 4 | 3 |
23.01.2016 17:46:05 | 4 | 4 | 3 | 2 | 4 | 3 | 3 | 4 | 3 | 3 | 4 | 3 | 4 | 4 | 4 | 3 |
23.01.2016 17:46:19 | 4 | 3 | 2 | 4 | 3 | 4 | 4 | 3 | 1 | 4 | 4 | 2 | 5 | 3 | 5 | 4 |
Durchschnitt | 4,5 | 4,0 | 3,8 | 3,8 | 4,0 | 4,0 | 3,8 | 3,8 | 2,8 | 4,0 | 4,3 | 2,8 | 4,7 | 4,3 | 4,7 | 4,2 |
Node-RED Flow
Erstes Primitiv:
[{"id":"8686fcf5.7979","type":"inject","z":"cce966b8.331698","name":"","topic":"","payload":"0","payloadType":"string","repeat":"","crontab":"","once":false,"x":277,"y":720,"wires":[["9488a3d8.6b776"]]},{"id":"9488a3d8.6b776","type":"rpi-gpio out","z":"cce966b8.331698","name":"","pin":"3","set":true,"level":"0","out":"out","x":495,"y":719,"wires":[]},{"id":"27724249.d88dbe","type":"inject","z":"cce966b8.331698","name":"","topic":"","payload":"1","payloadType":"string","repeat":"","crontab":"","once":false,"x":276,"y":669,"wires":[["9488a3d8.6b776"]]}]
Lichtschalter:
[{"id":"48a6df2a.b7592","type":"function","z":"cce966b8.331698","name":"Lichtschalter","func":"context.state = context.state || 0;\n//nachricht = Object.create(msg);\n//schalter = Object.create(msg);\n\nif (msg.payload.state) {\n if (msg.payload.state == \"toggle\") {\n (context.state == 0) ? context.state = 1 : context.state = 0;\n }\n if (msg.payload.state == \"on\") {\n context.state = 0;\n }\n if (msg.payload.state == \"off\") {\n context.state = 1;\n }\n}\nif (context.state == 0)\n msg.text = \"on\"\nif (context.state == 1)\n msg.text = \"off\"\nmsg.payload = context.state;\n\nreturn msg;","outputs":"1","noerr":0,"x":439,"y":441,"wires":[["a0846992.5f7b98","d861ecaa.279e1","24b4eac5.db4b16"]]}]
Schalterstatus:
[{"id":"24b4eac5.db4b16","type":"function","z":"cce966b8.331698","name":"Schalterstatus","func":"if (msg.payload == 1) \n msg.payload = \"off\"\nif (msg.payload == 0) \n msg.payload = \"on\"\n\nreturn msg;","outputs":"1","noerr":0,"x":582,"y":520,"wires":[["12dc73d7.ed238c","2981565a.d67eaa"]]}]
Lichttemplate:
[{"id":"12dc73d7.ed238c","type":"template","z":"cce966b8.331698","name":"Lichttemplate","field":"","template":"Licht: {{ payload }}","x":748,"y":520,"wires":[["69b1560f.964ea8"]]}]
Komplett incl. Debug:
[{"id":"d861ecaa.279e1","type":"rpi-gpio out","z":"cce966b8.331698","name":"Plasmakugel","pin":"5","set":"","level":"0","out":"out","x":647,"y":289,"wires":[]},{"id":"b80debab.47f218","type":"debug","z":"cce966b8.331698","name":"","active":false,"x":437,"y":399,"wires":[]},{"id":"df1d5ea3.20e2a","type":"inject","z":"cce966b8.331698","name":"","topic":"","payload":"toggle","payloadType":"string","repeat":"","crontab":"","once":false,"x":115,"y":514,"wires":[["25878f59.da787","156d0c37.ea92f4"]]},{"id":"ff1805cc.00e7f8","type":"http in","z":"cce966b8.331698","name":"","url":"/licht","method":"get","swaggerDoc":"","x":104,"y":390,"wires":[["163cbf6c.e9c341"]]},{"id":"69b1560f.964ea8","type":"http response","z":"cce966b8.331698","name":"","x":883,"y":518,"wires":[]},{"id":"163cbf6c.e9c341","type":"node-red-contrib-httpauth","z":"cce966b8.331698","name":"","file":"","cred":"","authType":"Basic","realm":"licht","username":"jochen","password":"foobar","hashed":false,"x":264,"y":357,"wires":[["b80debab.47f218","48a6df2a.b7592"]]},{"id":"12dc73d7.ed238c","type":"template","z":"cce966b8.331698","name":"Lichttemplate","field":"","template":"Licht: {{ payload }}","x":748,"y":520,"wires":[["69b1560f.964ea8"]]},{"id":"48a6df2a.b7592","type":"function","z":"cce966b8.331698","name":"Lichtschalter","func":"context.state = context.state || 0;\n//nachricht = Object.create(msg);\n//schalter = Object.create(msg);\n\nif (msg.payload.state) {\n if (msg.payload.state == \"toggle\") {\n (context.state == 0) ? context.state = 1 : context.state = 0;\n }\n if (msg.payload.state == \"on\") {\n context.state = 0;\n }\n if (msg.payload.state == \"off\") {\n context.state = 1;\n }\n}\nif (context.state == 0)\n msg.text = \"on\"\nif (context.state == 1)\n msg.text = \"off\"\nmsg.payload = context.state;\n\nreturn msg;","outputs":"1","noerr":0,"x":439,"y":441,"wires":[["a0846992.5f7b98","d861ecaa.279e1","24b4eac5.db4b16"]]},{"id":"a0846992.5f7b98","type":"debug","z":"cce966b8.331698","name":"","active":false,"console":"false","complete":"payload","x":645,"y":251,"wires":[]},{"id":"24b4eac5.db4b16","type":"function","z":"cce966b8.331698","name":"Schalterstatus","func":"if (msg.payload == 1) \n msg.payload = \"off\"\nif (msg.payload == 0) \n msg.payload = \"on\"\n\nreturn msg;","outputs":"1","noerr":0,"x":582,"y":520,"wires":[["12dc73d7.ed238c","2981565a.d67eaa"]]},{"id":"2981565a.d67eaa","type":"debug","z":"cce966b8.331698","name":"","active":false,"console":"false","complete":"payload","x":747,"y":481,"wires":[]},{"id":"25878f59.da787","type":"debug","z":"cce966b8.331698","name":"","active":false,"x":266,"y":519,"wires":[]},{"id":"156d0c37.ea92f4","type":"function","z":"cce966b8.331698","name":"payload convert","func":"msg.payload = { \"state\": msg.payload };\nreturn msg;","outputs":1,"noerr":0,"x":273,"y":481,"wires":[["48a6df2a.b7592"]]}]