At any time after armbian is installed, it's easy to tell what board you have: simply cat /etc/armbian-release and look for BOARD_NAME
Install ARMbian on your ODROID C2
We're only going to be using armbian, other distros could be made to work but you'd probably need to figure out how to detect the platform since we rely on /etc/armbian-release
existing. Using other operating systems and CircuitPython is your call, we cannot provide support for that.
Download and install the latest armbian, for example we're using https://www.armbian.com/odroid-c2/
There's some documentation to get started at https://docs.armbian.com/User-Guide_Getting-Started/
We've found the easiest way to connect is through a console cable, wired to the UART Serial port, and then on your computer, use a serial monitor at 115200 baud.
After logging in you may be asked to create a new username, we recommend pi - if our instructions end up adding gpio access for the pi user, you can copy and paste them.
Once installed, you may want to enable mdns so you can ssh [email protected]
instead of needing to know the IP address:
sudo apt-get install avahi-daemon
then reboot
sudo apt-get update sudo apt-get upgrade
Install Python and set Python 3 to Default
There's a few ways to do this. Since Python 2 is no longer installed by default, we recommend something like this:
sudo apt-get install -y python3 git python3-pip sudo update-alternatives --install /usr/bin/python python $(which python3) 2
This will make it so typing python
runs python3
.
sudo pip3 install --upgrade setuptools
Update all your Python 3 packages with
pip3 freeze - local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U
and
sudo bash pip3 freeze - local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U
sudo apt-get install libgpiod2 pip3 install gpiod
After installation, you should be able to import gpiod
from within Python 3:
Enable UART, I2C and SPI
A vast number of our CircuitPython drivers use UART, I2C and SPI for interfacing, so you'll want to get those enabled.
You only have to do this once per board, unfortunately by default all three interfaces are disabled!
Install the support software with:
sudo apt-get install -y python3-smbus python3-dev i2c-tools sudo adduser pi i2c
The ODROID C2 does not have a hardware peripheral, but I2C is enabled by default, so if you run ls /dev/i2c*
You should see at least one i2c device.
The UART Serial Port on the ODROID C2 is connected to /dev/ttyAML0. To enable the GPIO UART, edit /boot/armbianEnv.txt and add this line to the end.
overlays=uartA
After you have rebooted, verify that /dev/ttyAML1 is now enabled by typing:
ls /dev/ttyA*
Install Python Libraries
Now you're ready to install all the Python support.
Run the following command to install adafruit_blinka:
sudo pip3 install adafruit-blinka
The computer will install a few different libraries such as adafruit-pureio
(our ioctl-only i2c library), Adafruit-GPIO
(for detecting your board) and of course adafruit-blinka
.
That's pretty much it! You're now ready to test.
Create a new file called blinkatest.py with nano or your favorite text editor and put the following in:
import board import digitalio import busio print("Hello blinka!") # Try to great a Digital input pin = digitalio.DigitalInOut(board.D7) print("Digital IO ok!") # Try to create an I2C device i2c = busio.I2C(board.SCL, board.SDA) print("I2C ok!") # Try to create an SPI device #spi = busio.SPI(board.SCLK, board.MOSI, board.MISO) #print("SPI ok!") print("done!")
Save it and run at the command line with
sudo python3 blinkatest.py
You should see the following, indicating digital i/o, I2C and SPI all worked
Text editor powered by tinymce.