Mini PiTFT - 135x240 Color TFT setup help

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
User avatar
tmas98
 
Posts: 9
Joined: Tue Jan 03, 2023 2:53 pm

Mini PiTFT - 135x240 Color TFT setup help

Post by tmas98 »

I am trying to setup an Adafruit Mini PiTFT - 135x240 Color TFT. I followed the instructions here:
https://learn.adafruit.com/pi-hole-ad-b ... -pi-zero-w

But, when I try to run the ~pi/stats.py script, I get this:

Code: Select all

pi@pihole:~ $ sudo python ~pi/stats.py
Traceback (most recent call last):
  File "/home/pi/stats.py", line 43, in <module>
    from board import SCL, SDA
ImportError: No module named board
I have enabled i2c and spi in the /boot/config.txt and reinstalled adafruit-circuitpython-ssd1306 and adafruit-blinka using:

Code: Select all

sudo python3 -m pip install --force-reinstall adafruit-circuitpython-ssd1306
sudo python3 -m pip install --force-reinstall adafruit-blinka
I also tried running it specifying python3:

Code: Select all

pi@pihole:~ $ sudo python3 ~pi/stats.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 176, in __probe_for_device
    self.i2c.writeto(self.device_address, b"")
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 175, in writeto
    return self._i2c.writeto(address, buffer, stop=stop)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 52, in writeto
    self._i2c_bus.write_bytes(address, buffer[start:end])
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/smbus.py", line 314, in write_bytes
    self._device.write(buf)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 182, in __probe_for_device
    self.i2c.readfrom_into(self.device_address, result)
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 165, in readfrom_into
    return self._i2c.readfrom_into(address, buffer, stop=stop)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 59, in readfrom_into
    readin = self._i2c_bus.read_bytes(address, end - start)
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/smbus.py", line 181, in read_bytes
    return self._device.read(number)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/stats.py", line 58, in <module>
    disp = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_ssd1306.py", line 245, in __init__
    self.i2c_device = i2c_device.I2CDevice(i2c, addr)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 63, in __init__
    self.__probe_for_device()
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 185, in __probe_for_device
    raise ValueError("No I2C device at address: 0x%x" % self.device_address)
ValueError: No I2C device at address: 0x3c
What am I doing wrong here?

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: Mini PiTFT - 135x240 Color TFT setup help

Post by adafruit_support_carter »

What happens if you run the Blinka test?
https://learn.adafruit.com/circuitpytho ... st-3030038

User avatar
tmas98
 
Posts: 9
Joined: Tue Jan 03, 2023 2:53 pm

Re: Mini PiTFT - 135x240 Color TFT setup help

Post by tmas98 »

Code: Select all

pi@pihole:~ $ python3 blinkatest.py
Hello blinka!
Digital IO ok!
I2C ok!
SPI ok!
done!
Just to make sure it worked, I followed the instructions for the kernel module console method.
https://learn.adafruit.com/adafruit-min ... le-install

I was able to see the console output on the screen, so I know it is functional.
I had 2 issues though:
1. I can't change the orientation. I tried changing the rotation to 90, but no luck.
2. Now the Pi will hang on reboot or shutdown so I have to manually pull the power to restart it.

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: Mini PiTFT - 135x240 Color TFT setup help

Post by adafruit_support_carter »

Try running stats.py without sudo.
https://learn.adafruit.com/adafruit-min ... thon-stats

Code: Select all

python3 stats.py

User avatar
tmas98
 
Posts: 9
Joined: Tue Jan 03, 2023 2:53 pm

Re: Mini PiTFT - 135x240 Color TFT setup help

Post by tmas98 »

I figured it out.

I didn't go far enough into the guide. There is an updated script for the Mini PiTFT and that is working great.

https://learn.adafruit.com/pi-hole-ad-b ... mini-pitft

The only issue I could not resolve was rotating the display when using the kernel module. But, I will just move forward with the python solution.

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”