First there was CHIPtimus Prime for the CHIP SBC. Then came ODROIDtimus Prime for the ODROID C series. Now there's PINEimus Prime for the PINE64. This will work for I2C displays only at this point. I wasn't able to get SPI fired up with legacy or mainline Armbian.
Transform your PINE64 into a PINEimus Prime for projects requiring a small OLED display. Luma.OLED makes it easy to do text, graphics and video. Both displays I used to test I bought on Amazon. I already ordered some cheaper ones on EBay. I was able to get 3 SSD1306 I2C displays for under $10! I also ordered some TFT displays as well to test.
Requirements
Configure I2C
Time to install Luma.OLED
I2C hello world
Run example on I2C display
Transform your PINE64 into a PINEimus Prime for projects requiring a small OLED display. Luma.OLED makes it easy to do text, graphics and video. Both displays I used to test I bought on Amazon. I already ordered some cheaper ones on EBay. I was able to get 3 SSD1306 I2C displays for under $10! I also ordered some TFT displays as well to test.
Requirements
- PINE64 flashed with latest legacy Armbian Ubuntu server
- Small nylon nuts, bolts and standoffs
- OLED display (check http://luma-oled.readthedocs.io/en/latest/hardware.html)
- Tested I2C OLED display (I used https://www.amazon.com/gp/product/B00O2KDQBE, but there are cheaper alternatives)
- 4 female/female jumper wires required
Code:
VCC to VCC 5V (pin 4)
GND to GND (pin 6)
SCL to I2C1 SCL (pin 5)
SDA to I2C1 SDA (pin 3)
Configure I2C
- Power off PINE64, wire up display and power on
- sudo apt-get install i2c-tools
- sudo usermod -a -G i2c username
- i2cdetect -l
Code:
i2c-0 i2c twi0 I2C adapter
i2c-1 i2c twi1 I2C adapter
- i2cdetect -y 1
Code:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Time to install Luma.OLED
Code:
sudo apt-get install python-dev python-pip libfreetype6-dev libjpeg-dev
sudo -H pip install --upgrade pip setuptools
sudo -H pip install --upgrade luma.oled
I2C hello world
- cd
- nano i2chello.py
Code:
import time
from luma.core.serial import i2c
from luma.core.render import canvas
from luma.oled.device import ssd1306
serial = i2c(port=1, address=0x3C)
device = ssd1306(serial)
with canvas(device) as draw:
draw.rectangle(device.bounding_box, outline="white")
draw.text((3, 3), "Hello", fill="white")
time.sleep(10)
- python i2chello.py
Code:
cd
sudo apt-get install git-core libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev
git clone https://github.com/rm-hull/luma.examples.git
cd luma.examples
sudo -H pip install -e .
Run example on I2C display
Code:
cd
cd luma.examples
python examples/invaders.py -d ssd1306 --i2c-port 1 --i2c-address 0x3c