User avatar
tejpiotr
Posts: 3
Joined: Sat Jan 19, 2019 4:16 pm

2.13 epaper display problem

Sat Jan 19, 2019 4:33 pm

Hey
I have raspberry pi zero in I installed all the necessary packages indicated at https://www.waveshare.com/wiki/2.13inch_e-Paper_HAT after running the sample .py file on the screen, nothing happens and additionally the error shows:

Code: Select all

sudo python main.py
read bmp file on window
Vertical
read bmp file
Horizontal
Drawing
('traceback.format_exc():\n%s', 'Traceback (most recent call last):\n  File "main.py", line 45, in <module>\n    font15 = ImageFont.truetype(\'/usr/share/fonts/truetype/wqy/wqy-microhei.ttc\', 15)\n  File "/usr/lib/python2.7/dist-packages/PIL/ImageFont.py", line 238, in truetype\n    return FreeTypeFont(font, size, index, encoding)\n  File "/usr/lib/python2.7/dist-packages/PIL/ImageFont.py", line 127, in __init__\n    self.font = core.getfont(font, size, index, encoding)\nIOError: cannot open resource\n')

Code: Select all

Module                  Size  Used by
bnep                   11981  2
hci_uart               27218  1
btbcm                   8248  1 hci_uart
serdev                  9370  1 hci_uart
bluetooth             366986  24 hci_uart,bnep,btbcm
ecdh_generic           17649  1 bluetooth
spidev                  7220  0
brcmfmac              273230  0
brcmutil                9114  1 brcmfmac
snd_bcm2835            23253  0
snd_pcm                89686  1 snd_bcm2835
cfg80211              542402  1 brcmfmac
snd_timer              22428  1 snd_pcm
snd                    60154  3 snd_timer,snd_bcm2835,snd_pcm
rfkill                 21476  6 bluetooth,cfg80211
i2c_bcm2835             6465  0
spi_bcm2835             7456  0
uio_pdrv_genirq         3718  0
uio                     9901  1 uio_pdrv_genirq
fixed                   3033  0
i2c_bcm2708             5741  0
i2c_dev                 6674  0
ip_tables              12427  0
x_tables               22130  1 ip_tables
ipv6                  397455  18

Code: Select all

Type: Pi Zero-W, Revision: 01, Memory: 512MB, Maker: Sony 
  * Device tree is enabled.
  *--> Raspberry Pi Zero W Rev 1.1

Code: Select all

+-----+-----+---------+------+---+-Pi ZeroW-+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT0 | 1 |  3 || 4  |   |      | 5v      |     |     |
 |   3 |   9 |   SCL.1 | ALT0 | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 0 | IN   | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | IN   | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 1 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI | ALT0 | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO | ALT0 | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK | ALT0 | 0 | 23 || 24 | 1 | OUT  | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | OUT  | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+-Pi ZeroW-+---+------+---------+-----+-----+

Code: Select all

/dev/spidev0.0  /dev/spidev0.1


I am sitting on this problem for the third day and I can not deal with it. Please help!

User avatar
Paeryn
Posts: 2613
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: 2.13 epaper display problem

Sat Jan 19, 2019 8:41 pm

From the error I would say that the required font

Code: Select all

/usr/share/fonts/truetype/wqy/wqy-microhei.ttc
doesn't exist on your system (it looks to be trying to open it and failing). I can't check the code as from the link you gave the demo code is supplied in a zipped file (which I can't open on my phone), is that font file in there?
She who travels light — forgot something.

User avatar
tejpiotr
Posts: 3
Joined: Sat Jan 19, 2019 4:16 pm

Re: 2.13 epaper display problem

Sun Jan 20, 2019 3:42 pm

Thanks for the answer!
There are font files in the demo, and I do not have a font directory on raspberry.
Attachments
fonts.png
fonts.png (22.84 KiB) Viewed 757 times

R3D_Be4rD
Posts: 1
Joined: Fri Feb 08, 2019 7:59 am

Re: 2.13 epaper display problem

Fri Feb 08, 2019 8:06 am

I encountered this same issue, took me a while to get sorted but if you do a

Code: Select all

sudo apt-get install fonts-wqy-microhei
the font will be installed where it needs to be and the code should run.

User avatar
tejpiotr
Posts: 3
Joined: Sat Jan 19, 2019 4:16 pm

Re: 2.13 epaper display problem

Fri Feb 08, 2019 9:48 am

R3D_Be4rD wrote:
Fri Feb 08, 2019 8:06 am
I encountered this same issue, took me a while to get sorted but if you do a

Code: Select all

sudo apt-get install fonts-wqy-microhei
the font will be installed where it needs to be and the code should run.

Thank you for your response! I run the code again, but nothing happens on the screen :/

Return to “Interfacing (DSI, CSI, I2C, etc.)”