Testing the ST7735 128x160
colour TFT display on Raspberry Pi
- more notes for backup and a bad memory -
-
These notes will be upgraded at random times
This first hack is WORKING but not yet tidy, , , ,
Objective - use the display
as a general purpose display on a Raspberry Pi
I had previously used this on an Arduino here
There are many similar boards
# python
/home/pi/Python_ST7735-master/examples/fixed_text_minimal.py # portrait mode top left is x,y -> 0,0 x is horizontal across the 120 width dimension from PIL import Image from PIL import ImageDraw from PIL import ImageFont import ST7735 as TFT import Adafruit_GPIO as GPIO import Adafruit_GPIO.SPI as SPI from time import sleep WIDTH = 128 HEIGHT = 160 SPEED_HZ = 4000000 # Raspberry Pi configuration. DC = 24 RST = 25 SPI_PORT = 0 SPI_DEVICE = 0 # Create TFT LCD display class. disp = TFT.ST7735( DC, rst=RST, spi=SPI.SpiDev( SPI_PORT, SPI_DEVICE, max_speed_hz=SPEED_HZ)) ###################################################### MESSAGE = "Hello!" # Initialize display. disp.begin() #disp.clear # first fill the whole screen blue img = Image.new('RGB', (WIDTH, HEIGHT), color=(255, 0, 0)) draw = ImageDraw.Draw(img) font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 16) # top left corner is 0,0 for this portrait mode. fill is text colour # (x,y) draw.text((10, 10), MESSAGE, font=font, fill=(0, 255, 255)) disp.display(img) sleep (2) draw.text((10, 60), "2 sec later", font=font, fill=(255, 255, 255)) disp.display(img) sleep (2) draw.text((10, 100), "2 more", font=font, fill=(255, 255, 255)) disp.display(img) sleep (2) img = Image.new('RGB', (128, 60), color=(255, 255, 255)) draw = ImageDraw.Draw(img) draw.text((10, 10), "NEW", font=font, fill=(0, 0, 0)) disp.display(img) |
CONCLUSION
Runs OK. Colorful. No need to change the Linux
kernel as some sites say.
Please email me if you want to swap notes