|
|
|
|
| Debian | コードネーム | 年月 | 備考 | (参考)Ubuntuでの該当名称 |
| Debian 11 | Bullseye | 2021/08/14~ | 2021/11からラズパイにリリース | Focal Fossa 20.04 LTS ? |
| Debian 10 | Buster | 2019/06/20~ | 2019/06からラズパイ4対応 | Bionic 18.04 LTS |
| Debian 9 | Stretch | 2017/08/16~ | 2018/03からラズパイ3B+対応 | Xenial 16.04 LTS |
| Debian 8 | Jessie | 2015~ | 2016/02からラズパイ3対応 | Trusty 14.04 LTS |
| Debian 7 | Wheezy | 2013~2016 | ||
| Debian 6.0 | Squeeze | 2011~2014 | ||
| Debian GNU/Linux 5.0 | Lenny | 2009~2012 |
SPI有効化の手順で良くあるブラックリスト解除の下記の手順は Raspbian Jessieでは不要です。 sudo nano /etc/modprobe.d/raspi-blacklist.conf blacklist spi-bcm2708 をコメント化する。 #blacklist spi-bcm2708


![]() HiLetgo 0.96" I2C IIC SPI シリアル 128×64 OLED LCDディスプレイSSD1306液晶 STM32/51/MSP430/Arduino 白いフォント [並行輸入品] ASIN: B01MDK1X72 SPI接続タイプはこちら |
![]() EasyWordMall SPI OLEDモジュール ディスプレイ 0.96インチ ブルー&イエロー51マイクロコントローラ12864 Arduino用 ASIN: B017M15OFU SPI接続タイプはこちら 2色版 |
![]() EasyWordMall iic i2c ホワイトOLEDモジュール ディスプレイ 0.96インチ 51マイクロコントローラ12864 Arduino用 ASIN: B017M15KX6 I2C接続タイプはこちら |
![]() EasyWordMall iic i2c OLEDモジュール ディスプレイ 0.96インチ ブルー&イエロー51マイクロコントローラ12864 Arduino用 ASIN: B017M15MNE I2C接続タイプはこちら 2色版 |



sudo raspi-config 7 Advanced Options - Configure advanced settings A6 SPI - Enable/Disable automatic loading Yesを選択する。 Finishで raspi-configを終了する。 (再起動不要)
sudo raspi-config 5 Interfacing Options - Configure connections to peripher P4 SPI - Enable/Disable automatic loading Would you like the SPI interface to be enabled? Yesを選択する。 Finishで raspi-configを終了する。 (再起動不要)
$ ls -l /dev/spi* crw-rw---- 1 root spi 153, 0 Jan 14 09:51 /dev/spidev0.0 crw-rw---- 1 root spi 153, 1 Jan 14 09:51 /dev/spidev0.1
sudo apt-get update -y sudo apt-get install -y build-essential python-dev python-pip sudo pip install RPi.GPIO sudo apt-get install -y python-imaging python-smbus sudo apt-get install -y git
git clone https://github.com/adafruit/Adafruit_Python_SSD1306.git cd Adafruit_Python_SSD1306 sudo python setup.py install
cd examples/ cd ~/Adafruit_Python_SSD1306/examples ls -l # -rw-r--r-- 1 pi pi 4283 Jan 14 09:56 animate.py # -rw-r--r-- 1 pi pi 12341 Jan 14 09:56 happycat_oled_32.ppm # -rw-r--r-- 1 pi pi 24629 Jan 14 09:56 happycat_oled_64.ppm # -rw-r--r-- 1 pi pi 2523 Jan 14 09:56 image.py # -rw-r--r-- 1 pi pi 4281 Jan 14 09:59 shapes.py
sudo python shapes.py IOError: [Errno 2] No such file or directory: '/dev/i2c-1'IOErrorのエラーで怒られます。
# 128x32 display with hardware I2C: disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST) をコメント化して、 # 128x64 display with hardware SPI: # disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST, dc=DC, spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=8000000)) を有効化します。修正後、
# 128x32 display with hardware I2C: # disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST) ~~ 略 ~~ # 128x64 display with hardware SPI: disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST, dc=DC, spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=8000000))となります。

sudo python shapes.py・Raspberry Pi 3で 0.96インチ SPI接続 OLEDディスプレイを使用する

sudo python animate.py・Raspberry Pi 3で 0.96インチ SPI接続 OLEDディスプレイを使用する

sudo python image.py・Raspberry Pi 3で 0.96インチ SPI接続 OLEDディスプレイを使用する


