micropython-waveshare-epaper icon indicating copy to clipboard operation
micropython-waveshare-epaper copied to clipboard

esp8266+epaper2in13 do not work

Open shenbo opened this issue 4 years ago • 1 comments
trafficstars

I am try to drive epaper with esp8266, but failed...

Hardware

  • ESP 8266 C2102
  • waveshare epaper 2in13

Code

  • main.py
import epaper2in13
from machine import Pin, SPI

# EPD 2in13 8PIN
# ESP 8266 40PIN
#
# | EPD 8PIN | 8266 GPIO | 8266 PIN |                                                                   |
# | -------- | --------- | -------- | ----------------------------------------------------------------- |
# | VCC      |           |          | 3.3V                                                              |
# | GND      |           |          | GND                                                               |
# | DIN      | gpio 13   | D7       | MOSI pin of SPI interface, data transmitted from Master to Slave. |
# | CLK      | gpio 14   | D5       | SCK pin of SPI interface, clock input                             |
# | CS       | gpio 15   | D8       | Chip select pin of SPI interface, Low active                      |
# | DC       | gpio 0    | D3       | Data/Command control pin (High: Data; Low: Command)               |
# | RST      | gpio 2    | D4       | Reset pin, low active                                             |
# | BUSY     | gpio 4    | D2       | Busy pin                                                          |

spi = SPI(1, baudrate=80000000, polarity=0, phase=0)
cs = Pin(15)
dc = Pin(2)
rst = Pin(4)
busy = Pin(5)

e = epaper2in13.EPD(spi, cs, dc, rst, busy)
e.init()




w = 128
h = 250
x = 0
y = 0

# --------------------
# clear display
e.clear_frame_memory(b'\xFF')
e.display_frame()

# use a frame buffer
# 128 * 250 / 8 = 4000 - thats a lot of pixels
import framebuf
buf = bytearray(128 * 250 // 8)
fb = framebuf.FrameBuffer(buf, 128, 250, framebuf.MONO_HLSB)
black = 0
white = 1
fb.fill(white)
fb.text('Hello World',30,0,black)
fb.pixel(30, 10, black)
fb.hline(30, 30, 10, black)
fb.vline(30, 50, 10, black)
fb.line(30, 70, 40, 80, black)
fb.rect(30, 90, 10, 10, black)
fb.fill_rect(30, 110, 10, 10, black)
for row in range(0,37):
	fb.text(str(row),0,row*8,black)
fb.text('Line 36',0,288,black)
e.set_frame_memory(buf, x, y, w, h)
e.display_frame()

the code could run with no error message. but epaper has no response.

shenbo avatar Jul 21 '21 10:07 shenbo

The pinouts don't match with what you declare. For example:

# | DC | gpio 0 | D3 | Data/Command control pin (High: Data; Low: Command) | dc = Pin(2)

Should be dc = Pin(0) etc

rscmbbng avatar Mar 19 '22 21:03 rscmbbng