Metainformationen zur Seite
  •  

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
computer:raspberrypi:gpio [2013/07/12 02:11]
ristigl [Pegelanpassung]
computer:raspberrypi:gpio [2018/03/16 21:11] (aktuell)
Zeile 2: Zeile 2:
  
 <note warning>​Do not use voltage levels greater than 3.3V, Raspberry pi doesn´t support 5V and doesn'​t have an over-voltage protection.</​note>​ <note warning>​Do not use voltage levels greater than 3.3V, Raspberry pi doesn´t support 5V and doesn'​t have an over-voltage protection.</​note>​
 +Quelle: https://​sites.google.com/​site/​semilleroadt/​raspberry-pi-tutorials/​gpio
  
-{{:​computer:​raspberrypi:​gpio-revision1.png}} +{{:​computer:​raspberrypi:​gpio-revision1.png?300}} 
-{{:​computer:​raspberrypi:​gpio-revision2.png}}+{{:​computer:​raspberrypi:​gpio-revision2.png?300}}
  
-https://sites.google.com/site/semilleroadt/​raspberry-pi-tutorials/​gpio+ 
 + 
 +Quelle: http://www.doctormonk.com/2013/02/​raspberry-pi-and-breadboard-raspberry.html 
 + 
 +Sehr sinnvoll für ein möglichst sicheres basteln ist diese Idee: 
 + 
 +{{:​computer:​raspberrypi:​leaf_-_web.jpg}} 
 +{{:​computer:​raspberrypi:​raspberry_leaf_r2.png}}
  
 ===== Pegelanpassung ===== ===== Pegelanpassung =====
Zeile 18: Zeile 26:
  
  
 +
 +===== Ansprechen über die Shell =====
 +Um eine LED mithilfe eines Raspberry Pis zum Blinken zu bringen, benötigt man zu allererst WiringPi.
 +
 +  wget http://​project-downloads.drogon.net/​files/​wiringPi.tgz
 +
 +Das Programm muss nun entpackt, kompiliert und installiert werden:
 +
 +<​code>​
 +tar xfz wiringPi.tgz
 +cd wiringPi/​wiringPi
 +make
 +make install
 +cd ../gpio
 +make clean
 +</​code>​
 +
 +Ist das Programm installiert,​ so lassen sich Pins wie folgt ansprechen:
 +
 +  /​usr/​local/​bin/​gpio -g mode 23 out
 +  /​usr/​local/​bin/​gpio -g write 23 1
  
 ===== Ansprechen mit Python ===== ===== Ansprechen mit Python =====
Zeile 28: Zeile 57:
  
 Beipielcode:​ https://​code.google.com/​p/​raspberry-gpio-python/​wiki/​BasicUsage Beipielcode:​ https://​code.google.com/​p/​raspberry-gpio-python/​wiki/​BasicUsage
-<​code>​+<​code ​python>
 import RPi.GPIO as GPIO import RPi.GPIO as GPIO
 GPIO.setmode(GPIO.BCM) GPIO.setmode(GPIO.BCM)
Zeile 41: Zeile 70:
 </​code>​ </​code>​
  
-===== Proplem: Prellen =====+===== Pull-Up und Pull-Down ===== 
 +Quelle: https://​code.google.com/​p/​raspberry-gpio-python/​wiki/​Inputs 
 + 
 +"If you do not have the input pin connected to anything, it will '​float'​. In other words, the value that is read in is undefined because it is not connected to anything until you press a button or switch. It will probably change value a lot as a result of receiving mains interference. 
 + 
 +To get round this, we use a pull up or a pull down resistor. In this way, the default value of the input can be set. It is possible to have pull up/down resistors in hardware and using software. In hardware, a 10K resistor between the input channel and 3.3V (pull-up) or 0V (pull-down) is commonly used. The RPi.GPIO module allows you to configure the Broadcom SOC to do this in software:"​ 
 + 
 +  GPIO.setup(channel,​ GPIO.IN, pull_up_down=GPIO.PUD_UP) 
 +or 
 +  GPIO.setup(channel,​ GPIO.IN, pull_up_down=GPIO.PUD_DOWN) 
 + 
 +Problem: SDA und SCL-Pins funktionieren nicht wie erwarten: 
 + 
 +Quelle: http://​raspberrypi.stackexchange.com/​questions/​4919/​unable-to-read-from-sda-scl-as-gpio 
 + 
 +"SDA and SCL pins have external 1k8 pull-up resistors connected. This is indeed because they are intended for I²C usage (which requires them). Unfortunately,​ since they are external, they can't be disabled in software. 
 + 
 +Having pull-up resistors means that default state of the pin in HIGH, unless they are pulled to ground."​ 
 + 
 + 
 +===== Problem: Prellen =====
 {{ :​computer:​raspberrypi:​entprellen.png}} {{ :​computer:​raspberrypi:​entprellen.png}}
 Wenn man einen Taster Anschließt,​ so kommt es beim Betätigen zum Prellen (Siehe Abbildung). Wenn man einen Taster Anschließt,​ so kommt es beim Betätigen zum Prellen (Siehe Abbildung).
Zeile 47: Zeile 96:
 Quelle: http://​www.mikrocontroller.net/​articles/​Entprellung Quelle: http://​www.mikrocontroller.net/​articles/​Entprellung
  
 +===== Portexpander =====
  
 +Kontroller-Chip,​ um 16 Ausgänge mit 2 Leitungen anzusteuern:​
  
 +http://​www.pollin.de/​shop/​dt/​MDY4ODk4OTk-/​Bauelemente_Bauteile/​Aktive_Bauelemente/​IC/​MCP23S17_E_SP.html
  
 +https://​ex.ploit.ws/​themagpi/​The-MagPi-issue-13-en.pdf Seite 11:
  
  
 +Laden der Treiber zulassen:
 +
 +In **/​etc/​modprobe.d/​raspi-blacklist.conf** den Eintrag für **i2c-bcm2708** einkommentieren.
 +In **/​etc/​modules** einen Zeile mit **i2c-dev** anlegen.
 +
 +Installieren der Tools zur Ansteuerung:​
 +<​code>​
 +sudo apt-get update
 +sudo apt-get install python-smbus
 +sudo apt-get install i2c-tools
 +sudo adduser pi i2c
 +sudo reboot
 +sudo i2cdetect -y 1
 +</​code>​
 +
 +...