Page 1 of 2

Problem with drive WaveShare 2.7 inch B e-Paper

Posted: Tue Jul 14, 2020 6:10 am
by luoluo4413
Hi,
I'm trying to use MicroPython drive epaper since 3 weeks ago.
Before I post this, i have searched in the forum, and reference some idea, thanks for them.
But it still can't be run correctly on my board.Hope you can help me.

I use driver with this https://github.com/mcauser/micropython- ... er2in7b.py.
Here is the code

Code: Select all

from machine import Pin, SPI
import time
import epaper2in7b

# SPIV on ESP32

miso = Pin(19)  # Not physically connected

sck = Pin(18) # VSPICLK
mosi = Pin(23) # e-paper driver board name is Din,GPIO23
dc = Pin(22) # VSPIWP
cs = Pin(5) # VSPICS0
# rst = Pin(21) # VSPIHD,Not use Pin 21, because my board don't have pin to connect. Is there the probroem is?
rst = Pin(15)
busy = Pin(4) GPIO4
spi = SPI(2, baudrate=100000, polarity=0, phase=0, sck=sck, mosi=mosi, miso=miso)
# spi = SPI(2, baudrate=115200, polarity=1, phase=1, sck=sck, mosi=mosi, miso=miso)

e = epaper2in7b.EPD(spi, cs, dc, rst, busy)
e.init()
when init, the epaper display nothing.

Here is my ESP32 board elementary diagram.
Image
Image
Image
Image
Image
Image

Is something wrong? Or how should it be, to debug this.

Re: Drive WaveShare 2.7 inch e-Paper

Posted: Mon Jul 20, 2020 2:02 pm
by T-Wilko
Is your epaper actually a WaveShare epaper or is it some other brand? I've used Mccauser's drivers for waveshare epapers before and it worked flawlessly. Without delving too deep, triple checking the wiring that you've set up is probably the first action to take. Attaching your MCU's schematics is fine, but more important is how you've connected the MCU to the epaper.

Re: Drive WaveShare 2.7 inch e-Paper

Posted: Tue Jul 21, 2020 11:44 am
by luoluo4413
T-Wilko wrote:
Mon Jul 20, 2020 2:02 pm
Is your epaper actually a WaveShare epaper or is it some other brand? I've used Mccauser's drivers for waveshare epapers before and it worked flawlessly. Without delving too deep, triple checking the wiring that you've set up is probably the first action to take. Attaching your MCU's schematics is fine, but more important is how you've connected the MCU to the epaper.
Hi, T-Wilko
Thanks for you help.
My epaper is WaveShare, I plug this driver-board on raspberry pi in, and use waveshare's driver(https://github.com/waveshare/e-Paper/bl ... 7b_test.py) can works fine.
Here is my physycal wiring.
Image
Image
Image

Here is my code running result, without error, but the e-paper response nothing,Even with flash.
Image

Re: Drive WaveShare 2.7 inch e-Paper

Posted: Wed Jul 22, 2020 4:00 pm
by IHOXOHI
Hi Luoluo,

I tried epaper4in2 with the same board and the same library.

Maybe you could try with this pins:
sck = Pin(0)
miso = Pin(4)
mosi = Pin(2)
dc = Pin(25)
cs = Pin(5)
rst = Pin(18)
busy = Pin(19)
spi = SPI(baudrate=20000000, polarity=0, phase=0, sck=Pin(0), mosi=Pin(2), miso=Pin(4))

It works for me.

Re: Drive WaveShare 2.7 inch e-Paper

Posted: Wed Jul 22, 2020 4:03 pm
by IHOXOHI
and without the number 2 for initiate your epaper like this:
spi = SPI(baudrate=20000000, polarity=0, phase=0, sck=Pin(0), mosi=Pin(2), miso=Pin(4))

Re: Drive WaveShare 2.7 inch e-Paper

Posted: Thu Jul 23, 2020 1:28 pm
by luoluo4413
IHOXOHI wrote:
Wed Jul 22, 2020 4:03 pm
and without the number 2 for initiate your epaper like this:
spi = SPI(baudrate=20000000, polarity=0, phase=0, sck=Pin(0), mosi=Pin(2), miso=Pin(4))
Hi IHOXOHI,
Thanks for you help!
I have tested as you way,Unfortunately,It not works for me.When init(),The epaper should be flash or not?Have more simple code to test it?

Re: Drive WaveShare 2.7 inch e-Paper

Posted: Fri Jul 24, 2020 7:23 am
by IHOXOHI
You have to add afetr the line e.init():

