Raspberry PI
GPIO
What is GPIO
Buttons and LEDs
Active High
Active Low
Active High
Active Low
All together
With Raspberry
Inside the Raspberry Pi
From Shiju Abraham, MS thesis ECE, U of Texas, Arlington, 2014
If PAD voltage is high enough, top transistor is conducting
(connecting VDD to internal circuitry)
If PAD voltage is low enough, bottom transistor is conducting
(connecting VSS to internal circuitry)
If “From internal circuit” is high, PAD is connected to VDD
If “From internal circuit” is low, PAD is connected to VSS
INPUT
OUTPUT
PAD = Pin
VDD = 3.3V
VSS = 0V or GND
Diode,
protects circuit
PNP Transistor
NPN Transistor
Python Turning on LED
Python Reading Button
Reading many Buttons
https://learn.parallax.com/tutorials/language/propeller-c/propeller-c-simple-devices/read-4x4-matrix-keypad
INPUT:
Will read 0 if no button is pushed
Will read 3.3V if corresponding row was set
Scan row by row, e.g.:
3.3V on P7:
want to read this row
0V on P6..P4:
don’t want to read these rows
Reading 16 Buttons with 8 PINs
Output and Inputs work together
Lighting up many LEDs
Energizing 64 LEDs with 16 Pins
Putting pin 9 on HIGH=3.3V &
Putting pin 13 on LOW=0V
Turns on top left LED
You can energize one row or one colum at a time
Output and Inputs work together
LED Matrix
How about a really big LED displays?
Use an LED matrix driver IC and talk to it
Talking to another Device: Serial Communication
Transmitting Signals Digitally
LSB
MSB
b01010011
0x53
83
“S”
I2C Bus
I2C Schematic
Sound
Sending Value:
0 1 2 3 4
Original 1-bit Digital Encoding Output Filtering