miniPiTFT 240x135 backlight works but does not display data

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
dinglebox
 
Posts: 6
Joined: Tue Mar 16, 2021 10:51 am

miniPiTFT 240x135 backlight works but does not display data

Post by dinglebox »

I put together the pi-hole kit including this screen as my first Pi project, but I'm getting some errors. I've been chasing down errors for a while, but I'm stumped. The message I'm receiving is below, thank you for any help you can provide.

Code: Select all

Traceback (most recent call last):
  File "/home/pi/stats.py", line 29, in <module>
    spi = board.SPI()
  File "/usr/local/lib/python3.7/dist-packages/board.py", line 230, in SPI
    return busio.SPI(SCLK, MOSI, MISO)
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 186, in __init__
    self._spi = _SPI(portId)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/spi.py", line 22, in __init__
    self._spi = spi.SPI(device=(portid, 0))
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/spi.py", line 167, in __init__
    raise IOError("{} does not exist".format(device))
OSError: /dev/spidev0.0 does not exist

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: miniPiTFT 240x135 backlight works but does not display d

Post by mikeysklar »

@dinglebox,

Have you tried pinning the kernel back to a last known version 20210104? We have been having to do this with several PiTFTs.

https://learn.adafruit.com/adafruit-min ... leshooting

User avatar
lysynski
 
Posts: 8
Joined: Thu Mar 18, 2021 8:50 am

Re: miniPiTFT 240x135 backlight works but does not display d

Post by lysynski »

I'm having a similar problem but different message: it looks like a module is missing - any thoughts? Thanks for the help.

Code: Select all

me@pihole: ~ $ sudo python3 ~pi/stats.py
Traceback (most recent call last):
  File "/home/pi/stats.py", line 16, in <module>
    import adafruit_rgb_display.st7789 as st7789
ModuleNotFoundError: No module named 'adafruit_rgb_display'

User avatar
lysynski
 
Posts: 8
Joined: Thu Mar 18, 2021 8:50 am

Re: miniPiTFT 240x135 backlight works but does not display d

Post by lysynski »

Missing module installed, now getting same error. Kernel pinned as recommended - no change.... Help! Thanks

Code: Select all

Traceback (most recent call last):
  File "/home/pi/stats.py", line 29, in <module>
    spi = board.SPI()
  File "/usr/local/lib/python3.7/dist-packages/board.py", line 230, in SPI
    return busio.SPI(SCLK, MOSI, MISO)
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 186, in __init__
    self._spi = _SPI(portId)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/spi.py", line 22, in __init__
    self._spi = spi.SPI(device=(portid, 0))
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/spi.py", line 167, in __init__
    raise IOError("{} does not exist".format(device))
OSError: /dev/spidev0.0 does not exist

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: miniPiTFT 240x135 backlight works but does not display d

Post by mikeysklar »

@lysynski,
Hi, I didn't realize you were trying to run the stats. Unfortunately, you can't run the stats example while you have the kernel driver installed. If you run the installer (without any parameters) and choose uninstall, it should fix the issue.
https://github.com/adafruit/Raspberry-P ... issues/146

User avatar
lysynski
 
Posts: 8
Joined: Thu Mar 18, 2021 8:50 am

Re: miniPiTFT 240x135 backlight works but does not display d

Post by lysynski »

The kernel driver wasn't installed I did your Python Setup as shown on your site. Regardless I ran the installer without parameters and got the following

Code: Select all

sudo pip3 install
ERROR: You must give at least one requirement to install (see "pip help install")
unless you meant this

Code: Select all

install
install: missing file operand
Try 'install --help' for more information
either way it didn't work. Any other ideas? Thanks for the help.

User avatar
lysynski
 
Posts: 8
Joined: Thu Mar 18, 2021 8:50 am

Re: miniPiTFT 240x135 backlight works but does not display d

Post by lysynski »

Had to enable I2C via rasp-config, display working but had to manually execute stats.py, didn't execute with boot. Killed process and execute again (prove it wasn't a fluke) now get this

Code: Select all

python stats.py
Traceback (most recent call last):
  File "stats.py", line 8, in <module>
    import requests
