Jump to content

Do you used luma.lcd on Orange Pi Zero?


GLinBoy

Recommended Posts

Hi

I try use Nokia 5110 with Orange pi zero. I found this library:

https://github.com/rm-hull/luma.lcd

and try to run it on my orange pi with this tutorial:

http://codelectron.com/interface-nokia-5110-lcd-and-raspberry-pi-python/

so in python shell I add these:

>>> from luma.core.interface.serial import spi
>>> from luma.core.render import canvas
>>> from luma.lcd.device import pcd8544, st7735, uc1701x
>>> import OPi.GPIO as GPIO
>>> from luma.lcd.aux import backlight

but after add this line, I got many error that told me that library is used for Raspberry pi only:

>>> serial = spi(port=1, device=0, gpio_DC=18, gpio_RST=16)
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/luma/core/lib.py", line 23, in __rpi_gpio__
    import RPi.GPIO as GPIO
  File "/usr/local/lib/python3.6/dist-packages/RPi/GPIO/__init__.py", line 23, in <module>
    from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/luma/core/interface/serial.py", line 255, in __init__
    bitbang.__init__(self, gpio, transfer_size, DC=gpio_DC, RST=gpio_RST)
  File "/usr/local/lib/python3.6/dist-packages/luma/core/interface/serial.py", line 148, in __init__
    self._gpio = gpio or self.__rpi_gpio__()
  File "/usr/local/lib/python3.6/dist-packages/luma/core/lib.py", line 30, in __rpi_gpio__
    'GPIO access not available')
luma.core.error.UnsupportedPlatform: GPIO access not available


Now I confused because in the document they said that we can use it on orange pi zero by armbian!

 

Quote

It was originally tested with Raspbian on a rev.2 model B, with a vanilla kernel version 4.1.16+, and has subsequently been tested on Raspberry Pi (both Raspbian Jessie and Stretch) models A, B2, 3B, Zero, Zero W and OrangePi Zero (Armbian Jessie).

 

could you guide me to run Nokia 5110 LCD with orange pi zero (I prefer use python).

Edited by GLinBoy
Link to comment
Share on other sites

56 minutes ago, GLinBoy said:

 


>>> from luma.core.interface.serial import spi
>>> from luma.core.render import canvas
>>> from luma.lcd.device import pcd8544, st7735, uc1701x
>>> import OPi.GPIO as GPIO
>>> from luma.lcd.aux import backlight

Now I confused because in the document they said that we can use it on orange pi zero by armbian!

could you guide me to run Nokia 5110 LCD with orange pi zero (I prefer use python).

3

 

maybe your import of Opi.GPIO is to short?
Did you read the documentation at

https://pypi.org/project/OrangePi.GPIO/

https://opi-gpio.readthedocs.io/en/latest/api-documentation.html#importing-the-module

https://opi-gpio.readthedocs.io/en/latest/
https://opi-gpio.readthedocs.io/en/latest/install.html

 

import OPi.GPIO as GPIO
GPIO.setboard(GPIO.ZEROPLUS)
GPIO.setmode(GPIO.BOARD)
GPIO.output(5, 1)

https://www.tindie.com/products/seandepagnier/orangepi-zero-nokia-5110-lcd-hat/

http://pcbrelated.com/playing-with-orange-pi-zero-part-1/

This orangepi version is different from the raspberrypi version because the gpio connector was flipped 180 degrees.

======================================================================================================================

My LCD module has an 8 pin connector so I use a connection like below:

1 - GND: Ground
2 - BL: Backlight
3 - 3VCC: Power, 3v3
4 - CLK: Clock for SPI  -> (Orange Pi SPI-CLK pin 23)
5 - DIN: MOSI for SPI  -> (Orange Pi SPI-MOSI pin 19)
6 - DC: Data/Command -> (Orange Pi IO-3 pin 15)
7 - CE: Chips Select ->  (Orange Pi IO-0 pin 11)
8 - RST: Reset  -> (Orange Pi IO-6 pin 22)

 

Link to comment
Share on other sites

2 hours ago, martinayotte said:

it is still using "import RPi.GPIO as GPIO" .

You would have to change that with "import OPi.GPIO as GPIO" and maybe at some other places

That was. Thanks.

Now everything build successfully but LCD doesn't show anything!

2 hours ago, guidol said:

import OPi.GPIO as GPIO

GPIO.setboard(GPIO.ZEROPLUS)

GPIO.setmode(GPIO.BOARD)

GPIO.output(5, 1)

It's works perfect, But I can't handle LCD.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines