Posts

Showing posts with the label Raspberry Pi Pico 2 W

micropython_ssd1306  on the Raspberry Pi Pico 2 to control SSD1306 OLED

Image
Installing  micropython_ssd1306  on the Raspberry Pi Pico 2 with Thonny This video explains how to install the  micropython_ssd1306  library (the SSD1306 OLED driver for MicroPython) on the Raspberry Pi Pico 2 using the Thonny Package Manager. Connect your Raspberry Pi Pico 2 (with MicroPython firmware) to your computer. Open Thonny and configure the interpreter for the Raspberry Pi Pico 2 (MicroPython). In the top menu, go to Tools > Manage packages... Search for  micropython-ssd1306  and click Install. Connection: Exercise code: # mpy_pico2_ssd1306.py # MicroPython exercise running on Raspberry Pi Pico 2 with RP2350 # to control 128x64 SSD1306 OLED. # # https://coxxect.blogspot.com/2026/10/installing-micropythonssd1306-on.html # import time from machine import Pin, I2C from ssd1306 import SSD1306_I2C from framebuf import FrameBuffer i2c = I2C(0) print(i2c) print(i2c.scan()) oled = SSD1306_I2C(128, 64, i2c) prin...

MicroPython _thread exercise

Image
The purpose of this exercise is to test the behavior of MicroPython _thread, specifically for Raspberry Pi Pico series, whether _thread.start_new_thread() can provide real multi-core parallel speedup for pure Python CPU-bound work.  Connection: mpy_thread_smp_bench.py # mpy_thread_smp_bench.py # # Purpose: # Simple MicroPython benchmark to test whether _thread.start_new_thread() # can provide real multi-core parallel speedup for pure Python CPU-bound work. # # Method: # 1. Run a CPU-bound loop in the main thread and measure the duration. # This is the single-thread baseline. # # 2. Run the same CPU-bound loop in two threads: # - one in the main thread # - one in a newly created _thread # # 3. Measure: # - duration of thread 0 # - duration of thread 1 # - total wall-clock time from starting both threads until both finish # # Interpretation: # Let single-thread duration be T. # # If the two CPU jobs run fully in...

Raspberry Pi Pico 2 W/CircuitPython 10.0.3: Load animated GIFs from MicroSD, display them on a 240*240 GC9A01 LCD using gifio.OnDiskGif.

Image
Previous posts show Basic setup of 1.28 inch 240x240 Round Display with GC9A01 SPI on Raspberry Pi Pico 2 W/CircuitPython 10.0.3  and display bmp images from SD using displayio.OnDiskBitmap()/adafruit_imageload.load()  This post shows how to display animated GIFs from MicroSD. The connection between Raspberry Pi Pico 2 W, GC9A01 LCD and the MicroSD Module refers to the last post, display bmp images from SD using displayio.OnDiskBitmap()/adafruit_imageload.load()   Ref: https://docs.circuitpython.org/en/latest/shared-bindings/gifio/index.html#gifio.OnDiskGif Exercise Code: cpy_rpPicoW_gc9a01_sd_OnDiskGif.py. Cooperate with displayio, this mode is relatively slow. """ Raspberry Pi Pico 2 W/CircuitPython 10.0.3 with 1.28" 240x240 Round GC9A01 SPI IPS LCD Display animated GIF in SD, using gifio.OnDiskGif. Cooperate with displayio, this mode is relatively slow. https://coxxect.blogspot.com/2026/02/raspberry-pi-pico-2-wcircuitpython-1003.html ref: https:...

Pico 2 W/CircuitPython 10.0.3 Display bmp images in SD, using displayio.OnDiskBitmap()/adafruit_imageload.load().

Image
Raspberry Pi Pico 2 W with CircuitPython 10.0.3, to display BMP images from an MicroSD card on a 240*240 GC9A01 Round LCD , using displayio.OnDiskBitmap() and adafruit_imageload.load(). Reference: -  displayio.OnDiskBitmap() -  adafruit_imageload.load() All bmp were resized and converted from jpg to 240*240 RGB888 bmp using FFmpeg . Connection: Raspberry Pi Pico 2 W ===================== GP28| GND | GP27| GP26| Run | GP22| ------- LCD_BLK ------------+ GND | | GP21| ------- LCD_DC ---------+ | GP20| ------- LCD_RES-------+ | | +------- SD_MISO|GP12 GP19| MOSI - SPI_SDA ----+ | | | | +----- SD_CS |GP13 GP18| SCK - SPI_SCL --+ | | | | | | |GND GND | | | | |...

