How to connect to multiple SSD1306 OLED Displays using Raspberry Pi GPIO I2C PIN All In One
How to connect to multiple SSD1306 OLED Displays using Raspberry Pi GPIO I2C PIN All In One
如何使用 Raspberry Pi 的 GPIO I2C PIN 连接多个 SSD1306 OLED 显示器
串联 ???
Raspberry Pi
只有一对 I2C 输出针脚, 故不可以 ❌
一对 I2C 输出针脚即使加跳线,串联了多个 SSD1306 OLED 显示屏,也无法分别控制每个显示屏;
最多也只能是多个显示屏显示完全一样的内容, 没有意义呀!
GPIO 2(SDA)
GPIO 3(SCL)
https://www.raspberrypi.com/documentation/computers/raspberry-pi.html
Raspberry Pi Pico
具有多对 I2C 输出针脚, 应该可以的 ❓
有多对 I2C 输出针脚, 理论上可以分别输出不同信号,可以分别控制不同的显示屏;
GPIO 2(SDA)
GPIO 3(SCL)
https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html
datasheets
BCM2837
https://www.raspberrypi.com/documentation/computers/processors.html#bcm2837
$ pinout
BCM2837
$ pinout
,--------------------------------.
| oooooooooooooooooooo J8 +====
| 1ooooooooooooooooooo | USB
| +====
| Pi Model 3B V1.2 |
| +----+ +====
| |D| |SoC | | USB
| |S| | | +====
| |I| +----+ |
| |C| +======
| |S| | Net
| pwr |HDMI| |I||A| +======
`-| |--------| |----|V|-------'
Revision : a22082
SoC : BCM2837
RAM : 1GB
Storage : MicroSD
USB ports : 4 (of which 0 USB3)
Ethernet ports : 1 (100Mbps max. speed)
Wi-fi : True
Bluetooth : True
Camera ports (CSI) : 1
Display ports (DSI): 1
J8:
3V3 (1) (2) 5V
GPIO2 (3) (4) 5V
GPIO3 (5) (6) GND
GPIO4 (7) (8) GPIO14
GND (9) (10) GPIO15
GPIO17 (11) (12) GPIO18
GPIO27 (13) (14) GND
GPIO22 (15) (16) GPIO23
3V3 (17) (18) GPIO24
GPIO10 (19) (20) GND
GPIO9 (21) (22) GPIO25
GPIO11 (23) (24) GPIO8
GND (25) (26) GPIO7
GPIO0 (27) (28) GPIO1
GPIO5 (29) (30) GND
GPIO6 (31) (32) GPIO12
GPIO13 (33) (34) GND
GPIO19 (35) (36) GPIO16
GPIO26 (37) (38) GPIO20
GND (39) (40) GPIO21
For further information, please refer to https://pinout.xyz/
❌
https://datasheets.raspberrypi.com/bcm2837/bcm2837-peripherals.pdf
https://datasheets.raspberrypi.com/bcm2836/bcm2836-peripherals.pdf
https://datasheets.raspberrypi.com/
✅
The underlying architecture of the BCM2837 is identical to the BCM2836.
BCM2837 的底层架构与 BCM2836
相同。
BCM2836 ARM-local peripherals
BCM2836 ARM 本地外设
https://datasheets.raspberrypi.com/bcm2836/bcm2836-peripherals.pdf
Cortex-A53 MPCore Processor Technical Reference Manual
Cortex-A53
MPCore 处理器技术参考手册
https://developer.arm.com/documentation/ddi0500/latest/
demos
pi@raspberrypi:~/OLED_Stats $
$ cat stats.py
import time
import board
import busio
import digitalio
from PIL import Image, ImageDraw, ImageFont
import adafruit_ssd1306
import subprocess
# Define the Reset Pin
oled_reset = digitalio.DigitalInOut(board.D4)
# Display Parameters
WIDTH = 128
HEIGHT = 64
BORDER = 5
# Display Refresh
LOOPTIME = 1.0
# Use for I2C.
i2c = board.I2C()
oled = adafruit_ssd1306.SSD1306_I2C(WIDTH, HEIGHT, i2c, addr=0x3C, reset=oled_reset)
# Clear display.
oled.fill(0)
oled.show()
# Create blank image for drawing.
# Make sure to create image with mode '1' for 1-bit color.
image = Image.new("1", (oled.width, oled.height))
# Get drawing object to draw on image.
draw = ImageDraw.Draw(image)
# Draw a white background
draw.rectangle((0, 0, oled.width, oled.height), outline=255, fill=255)
font = ImageFont.truetype('PixelOperator.ttf', 16)
#font = ImageFont.load_default()
while True:
# Draw a black filled box to clear the image.
draw.rectangle((0, 0, oled.width, oled.height), outline=0, fill=0)
# Shell scripts for system monitoring from here :
# https://unix.stackexchange.com/questions/119126/command-to-display-memory-usage-disk-usage-and-cpu-load
cmd = "hostname -I | cut -d\' \' -f1"
IP = subprocess.check_output(cmd, shell = True )
cmd = "top -bn1 | grep load | awk '{printf \"CPU: %.2f\", $(NF-2)}'"
CPU = subprocess.check_output(cmd, shell = True )
cmd = "free -m | awk 'NR==2{printf \"Mem: %s/%sMB %.2f%%\", $3,$2,$3*100/$2 }'"
MemUsage = subprocess.check_output(cmd, shell = True )
cmd = "df -h | awk '$NF==\"/\"{printf \"Disk: %d/%dGB %s\", $3,$2,$5}'"
Disk = subprocess.check_output(cmd, shell = True )
cmd = "vcgencmd measure_temp |cut -f 2 -d '='"
Temp = subprocess.check_output(cmd, shell = True )
# Pi Stats Display
draw.text((0, 0), "IP: " + str(IP,'utf-8'), font=font, fill=255)
draw.text((0, 16), str(CPU,'utf-8') + "LA", font=font, fill=255)
draw.text((80, 16), str(Temp,'utf-8') , font=font, fill=255)
draw.text((0, 32), str(MemUsage,'utf-8'), font=font, fill=255)
draw.text((0, 48), str(Disk,'utf-8'), font=font, fill=255)
# Display image
oled.image(image)
oled.show()
time.sleep(LOOPTIME)
"""
# Created by: Michael Klements
# For Raspberry Pi Desktop Case with OLED Stats Display
# Base on Adafruit CircuitPython & SSD1306 Libraries
# Installation & Setup Instructions
# https://www.the-diy-life.com/add-an-oled-stats-display-to-raspberry-pi-os-bullseye/
"""
refs
Raspberry Pi & 0.96 inch SSD1306 OLED display All In One
https://www.cnblogs.com/xgqfrms/p/17380248.html
©xgqfrms 2012-2025
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/17381311.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
2022-05-08 互联网之子-亚伦·斯沃茨 All In One
2022-05-08 学术论文版权归属权 All In One
2022-05-08 how to use GitHub gist as an npm module All In One
2022-05-08 npx & gist & npm package All In One
2022-05-08 食品工厂 All In One
2021-05-08 window.VUE_ROUTER
2021-05-08 js debounce in action