-
Notifications
You must be signed in to change notification settings - Fork 11
Adafruit
Adafruit Industries (https://www.adafruit.com/) provide an excellent range of HATs and other peripherals for the Raspberry Pi, most of which can be used easily on the UP board as well.
To get users started with their HATs, Adafruit typically provides open-source Python libraries through their repositories on Github: https://github.com/adafruit.
If you are using Ubuntu, you'll need to install the MRAA library.
Many of those Python libraries depend on the "Adafruit_GPIO" library, which includes some code to identify the platform (e.g. Raspberry Pi, BBB, Minnowboard, etc.) and set some correct defaults for that platform such as the I2C bus number to use.
Emutex has modified the Adafruit_GPIO library to add initial support for the UP board. Right now, you can get this version and install it by running the following commands on your UP board:
sudo apt-get update
sudo apt-get install -y build-essential python-pip python-dev python-smbus git
git clone -b up-board https://github.com/emutex/Adafruit_Python_GPIO.git
cd Adafruit_Python_GPIO
sudo python setup.py install
Then, other Adafruit Python libraries that depend on that can be installed as normal from the Adafruit repositories. For example, to install the library for the Capacitive Touch HAT (https://www.adafruit.com/products/2340):
git clone https://github.com/adafruit/Adafruit_Python_MPR121.git
cd Adafruit_Python_MPR121
sudo python setup.py install
Please note that some libraries may require additional changes to work on the UP board. Feel free to update this wiki page with details of additional Adafruit libraries that work or don't work, or start a discussion in the UP forum.
- Adafruit Capacitive Touch HAT for Raspberry Pi - Mini Kit - MPR121 ** Verified by Emutex ([How-To](#Using Adafruit Capacitive Touch HAT on UP))
-
Adafruit 16-Channel PWM / Servo HAT for Raspberry Pi - Mini Kit
- Verified by Emutex ([How-To](#Using Adafruit 16-Channel PWM / Servo HAT on UP))
-
Adafruit DC & Stepper Motor HAT for Raspberry Pi - Mini Kit
- Verified by Emutex ([How-To](#Using Adafruit DC & Stepper Motor HAT on UP))
-
ADXL345 - Triple-Axis Accelerometer (+-2g/4g/8g/16g) w/ I2C/SPI
- Verified by Emutex ([How-To](#Using Adafruit ADXL345 Triple-Axis Accelerometer Breakout board on UP))
-
MCP9808 High Accuracy I2C Temperature Sensor Breakout Board
- Verified by Emutex ([How-To](#Using Adafruit MCP9808 Temperature Sensor Breakout board on UP))
If anyone has successfully verified additional Adafruit HATs or breakout boards with UP, please feel free to add them here
- With the UP board powered off, plug the HAT on the 40-pin I/O header, making sure that the HAT connector is aligned to pin 1 on the 40-pin I/O header.
- [IMPORTANT] Install the modified Adafruit_GPIO library as described in the Overview section above
- Download and install the Adafruit_MPR121 Python library as follows:
git clone https://github.com/adafruit/Adafruit_Python_MPR121.git
cd Adafruit_Python_MPR121
sudo python setup.py install
- Run the following example script
sudo python examples/simpletest.py
- Touch any of the 12 large round contacts on the HAT, numbered from 0-11, and you should see messages printed on the screen to indicate that the touch was detected.
For more information and project ideas, please check out these links:
- https://www.adafruit.com/products/2340
- https://www.adafruit.com/products/1982
- https://learn.adafruit.com/mpr121-capacitive-touch-sensor-on-raspberry-pi-and-beaglebone-black/software
- With the UP board powered off, plug the HAT on the 40-pin I/O header, making sure that the HAT connector is aligned to pin 1 on the 40-pin I/O header.
- The servo hat requires an i2c input, which by default is not enabled in the BIOS. Head over to the Hat tab in the bios and enable it at the I2CO/GPIO Selection.
- [IMPORTANT] Install the modified Adafruit_GPIO library as described in the Overview section above
- Download and install the Adafruit_PCA9685 Python library as follows:
git clone https://github.com/adafruit/Adafruit_Python_PCA9685.git
cd Adafruit_Python_PCA9685
sudo python setup.py install
- Detect the correct address for your I2C bus:
ls /sys/devices/pci0000:00/808622C1:01/ | grep i2c
sudo i2cdetect -r -y <bus number>
Then, edit the examples/simpletest.py script and update the address and bus number for your case:
pwm = Adafruit_PCA9685.PCA9685(address=<address>, busnum=<bus>)
- Connect a servo motor, such as this one to channel 0, as illustrated here
- Run the following example script
sudo python examples/simpletest.py
- The servo rotor arm should move continuously back and forth between min and max positions (typically a sweep of ~180 degrees). You may want to tune the min/max pulse lengths for your specific servo, by editing the 'servo_min' and 'servo_max' variables in the simpletest.py script.
For more information and project ideas, please check out these links:
- https://www.adafruit.com/product/2327
- https://learn.adafruit.com/adafruit-16-channel-servo-driver-with-raspberry-pi/overview
- With the UP board powered off, plug the HAT on the 40-pin I/O header, making sure that the HAT connector is aligned to pin 1 on the 40-pin I/O header.
- [IMPORTANT] Download and install this modified version of the Adafruit Motor HAT Python library as follows:
git clone -b up-board https://github.com/emutex/Adafruit-Motor-HAT-Python-Library.git
cd Adafruit-Motor-HAT-Python-Library
sudo python setup.py install
- Connect a DC motor, such as this one to the M1 terminals, and a suitable external power source, as explained in this guide
- Run the following example script
sudo python examples/DCTest.py
- The motor should rotate forwards (speeding up and slowing down), then in reverse, repeatedly.
For more information and project ideas, please check out these links:
- https://www.adafruit.com/products/2348
- https://learn.adafruit.com/adafruit-dc-and-stepper-motor-hat-for-raspberry-pi
- https://learn.adafruit.com/adafruit-motor-selection-guide/types-of-motors
Unlike the examples above, this is not available in a HAT form factor. However, the breakout board can still be connected easily to the UP Board as follows:
- With the UP board powered off, use suitable jumer wires to connect pins from the breakout board to the 40-pin I/O header on the UP board as follows (click here for the UP board pin layout):
ADXL345 UP Board
------- --------------
VIN <-> Pin 1 (3.3V)
GND <-> Pin 6 (GND)
SDA <-> Pin 3 (I2C1_SDA)
SCL <-> Pin 5 (I2C1_SCL)
- [IMPORTANT] Install the modified Adafruit_GPIO library as described in the Overview section above
- Download and install the Adafruit_ADXL345 Python library as follows:
git clone https://github.com/adafruit/Adafruit_Python_ADXL345.git
cd Adafruit_Python_ADXL345
sudo python setup.py install
- Run the following example script
sudo python examples/simpletest.py
- Move the accelerometer around to observe the changes in G forces on the X/Y/Z axes.
For more information and project ideas, please check out these links:
Unlike the examples above, this is not available in a HAT form factor. However, the breakout board can still be connected easily to the UP Board as follows:
- With the UP board powered off, use suitable jumer wires to connect pins from the breakout board to the 40-pin I/O header on the UP board as follows (click here for the UP board pin layout):
MCP9808 UP Board
------- --------------
Vdd <-> Pin 1 (3.3V)
Gnd <-> Pin 6 (GND)
SDA <-> Pin 3 (I2C1_SDA)
SCL <-> Pin 5 (I2C1_SCL)
- [IMPORTANT] Install the modified Adafruit_GPIO library as described in the Overview section above
- Download and install the Adafruit_MCP9808 Python library as follows:
git clone https://github.com/adafruit/Adafruit_Python_MCP9808.git
cd Adafruit_Python_MCP9808
sudo python setup.py install
- Run the following example script, which will print the measured temperature to the screen once per second:
sudo python examples/simpletest.py
For more information and project ideas, please check out these links:
NOTE: This wiki is the main source of documentation for developers working with (or contributing to) the UP products. If this is your first time hearing about UP, we recommend starting with our main UP website, and our UP community page.