Difference between revisions of "2010910 pi workshop notes"
(Created page with "Raspberry Pi 3 computer <br> OS (Raspbian) loaded on SD card <br> All GPIO pins are flexible 3.3V OUT or IN (will generate floating voltage when not programmed) <br> GPIO can...") |
|||
Line 23: | Line 23: | ||
On pi, up to 127 sensors can be connected to the SDA and SCL ports. Each device has a fix-programmed specific address. | On pi, up to 127 sensors can be connected to the SDA and SCL ports. Each device has a fix-programmed specific address. | ||
<br> | <br> | ||
− | i2c-tools is a program that allows to detect from all these sensors using the | + | i2c-tools is a program that allows to detect from all these sensors using the i2cdetect protocol. |
<br> | <br> | ||
+ | "sudo raspi-config" to configure the pi computer | ||
+ | <br> | ||
+ | Step 1. Tell pin to be GPIO2 <br> | ||
+ | Step 2. Tell pin to be ON or OFF <br> | ||
+ | 2 ways of accessing the pins: GPIO# or pin# <br> | ||
+ | "GPIO-g" flags to GPIO# <br> | ||
+ | |||
+ | Controlling GPIO ports using Python: http://elinux.org/RPi_GPIO_Code_Samples#Python | ||
+ | |||
+ | Or using BASH command line (UNIX language): | ||
+ | |||
+ | sudo -i | ||
+ | echo "4" > /sys/class/gpio/export | ||
+ | echo "out" > /sys/class/gpio/gpio4/direction | ||
+ | echo "1" > /sys/class/gpio/gpio4/value <-turns it on | ||
+ | echo "0" > /sys/class/gpio/gpio4/value <-turns it off |
Revision as of 09:38, 10 September 2016
Raspberry Pi 3 computer
OS (Raspbian) loaded on SD card
All GPIO pins are flexible 3.3V OUT or IN (will generate floating voltage when not programmed)
GPIO can be programmed using gpio utility: http://wiring.com/the-gpio-utility/
UART pins carry data (RX=receive, TX=transmit), allows connection of devices (GPS), 3V->3V, GND->GDN, RX->TX, TX->RX
Sends text signals, each character encoded in 8bits ("packed" encapsulated into a "start bit" and a "stop bit")
Speed is 9600 Baud (1 Baud = 1 bit per sec)
To access this data, you can either use a Python script, or a software called "screen"
directory "/dev/ttyACM0 9600" contains a new file that represents the connexion to a device (arduino, printer, etc.)
I2C protocol
For example: BMP280 sensor temperature and pressure sensor (4pins=3V, GND, SDA, SCL)
On pi, up to 127 sensors can be connected to the SDA and SCL ports. Each device has a fix-programmed specific address.
i2c-tools is a program that allows to detect from all these sensors using the i2cdetect protocol.
"sudo raspi-config" to configure the pi computer
Step 1. Tell pin to be GPIO2
Step 2. Tell pin to be ON or OFF
2 ways of accessing the pins: GPIO# or pin#
"GPIO-g" flags to GPIO#
Controlling GPIO ports using Python: http://elinux.org/RPi_GPIO_Code_Samples#Python
Or using BASH command line (UNIX language):
sudo -i echo "4" > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio4/direction echo "1" > /sys/class/gpio/gpio4/value <-turns it on echo "0" > /sys/class/gpio/gpio4/value <-turns it off