ImportError: No module named requests
going to reinstall request; but why isn't it launching at boot?
sudo python3 ~pi/stats.py & added to /etc/rc.local

User avatar
lysynski
 
Posts: 8
Joined: Thu Mar 18, 2021 8:50 am

Re: miniPiTFT 240x135 backlight works but does not display d

Post by lysynski »

requests reinstall returned this

Code: Select all

sudo pip3 install requests
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.21.0)

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: miniPiTFT 240x135 backlight works but does not display d

Post by mikeysklar »

@lysynski,

The installer that was being referred to is the adafruit-pitft.py script. Melissa was suggesting re-running the following code without the additional arguments.

Code: Select all

 sudo python3 adafruit-pitft.py
https://learn.adafruit.com/adafruit-min ... -3044137-7

User avatar
lysynski
 
Posts: 8
Joined: Thu Mar 18, 2021 8:50 am

Re: miniPiTFT 240x135 backlight works but does not display d

Post by lysynski »

I won't be needing that I got it working - thanks for the help... it made me check things I didn't think of.

You wouldn't happen to have details for the stats script? I'm thinking of changing one or two of the lines when the button is press.

Thanks again.

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: miniPiTFT 240x135 backlight works but does not display d

Post by mikeysklar »

@lysynski,

What changes were necessary to get you up and running?

The source to the stats.py script is here, but I think you know that. Are you asking about how to incorporate button presses?

https://learn.adafruit.com/adafruit-min ... thon-stats

The button test code example is here:

https://learn.adafruit.com/adafruit-min ... 3044298-16

User avatar
lysynski
 
Posts: 8
Joined: Thu Mar 18, 2021 8:50 am

Re: miniPiTFT 240x135 backlight works but does not display d

Post by lysynski »

I'm not 100% sure if it was required but I tried the pinning the kernel but the display didn't come to life until after I set the SPI/I2C to be active.

Thanks for the link, I know those; what I'm looking for is a description of the calls in the script i.e. how to write different data. The code that is responsible for that is

Code: Select all

    # Shell scripts for system monitoring from here:
    # https://unix.stackexchange.com/questions/119126/command-to-display-memory-usage-disk-usage-and-cpu-load
    cmd = "hostname -I | cut -d' ' -f1"
    IP = "IP: " + subprocess.check_output(cmd, shell=True).decode("utf-8")
    cmd = "top -bn1 | grep load | awk '{printf \"CPU Load: %.2f\", $(NF-2)}'"
    CPU = subprocess.check_output(cmd, shell=True).decode("utf-8")
    cmd = "free -m | awk 'NR==2{printf \"Mem: %s/%s MB  %.2f%%\", $3,$2,$3*100/$2 }'"
    MemUsage = subprocess.check_output(cmd, shell=True).decode("utf-8")
    cmd = 'df -h | awk \'$NF=="/"{printf "Disk: %d/%d GB  %s", $3,$2,$5}\''
    Disk = subprocess.check_output(cmd, shell=True).decode("utf-8")
    cmd = "cat /sys/class/thermal/thermal_zone0/temp |  awk '{printf \"CPU Temp: %.1f C\", $(NF-0) / 1000}'"  # pylint: disable=line-too-long
    Temp = subprocess.check_output(cmd, shell=True).decode("utf-8")
I'm looking for details for this section.
Thanks

User avatar
dinglebox
 
Posts: 6
Joined: Tue Mar 16, 2021 10:51 am

Re: miniPiTFT 240x135 backlight works but does not display d

Post by dinglebox »

Hey, OP here. I'm glad the other guy got his problem solved, but I'm still not sure where to go. I'm still getting the same message as the original post, I am trying to run pi.stats

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: miniPiTFT 240x135 backlight works but does not display d

Post by mikeysklar »

@dinglebox -

Start a new thread so we can get you up and running.

User avatar
lysynski
 
Posts: 8
Joined: Thu Mar 18, 2021 8:50 am

Re: miniPiTFT 240x135 backlight works but does not display d

Post by lysynski »

dinglebox - have you enabled the SPI/I2C? Verify in raspi-config; I really think that's what did it for me.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”