|
Rasperry Pi Pico |
x 1 | |
|
GC9A01 Round LCD Display with Controller Board |
x 1 |
Alastor Moody Eye using Raspberry Pi Pico, CircuitPython and Round Display GC9A01
I am developing a series of objects for a children's play about fear and terror.
And then I got inspired by Adafruit's Spooky Eyes project, using Adafruit Hallowing.
I decided to create a similar version, using the Raspberry Pi Pico and CircuitPython, to continue my learning process in the use of the board and CircuitPython.
It is still a very preliminary result, but it is already quite fun.
Pre-requisites:
First of all, I'm assuming you already have CircuitPython installed on your Raspberry Pi Pico.
If you haven't already done so, I suggest the excellent tutorial available on the Adafruit website: https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/overview
Once CircuitPython is installed on your Pico, you should be able to view it as an external hard drive, named CIRCUITPY.
On that disk, we see the lib folder and also a file called code.py. This file will be executed whenever the Raspberry Pi Pico is connected and we will edit it.
Download the library for the circular display at the link: https://github.com/tylercrumpton/CircuitPython_GC9A01 by copying the file gc9a01.py in the lib folder. Probably the other necessary libraries will already be in the lib folder, but if it doesn't, I suggest that you also download the Adafruit Circuit Python Bundle package at https://github.com/adafruit/Adafruit_CircuitPython_Bundle and copy the libraries as needed.
Create a folder called imgs on your Raspberry Pi Pico. It is in this folder that you will place the image to be displayed.
The connections:
The LCD works using the Raspberry Pi Pico SPI bus, but there is a printing error in the pin indication, which suggests that the LCD works using the I2C bus (the SDA, SCL and RES pins are indicated where they should be MOSI, SCK and RST respectively).
Then the correspondence of the calls would be as follows:
Display Pico
GND-------->GND
VCC-------->3V3
SCL(SCK)-->GP10
SDA(MOSI)>GP11
RES(RST)-->GP12
DC----------->GP13
CS----------->GP14
BLK---------->GP15
Preparing the images
First I searched the internet for an animated GIF that showed an eyeball.
I found excellent models in a search through the site: https://gifer.com/en/gifs/eye
The Raspberry Pi Pico has two limitations: RAM (264kb) and storage space (2Mb, but we are sharing it with CircuitPython itself).
So we will have to perform some optimizations on the image for everything to work.
First: resize the image to 120x120 pixels.
This display is capable of displaying 240x240, but I was unable to save files larger than 120x120 in Pico. https://ezgif.com/resize
Second, reduce the number of frames in the gif. In my case, I left with only 9 frames.
In ezgif it is also quite simple. In Optimize, choose the optimization method Remove duplicate frames. Then click on Frames and remove some interleaved frames from your gif.
Finally, generate a sprite sheet from your animated GIF. Click on Split. On that sheet, click on Gif to Sprite Sheet and check the option Stack Horizontally and then OUTPUT PNG. Click Convert to Sprite Sheet and download the image.
On your computer, use your favorite image editor to convert the image to BMP, with RGB colors. Reduce the number of colors, so that the file is as small as possible. Save the Sprites sheet in BMP format to your Raspberry Pi Pico's imgs folder.
The Code
import board import busio import displayio import adafruit_imageload # library to load our bitmap import time from gc9a01 import GC9A01 # the display library displayio.release_displays() # release any displays that are open CLK = board.GP10 # on display SCL MOSI = board.GP11 # on display SDA RST = board.GP12 # on display RES DC = board.GP13 CS = board.GP14 BLK = board.GP15 spi = busio.SPI(CLK, MOSI=MOSI) # Don't need MISO on this case. while not spi.try_lock(): # Wait until not SPI pass spi.configure(baudrate=24000000) # Configure SPI for 24MHz spi.unlock() display_bus = displayio.FourWire(spi, command=DC, chip_select=CS, reset=RST) display = GC9A01(display_bus, width=240, height=240,backlight_pin=BLK) # Make the display context splash = displayio.Group(max_size=20) zoinho_bit, zoinho_pal = adafruit_imageload.load ("/imgs/zoinho-sprite.bmp", bitmap=displayio.Bitmap, palette=displayio.Palette) zoinho_grid = displayio.TileGrid (zoinho_bit, pixel_shader=zoinho_pal, width=1, height=1, tile_height=120, tile_width=120, default_tile = 0, x=60,y=60) # Make the color at index 0 show as transparent zoinho_pal.make_transparent(0) splash.append (zoinho_grid) party = 0 p = 0 while True: if (party + 0.1) < time.monotonic(): zoinho_grid[0] = p display.show(splash) p += 1 party = time.monotonic() if p > 8: # has nine frames (0 to 8) p = 0
The Result
I must say that I was quite surprised at the simplicity of running a project with such an interesting effect. The Raspberry Pi Pico once again proves to be very versatile and combined with CircuitPython, allows us to move from sketch to implementation with great agility. Obviously there are limitations, but it inspires me to investigate other possibilities: adding an SD Card reader, or External Ram.
Alastor Moody Eye using Raspberry Pi Pico, CircuitPython and Round Display GC9A01
- Comments(4)
- Likes(2)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by nicolaudosbrinquedos
- Homeassistant in Beaglebone Black With Debian 11 Intro: The primary objective of my project was to give some use to the Beaglebone Black that has bee...
- The Adventures of Porting Circuitpython to Wio RP2040 I have been developing some electronic props solutions for Escape Rooms. And periodically I usually ...
- Simple Electronics to Escape Room Owners - Using a bunch of voltmeters with PCA9685 This is a preliminary study for an Escape Room game. My main goal was to add as many analog displays...
- Simple Electronics to Escape Room Owners - First Chapter I've been developing puzzles and artifacts for Escape Room since 2018 and most of the time, I've bee...
- Finally! Animated Eyes using Seed Xiao RP2040 This is another advance in my studies to enable a more economically viable version for the Monster M...
- Circuitpython on Seeed XIAO RP2040 Step 1: Unboxing... I2C Not Working?As soon as the card arrived, I installed the firmware version fo...
- Raspberry Pi Pico with GC9A01 Round Display using Arduino IDE and TFT-eSPI Library This is a work in progress for another one of the artifacts I used in Leonardo Cortez's "Strange Hou...
- Recreating an 80s TV with Raspberry Pi Recently I built a series of special effects for the scenography of the play "Strange House" by Leon...
- Talk to Me This project is part of an extensive research on the use of animatronics and interactive objects tha...
- Back in time! Make a Zoetrope using Arduino I'm working on a series of animated objects for a children's play and decided to build a Zoetrope, t...
- Alastor Moody Eye using Raspberry Pi Pico, CircuitPython and Round Display GC9A01 I am developing a series of objects for a children's play about fear and terror. And then I got insp...
- The Crazy Pots Game At some point on the internet I came across someone who had made a game like that, but unfortunately...
- Arduino Mastermind Game I created this little game as a hobby for my children during the Covid-19 quarantine. I had already ...
- Raspberry Pi Pico With I2C Oled Display and CircuitPython This is my first experience using this little board from Raspberry Pi Foundation.I preferred to inst...
- Raspberry Pi Pico and TFT ILI9341 with Circuit Python I decided to write another tutorial on the Raspberry Pi Pico, mainly because the card is very recent...
- Arduino Minesweeeper It was then that I found the works of Rachit Belwariar, on the page https://www.geeksforgeeks.org/cp...
-
-
-
-
-
-
3D printed Enclosure Backplate for Riden RD60xx power supplies
154 1 1 -
-