Code: Select all

w = 400
>>> h = 300
>>> x = 0
>>> y = 0
>>> import framebuf
>>> buf = bytearray(w * h // 8)
>>> fb = framebuf.FrameBuffer(buf, w, h, framebuf.MONO_HLSB)
>>> black = 0
>>> white = 1
>>> fb.fill(white)
>>> e.display_frame(buf)
And for sure change the value of w = 400 and h=300 by yours(264 and 176?)

Enjoy!!!!

Re: Drive WaveShare 2.7 inch e-Paper

Posted: Sun Jul 26, 2020 8:26 am
by IHOXOHI
Ok, so It seems that the problem come from the spi command on esp32 implicate a mosi and miso pins, althoug there is only a din pin on your epaper.

So for me, you could try this:

Code: Select all

sck = Pin(0)
miso = Pin(4)
mosi = Pin(2)
dc = Pin(25)
cs = Pin(5)
rst = Pin(18)
busy = Pin(19)
spi = SPI(baudrate=20000000, polarity=0, phase=0, sck=Pin(0), mosi=Pin(2), miso=Pin(4))
w = 264
h = 176
x = 0
y = 0
import framebuf
buf = bytearray(w * h // 8)
fb = framebuf.FrameBuffer(buf, w, h, framebuf.MONO_HLSB)
black = 0
white = 1
fb.fill(white)
e.display_frame(buf)
You have to connect mosi pin (2) to din pin of epaper and let miso without connection with your epaper.

Maybe it could works, but not sure. If not, you have to use an other epaper with mosi and miso pin for use it on esp32. Or use an other board like pyboard with this epaper.

Re: Drive WaveShare 2.7 inch e-Paper

Posted: Mon Jul 27, 2020 4:32 am
by luoluo4413
IHOXOHI wrote:
Sun Jul 26, 2020 8:26 am
Ok, so It seems that the problem come from the spi command on esp32 implicate a mosi and miso pins, althoug there is only a din pin on your epaper.

So for me, you could try this:

Code: Select all

sck = Pin(0)
miso = Pin(4)
mosi = Pin(2)
dc = Pin(25)
cs = Pin(5)
rst = Pin(18)
busy = Pin(19)
spi = SPI(baudrate=20000000, polarity=0, phase=0, sck=Pin(0), mosi=Pin(2), miso=Pin(4))
w = 264
h = 176
x = 0
y = 0
import framebuf
buf = bytearray(w * h // 8)
fb = framebuf.FrameBuffer(buf, w, h, framebuf.MONO_HLSB)
black = 0
white = 1
fb.fill(white)
e.display_frame(buf)
You have to connect mosi pin (2) to din pin of epaper and let miso without connection with your epaper.

Maybe it could works, but not sure. If not, you have to use an other epaper with mosi and miso pin for use it on esp32. Or use an other board like pyboard with this epaper.
Hi IHOXOHI,
Thank you very much!
It worked.Even Screen doesn't display right things, But it have something to display,So excited!

Re: Drive WaveShare 2.7 inch e-Paper

Posted: Wed Aug 05, 2020 4:21 am
by luoluo4413
T-Wilko wrote:
Mon Jul 20, 2020 2:02 pm
Is your epaper actually a WaveShare epaper or is it some other brand? I've used Mccauser's drivers for waveshare epapers before and it worked flawlessly. Without delving too deep, triple checking the wiring that you've set up is probably the first action to take. Attaching your MCU's schematics is fine, but more important is how you've connected the MCU to the epaper.
@T-Wilko
I hanve tested with IHOXOHI,It Only can display white.The black and "Hello world" still can't display.
With this codes:

Code: Select all

from machine import Pin, SPI
import epaper2in7b

miso = Pin(4)
sck = Pin(0)
mosi = Pin(2)
dc = Pin(25)
cs = Pin(5)
rst = Pin(18)
busy = Pin(19)

spi = SPI(baudrate=20000000, polarity=0, phase=0, sck=Pin(0), mosi=Pin(2), miso=Pin(4))
e = epaper2in7b.EPD(spi, cs, dc, rst, busy)
e.init()

w = 264
h = 176
x = 0
y = 0


import framebuf
buf = bytearray(w * h // 8)
fb = framebuf.FrameBuffer(buf, w, h, framebuf.MONO_VLSB)
black = 0
white = 1
fb.fill(black)
fb.text('Hello world!', 0, 0,black)
e.display_frame(buf,None)
Can you help?