E-paper nameplate / sign ・ 电子纸名牌
Core2コントローラーでOLED画面に名札や掲示を表示します。
この構成をエディタで開く・編集する →| 部品 | 役割 | ポート | リンク・価格 |
|---|---|---|---|
| M5Stack Core2 | Controller | grove_i2c, grove_analog, grove_uart, mbus | official page — $46.9 |
| Unit OLED | OLED display | grove_i2c | official page — $10.95 |
M5Stack Core2とUnit OLEDで作る、名札・掲示板です。Core2の画面に加えて、別の小さなOLEDディスプレイに文字や記号を表示できます。I2C接続なので配線は1本で、プログラムで表示内容を自由に変えられます。
# M5Stack Core2 + Unit OLED (I2C)
# Wiring: Unit OLED -> Core2 red Port.A (I2C)
import time
from machine import Pin, I2C
from m5stack import lcd
# Initialize I2C on Port.A (Core2: scl=22, sda=21)
i2c = I2C(0, scl=Pin(22), sda=Pin(21), freq=400000)
# SH1107 OLED driver (address 0x3C)
# Simple framebuffer-based driver (minimal)
import framebuf
oled_width = 128
oled_height = 64
# Initialize display
fb = framebuf.FrameBuffer(bytearray(oled_width * oled_height // 8), oled_width, oled_height, framebuf.MONO_VLSB)
def oled_init():
# SH1107 init sequence
cmds = [
0xAE, # display off
0xD5, 0x80, # clock divide ratio
0xA8, 0x3F, # multiplex ratio
0xD3, 0x00, # display offset
0x40, # start line
0x8D, 0x14, # charge pump
0x20, 0x00, # memory addressing mode
0xA1, # segment remap
0xC8, # COM scan direction
0xDA, 0x12, # COM pins
0x81, 0xCF, # contrast
0xD9, 0xF1, # pre-charge
0xDB, 0x40, # VCOM detect
0xA4, # display on resume
0xA6, # normal display
0xAF, # display on
]
for cmd in cmds:
i2c.writeto(0x3C, bytes([0x00, cmd]))
def oled_show(fb):
# Send framebuffer to display
for page in range(8):
i2c.writeto(0x3C, bytes([0x00, 0xB0 + page]))
i2c.writeto(0x3C, bytes([0x00, 0x00, 0x10]))
data = bytes([0x40] + list(fb[page * oled_width:(page + 1) * oled_width]))
i2c.writeto(0x3C, data)
oled_init()
# Display text
fb.fill(0)
fb.text("Hello, World!", 0, 0, 1)
oled_show(fb)
# Also show on Core2 screen
lcd.clear()
lcd.print("Hello, World!", 10, 20)
print("Display updated")
この作り方はAIが構成から生成したものです(未検証)。通電前に配線とコードをご確認ください。
この構成はAIが実在するM5Stack部品から設計し、ポート互換をサーバで検証したものです。編集・共有できます。
エディタで開く →UnitKit は M5Stack® 製品向けの非公式ツール。作りたいものを書くと、部品リストと配線図が出ます。