sudo raspi-config 7 Advanced Options - Configure advanced settings A6 SPI - Enable/Disable automatic loading Yesを選択する。 Finishで raspi-configを終了する。 (再起動不要)
$ ls -l /dev/spi* crw-rw---- 1 root spi 153, 0 Jan 14 09:51 /dev/spidev0.0 crw-rw---- 1 root spi 153, 1 Jan 14 09:51 /dev/spidev0.1
sudo apt-get update -y sudo apt-get install -y build-essential python-dev python-pip sudo pip install RPi.GPIO sudo apt-get install -y python-imaging python-smbus sudo apt-get install -y git
sudo apt-get install -y python-dev python-pip sudo pip install wiringpi※ wiringpiが無いと ImportError wiringpiのエラーで怒られます。
sudo python OLEDtext.py ImportError: No module named wiringpi
sudo apt-get install -y git git clone https://github.com/the-raspberry-pi-guy/OLED cd OLED sh OLEDinstall.sh
cd ~/OLED/python-examples ls -l # -rw-r--r-- 1 pi pi 1461 Jan 14 10:28 OLEDclock.py # -rw-r--r-- 1 pi pi 1960 Jan 14 10:28 OLEDimage.py # -rw-r--r-- 1 pi pi 1975 Jan 14 10:28 OLEDip.py # -rw-r--r-- 1 pi pi 1368 Jan 14 10:28 OLEDtext.py # -rw-r--r-- 1 pi pi 58624 Sep 2 2014 penguins900x600.jpg
sudo python OLEDtext.py・Raspberry Pi 3で 0.96インチ SPI接続 OLEDディスプレイを使用する

sudo python OLEDip.py・Raspberry Pi 3で 0.96インチ SPI接続 OLEDディスプレイを使用する

sudo python OLEDclock.py・Raspberry Pi 3で 0.96インチ SPI接続 OLEDディスプレイを使用する

sudo python OLEDimage.py penguins900x600.jpg・Raspberry Pi 3で 0.96インチ SPI接続 OLEDディスプレイを使用する

RESET_PIN = 15 # WiringPi pin 15 is GPIO14. DC_PIN = 16 # WiringPi pin 16 is GPIO15. をコメント化して、 RESET_PIN = 5 # WiringPi pin 5 is BCM GPIO24. DC_PIN = 4 # WiringPi pin 4 is BCM GPIO23. を追加します。修正後は下記の様になります。

#include <stdio.h>
#include <stdint.h>
#include <pigpio.h>
int main(int argc, char *argv[])
{
int i, h;
uint16_t spi_data[]={0x1ff, 0x0, 0xaa, 0x155};
if (gpioInitialise() < 0) return -1;
h = spiOpen(0, 50000, 0x90100);
if (h < 0) return -1;
for (i=0; i<1000; i++)
{
spiWrite(h, (char *)spi_data, 4);
time_sleep(0.02);
}
spiClose(h);
gpioTerminate();
}
# GCCでコンパイル$ ./spi_9bit_text +---------------------------------------------------------+ |Sorry, you don't have permission to run this program. | |Try running as root, e.g. precede the command with sudo. | +---------------------------------------------------------+
int spiOpen(unsigned spiChan, unsigned baud, unsigned spiFlags) spiChan : 0-1 (0-2 for the auxiliary SPI device) baud : 32K-125M (values above 30M are unlikely to work) spiFlags: see below (spiFlags consists of the least significant 22 bits.) 0x90100 = 00 1001 0000 0001 0000 0000 bbbbbb R T nnnn W A u2 u1 u0 p2 p1 p0 mm bbbbbb 001001 = word size in bits (9-bit) R 0 T 0 nnnn 00000 W 0 A 1 = 0 = Standard SPI device, 1 = Auxiliary SPI. u2 u1 u0 000 p2 p1 p0 000 mm 00 int spiWrite(unsigned handle, char *buf, unsigned count) void time_sleep(double seconds)・SSD1306 0.96インチ 有機 LEDモジュール 3-wire SPIモードで動かす

Supported bits per word 8 - Normal 9 - This is supported using LoSSI mode. LoSSI mode (Low Speed Serial Interface) The LoSSI standard allows issuing of commands to peripherals (LCD) and to transfer data to and from them. LoSSI commands and parameters are 8 bits long, but an extra bit is used to indicate whether the byte is a command or parameter/data. This extra bit is set high for a data and low for a command. The resulting 9-bit value is serialized to the output. LoSSI is commonly used with MIPI DBI type C compatible LCD controllers.

sudo raspi-config 7 Advanced Options - Configure advanced settings A7 I2C - Enable/Disable automatic loading Yesを選択する。 Finishで raspi-configを終了する。 (再起動不要)
pi@raspberrypi:~ $ lsmod | grep i2c i2c_bcm2708 4834 0 i2c_dev 5859 0・Raspberry Pi3の I2C機能を有効化して 0.96インチ 有機 LEDモジュールを駆動する方法 I2C接続方式


pi@raspberrypi:~ $ i2cdetect -y 1
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: -- -- -- -- -- -- -- --
・Raspberry Pi3の I2C機能を有効化して 0.96インチ 有機 LEDモジュールを駆動する方法 I2C接続方式
cd git clone https://github.com/adafruit/Adafruit_Python_SSD1306.git cd Adafruit_Python_SSD1306 sudo python setup.py install
# Note you can change the I2C address by passing an i2c_address parameter like: disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST, i2c_address=0x3C)・Raspberry Pi3の I2C機能を有効化して 0.96インチ 有機 LEDモジュールを駆動する方法 I2C接続方式
