Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Do you used luma.lcd on Orange Pi Zero?

Featured Replies

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

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)

 

7 minutes ago, martinayotte said:

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

1

The free Editor Notepad++ has a special feature for this ;)

Notepad_Plus_Plus_Find_in_Files.jpg

  • Author
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.

  • Author

For connect to SPI in python, which library should I use?

Currently I used spidev. Is it correct? (Armbian_5.65_Orangepizero_Ubuntu_bionic)

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.