CircuitPython to list files in SD

Image
CircuitPython exercise to list files in SD Connection: Raspberry Pi Pico 2 W ===================== GP28| GND | GP27| GP26| Run | GP22| GND | GP21| GP20| +------- SD_MISO|GP12 GP19| | +----- SD_CS |GP13 GP18| | | |GND GND | | | +--- SD_SCK |GP14 GP17| | | | +- SD_MOSI|GP15 GP16| | | | | +---------------+ | | | | | | | | SD Module | | | | ========= | | | | GND --- GND +-|-|-|-------- MISO | +-|-------- CLK | +-------- MOSI +------------ CS 3V3 --- 3V3 Exercise Code: cpy_rpPicoW_sd.py """ Raspberry Pi Pico 2 W/CircuitPython 10.0.3 with SD Card module. List files in SD. """ import os, sys import board...

Downloading Bitmap via WiFi with CircuitPython, Saving to Local File System, and Displaying on LCD using OnDiskBitmap.

Image
In my previous post , I demonstrated basic exercises running on the Raspberry Pi Pico 2 W with CircuitPython 10.0.3, displaying graphics on a 1.28‑inch IPS module (GC9A01 + CST816S, 240×240 round, 4‑wire SPI) . In this post, I present exercises using CircuitPython 10.0.3 on the Raspberry Pi Pico 2 W to download a bitmap via WiFi, save it to the local file system, and display it on the GC9A01 LCD using OnDiskBitmap. The BMP in my test was resized and converted from JPG to BMP(240*240 RGB888) using FFmpeg . cpy_rpPicoW_gc9a01_OnDiskBitmap_wifi.py """ Raspberry Pi Pico 2 W/CircuitPython 10.0.3 with 1.28" 240x240 Round GC9A01 SPI IPS LCD Download bmp to local file system and display it using OnDiskBitmap ~ Single bmp. In this exercise, Pico 2 W download image from web server, save it on CircuitPython local filesystem, named "image.bmp, then display it on 1.28" 240x240 Round GC9A01 SPI IPS LCD using OnDiskBitmap. https://coxxect.blogspot.com/2026/01/...

1.28" 240x240 Round Display with GC9A01 SPI, on Raspberry Pi Pico 2 W/CircuitPython 10.0.3.

Image
Exercises run on Raspberry Pi Pico 2 W /CircuitPython 10.0.3, to display on 1.28 inch IPS Module: GC9A01+CST816S 240*240(Round) 4W-SPI . Connection: Raspberry Pi Pico 2 W Run | GP22| ------- LCD_BLK ------------+ GND | | GP21| ------- LCD_DC ---------+ | GP20| ------- LCD_RES-------+ | | GP19| MOSI - SPI_SDA ----+ | | | GP18| SCK - SPI_SCL --+ | | | | GND | | | | | | GP17| SS - LCD_CS ---|-|-|-|-+ | GP16| MISO - no use | | | | | | --------+ | | | | | | | | | | | | | | | | | | GC9A01 | | | | | | | | | | | +---- BLK | | | | +------ CS | | | +-------- DC ...

Raspberry Pi Pico 2 W display on two 1.9" 170*320 ST7789 SPI LCD, using Arduino_GFX_Library, using separated SPI.

Image
Raspberry Pi Pico 2 W display on two 1.9" 170*320 ST7789 SPI LCD, using Arduino_GFX_Library, using separated SPI. In previous exercise, I used a Raspberry Pi Pico 2 W to drive two LCDs: a 2.4-inch and a 2.0-inch 240×320 ST7789 SPI IPS . Both displays shared a common SPI bus without any problems. However, when I replaced them with two 1.9-inch 170×320 ST7789 SPI LCDs , the setup did not work. Using the same code and connections, only the second LCD would turn on. To solve this, I separated the SPI connections for the two displays: the first one (on the left) is connected via Arduino_RPiPicoSPI, and the second one (on the right) is connected via Arduino_SWSPI. Updated connection: Raspberry Pi Pico 2 W      GP28| LCD2_RST -----------------+      GND | |      GP27| LCD2_DC ----------------+ |      GP26| LCD2_CS --------------+ | |      Run | ...