Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
| raspberry_pi:hardware [2017/10/05 17:38] – [Fingerabdrucksensor] gerald | raspberry_pi:hardware [2024/02/29 13:36] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
|---|---|---|---|
| Zeile 36: | Zeile 36: | ||
| [[http:// | [[http:// | ||
| + | |||
| + | {{ : | ||
| ==== GPIO auslesen ==== | ==== GPIO auslesen ==== | ||
| + | |||
| + | [[https:// | ||
| === Transistoren vorschalten | === Transistoren vorschalten | ||
| Zeile 65: | Zeile 69: | ||
| Gefunden bei http:// | Gefunden bei http:// | ||
| - | ===== Porterweiterung ===== | + | ===== Porterweiterung |
| Raspberry Pi GPIOs mittels I2C Port Expander erweitern | Raspberry Pi GPIOs mittels I2C Port Expander erweitern | ||
| + | |||
| [[https:// | [[https:// | ||
| + | |||
| + | [[http:// | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | < | ||
| + | i2cset -y 1 0x20 0x15 0xff | ||
| + | </ | ||
| + | Der 1. Hexwert ist die Adresse von der Porterweiterung (rauszubekommen mit sudo i2cdetect 1), der 2. Wert kommt aus der Tabelle (in diesen Fall ein/ | ||
| + | ==== PCF8574 ==== | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | |||
| ===== Tasten ===== | ===== Tasten ===== | ||
| Zeile 144: | Zeile 163: | ||
| {{: | {{: | ||
| + | scheint nicht zu funktionieren (emulator). besser? | ||
| + | |||
| + | https:// | ||
| + | |||
| + | {{: | ||
| + | |||
| + | Ach was, da ha ich zu wenig Ahnung, ich mach das Screen-Backlight jetzt mit einem Relais an&aus. Klickt halt. | ||
| + | |||
| + | Ein Python-skript habe ich gefunden, das bei Nicht-Bewegung den Screensaver einschaltet. Kann ich umschreiben, | ||
| + | |||
| + | < | ||
| + | # | ||
| + | # -*- coding: utf-8 -*- | ||
| + | # | ||
| + | # pir_test.py | ||
| + | # | ||
| + | # Copyright 2013 Ed Baker < | ||
| + | # | ||
| + | # This program is free software; you can redistribute it and/or modify | ||
| + | # it under the terms of the GNU General Public License as published by | ||
| + | # the Free Software Foundation; either version 2 of the License, or | ||
| + | # (at your option) any later version. | ||
| + | # | ||
| + | # This program is distributed in the hope that it will be useful, | ||
| + | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| + | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| + | # GNU General Public License for more details. | ||
| + | # | ||
| + | # You should have received a copy of the GNU General Public License | ||
| + | # along with this program; if not, write to the Free Software | ||
| + | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
| + | # MA 02110-1301, USA. | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # sample Program by Ed Baker - 2013 | ||
| + | # for Raspberry Pi using the Gertboard and PIR sensor. | ||
| + | # | ||
| + | # PIR Sensor Data on Pin 25, Positive and ground hooked to 3.3v on Gert- | ||
| + | # board. Run the program from a terminal window in the same directory | ||
| + | # as pir_test.py | ||
| + | # use the comand: sudo paython pir_test.py | ||
| + | # | ||
| + | # NOTE: Won't work with power saving screen blanking. | ||
| + | # Written for Raspberry Pi 2 rev. B using Raspbian with the xscreensaver | ||
| + | # installed. (if your screen lock does not work, install xscreensaver) | ||
| + | # | ||
| + | |||
| + | import os #for OS program calls | ||
| + | import sys #For Clean sys.exit command | ||
| + | import time #for sleep/ | ||
| + | import RPi.GPIO as io #read the GPIO pins | ||
| + | |||
| + | io.setmode(io.BCM) | ||
| + | |||
| + | pir_pin = 25 # Sensor pin 25 for data out of the PIR sensor | ||
| + | |||
| + | io.setup(pir_pin, | ||
| + | print(" | ||
| + | print(" | ||
| + | time.sleep(20) | ||
| + | os.system(" | ||
| + | |||
| + | while True: # endless loop, waiting for nothing. Use Control+C to exit | ||
| + | if io.input(pir_pin): | ||
| + | os.system(" | ||
| + | print(" | ||
| + | io.cleanup() #reset GPIO | ||
| + | sys.exit() #exit cleanly to the command prompt. | ||
| + | |||
| + | |||
| + | </ | ||
| + | Oder: | ||
| + | < | ||
| + | |||
| + | import RPi.GPIO as GPIO | ||
| + | import os | ||
| + | GPIO.setwarnings(False) | ||
| + | GPIO.setmode(GPIO.BCM) | ||
| + | GPIO.setup(11, | ||
| + | while True: | ||
| + | if GPIO.input(11): | ||
| + | print (" | ||
| + | os.system(" | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | Das Display lässt sich auch ein/ | ||
| + | < | ||
| + | DISPLAY=:0 xset dpms force off | ||
| + | DISPLAY=:0 xset dpms force on | ||
| + | </ | ||
| ===== Fingerabdrucksensor ===== | ===== Fingerabdrucksensor ===== | ||
| Zeile 149: | Zeile 261: | ||
| [[https:// | [[https:// | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | |||
| + | < | ||
| + | wget -O - http:// | ||
| + | sudo wget http:// | ||
| + | sudo apt-get update | ||
| + | sudo apt-get install python-fingerprint --yes | ||
| + | |||
| + | # Anlernen: | ||
| + | python2 / | ||
| + | |||
| + | #Lesen: | ||
| + | python / | ||
| + | |||
| + | # Index anzeigen (freier Platz): | ||
| + | python / | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | Die Bilddateien werden offenbar auf dem Gerät selbst verarbeitet. Der Download des Bildes (siehe Beispielscript) dauert recht lange... | ||
| ===== Ambilight selber bauen ===== | ===== Ambilight selber bauen ===== | ||
| Zeile 159: | Zeile 298: | ||
| Sempi-Kommerziell: | Sempi-Kommerziell: | ||
| + | |||
| + | ===== Touch-Taster ===== | ||
| + | |||
| + | Hardware: | ||
| + | |||
| + | 3 Anschlüsse: | ||
| + | |||
| + | Software: | ||
| + | |||
| + | Wie normaler Taster: | ||
| + | [[http:// | ||
| + | |||
| + | |||
| + | Python (GPIO ist nach GPIO-Nummer nummeriert, nicht nach Pin): | ||
| + | < | ||
| + | import RPi.GPIO as GPIO # | ||
| + | import time | ||
| + | |||
| + | GPIO.setmode(GPIO.BCM) #Zaehlweise der GPIO-PINS auf der Platine, analog zu allen Beispielen | ||
| + | |||
| + | GPIO.setup(23, | ||
| + | |||
| + | while True: | ||
| + | input_state = GPIO.input(23) | ||
| + | if input_state == False: | ||
| + | print(' | ||
| + | time.sleep(2) # war 0.2, aber Quatsch, weil man den touch-Taster ja länger drueckt... | ||
| + | | ||
| + | </ | ||
| + | |||
| + | ===== Dot Matrix ===== | ||
| + | |||
| + | |||
| + | Raspberry Pi LED MAX7219 DotMatrix – Projektübersicht: | ||
| + | [[https:// | ||
| + | |||
| + | Die Bibliothek für mehrzellige DotMatrix-LEDs hab ich nicht zum Laufen gebracht (zumindest nicht mit nur einem 8x8-Modul).((https:// | ||
| + | |||
| + | GRafik-Editor (online): [[https:// | ||
| + | |||
| + | ==== Max7219 ==== | ||
| + | Quelle((https:// | ||
| + | |||
| + | Funktioniert | ||
| + | |||
| + | Dann hatte ich das Problem, das bei mir im SPI-Bus der CS0 (Chip Select 0) schon belegt war, weil ich auf CS0 schon den RFID-Reader hatte. Also Änderung auf CS1. Man kann problemlos beide Ports quasi gleichzeitig verwenden. Von den 4 Anschlüssen gehen 3 auf beide Geräte, der 4. entsprechend zu CS0 oder CS1 auf dem Raspi.... | ||
| + | |||
| + | Dann muss man bei den Beispielen den Befehl zur Öffnung des seriellen SPI-Ports ändern: | ||
| + | |||
| + | < | ||
| + | serial = spi(port=0, device=0, gpio=noop()) | ||
| + | </ | ||
| + | in | ||
| + | < | ||
| + | serial = spi(port=0, device=1, gpio=noop()) | ||
| + | </ | ||
| + | wenn man den Port von SP0 auf SP1 ändern will | ||
| + | |||
| + | ===== Kamera Camera ===== | ||
| + | |||
| + | raspistill | ||
| + | |||
| + | {{ : | ||
| + | ===== Frequenzgenerator (eigenes Bauteil) ===== | ||
| + | Signal Generator PWM Pulse Frequency Duty Cycle Adjustable Module LCD 3.3V-30V | ||
| + | {{: | ||