Posts

Showing posts with the label CircuitPython

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.54" 320x320 ST7796 SPI IPS on Waveshare ESP32-H2-Zero/CircuitPython 10.0.3

Image
1.54" 320x320 ST7796 SPI IPS on Waveshare ESP32-H2-Zero /CircuitPython 10.0.3 Currently, no official ST7796 library for CircuitPython, so we have to implement my custom ST7796_INIT_SEQUENCE and busdisplay.BusDisplay(). cpy_H2Zero_st7796_320x320.py , simple color test. """ Waveshare ESP32-H2-Zero/CircuitPython display on 1.54 inch 320x320 ST7796 SPI IPS 320x320 ST7796 LCD ESP32-H2-Zero - BL -----+ +-----=======-----+ 3V3 ---+ | |5V GPIO24| GND ---|-|-------------|GND GPIO23| +-|-------------|3V3 GPIO25| +-------------|GPIO0 GPIO22| CS -------------------|GPIO1 GPIO14| SCK -------------------|GPIO2 GPIO13| DC -------------------|GPIO3 GPIO12| MOSI -------------------|GPIO4 GPIO11| |GPIO5 GPIO10| +-----------------+ CircuitPython Libraries ...

RGB NeoPixel on CircuitPython: adafruit_led_animation and rainbowio.colorwheel()

Image
YD-ESP32-S3 N16R8 (by VCC-GND Studio) running CircuitPython 10.1.0-beta.1, to control onboard/external 8x RGB LED, using adafruit_led_animation . cpyS3_led_animation_blink.py """ YD-ESP32-S3 N16R8 (by VCC-GND Studio) running CircuitPython 10.1.0-beta.1 , to control onboard/external 8x RGB LED using adafruit_led_animation. https://coxxect.blogspot.com/2025/12/circuitpython-adafruitledanimation.html """ import board import neopixel from adafruit_led_animation.animation.blink import Blink from adafruit_led_animation.color import RED, GREEN, BLUE # Update to match the pin connected to your NeoPixels pixel_pin = board.NEOPIXEL ext_pixel_pin = board.GPIO4 # Update to match the number of NeoPixels you have connected pixel_num = 1 ext_pixel_num = 8 pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.1, auto_write=False) ext_pixels = neopixel.NeoPixel(ext_pixel_pin, ext_pixel_num, brightness=0.1, auto_write=True) blink = Blink(pixels, ...

Install and using CircUp (CircuitPython library updater) to install CircuitPython libraries

Image
CircUp (CircuitPython library updater) is a tool to manage and update libraries (modules) on a CircuitPython device. In old approach, we will download library bundle from CircuitPython Libraries , extract, and fine the libraries to upload to CircuitPython device manually. If any libraries updated, we have to do it again. With CircUp, it install and update libraries automatically.  This utility looks at all the libraries on the device and checks if they are the most recent (compared to the versions found in the most recent version of the Adafruit CircuitPython Bundle and Circuitpython Community Bundle). If the libraries are out of date, the utility helps you update them. It's suggested to install CircUp in virtualenv (Python virtual environment). This video show steps to create virtualenv in Windows 11, install CircUp in virtualenv, and install libraries on CircuitPython device using CircUp. Circup requires Python 3.5 or higher. ...

Hello Raspberry Pi Pico 2 (RP2350): first try MicroPython and CircuitPython

Image
First try MicroPython/CircuitPython on  Raspberry Pi Pico 2 (RP2350) . It's empty in fresh new Raspberry Pi Pico 2, it will power-up in Bootloader mode and RP2350 driver will appear as storage.  Download firmware: MicroPython: - Visit https://micropython.org/download/RPI_PICO2/ to download MicroPython firmware for Pico2. Both normal RP2350 and RP2350-RISCV version are available. CircuitPython: - Visit https://circuitpython.org/board/raspberry_pi_pico2/ to download CircuitPython firmware for Pico 2 by Raspberry Pi. To install MicroPython or CircuitPython firmware, simple drag the downloaded firmware (.uf2) to RP2350 driver. To enter Bootloader mode: Using BOOTSEL button: Push and hold the BOOTSEL button as you plug your Pico 2 into your computer. Using code: If your Pico 2 have already been flashed MicroPython or CircuitPython, you can make it reboot in Boot load mode using code. In MicroPython: import machine machine.bootloade...

my dev. board: Raspberry Pi Pico 2 (RP2350)

Image
My dev. board: Raspberry Pi Pico 2 (RP2350) Pinout: Links: ~  Raspberry Pi Documentation > Pico-series Microcontrollers Related Posts: ~  Hello Raspberry Pi Pico 2 (RP2350): first try MicroPython and CircuitPython ~  Control onboard LED of Raspberry Pi Pico 2/2W using MicroPython/CircuitPython MicroPython Exercises: ~  MicroPython code to list available I2C/SPI and default GPIO assigned ~  I2C OLED (SSD1306/SSD1315) screen with Raspberry Pi Pico 2 (RP2350) using MicroPython ~  Raspberry Pi Pico 2/MicroPython display on SPI SSD1306 OLED ~  Raspberry Pi Pico 2 (RP2350)/MicroPython display on two OLED, SSD1306 I2C and SPI . ~  Multi SSD1306 OLED, on Raspberry Pi Pico 2/MicroPython ~  Raspberry Pi Pico 2/MicroPython display on 1.54" 240x240 ST7789 SPI IPS ~  Raspberry Pi Pico 2/MicroPython read bmp images and draw on ST7789 display pixel-by-pixel ~  Raspber...

Install CircuitPython on Raspberry Pi Zero 2 W

Image
Steps to install CircuitPython 9.0.0-beta.0 on Raspberry Pi Zero 2 W . Prepare CircuitPython Firmware Visit https://circuitpython.org/downloads , search "Zero 2 W" by Raspberry Pi. Download CircuitPython 9.0.0-beta.0 > DOWNLOAD .DISK.IMG.ZIP NOW Write to microSD Write to microSD using Raspberry Pi Imager: - Raspberry Pi Device: Raspberry Pi Zero 2 W - Operating System: Use custom, select the downloaded zip file (no need un-zip) - and select Storage - Next Follow other steps as writing SD for normal Raspberry Pi. Power on Raspberry Pi 2 W in CircuitPython - Remove and insert the microSD into Raspberry Pi Zero 2 W - Connect HDMI monitor - Power on HDMI monitor - Connect Host USB to the USB port marked USB - Raspberry Pi 2 W appear as USB driver named CIRCUITPY. Run Then Run Thonny Python IDE on host computer to test it. > Run > Configure interpreter... > Select interpreter of CircuitPython and Port > OK Raspberry Pi Zero 2...

Install CircuitPython firmware on Waveshare ESP32-S3-Zero, run on Raspberry Pi OS (bookworm).

Image
With esptool installed on Raspberry Pi 5 running Raspberry Pi OS (bookworm) , this video show steps to install CircuitPython 9.0.0-beta.0 on Waveshare ESP32-S3-Zero . Visit https://circuitpython.org/downloads , search ESP32-S3-Zero. It's custom build of CircuitPython 9.0.0-beta.0 for Waveshare ESP32-S3-Zero. Download the .BIN file. Erase flash: $ esptool.py --chip esp32s3 --port <PORT> erase_flash Write flash: $ esptool.py --chip esp32s3 --port <PORT> --baud 460800 write_flash -z 0x0 <.BIN> Test Code pinmap.py """CircuitPython Essentials Pin Map Script""" import microcontroller import board import os import sys info = os.uname()[4] + "\n" + \ sys.implementation[0] + " " + os.uname()[3] print("=======================================") print(info) print("=======================================") print() board_pins = [] for pin in dir(microcontroller.pin): if ...

Install CircuitPython firmware on YD-ESP32-S3-EYE using esptool

Image
Install CircuitPython 8.2.8 firmware on YD-ESP32-S3-EYE by VCC-GND Studio using esptool, run on Linux Mint 21.2, over Windows 11/VirtualBox. Power up in BOOTLOADER mode: - Press and hold BOOT button, connect USB. Visit CircuitPython Download Page , search and download for ESP32-S3-EYE. Download .BIN of CircuitPython 8. Check CHIP/FLASH ID: esptool.py --chip auto --port <PORT> chip_id esptool.py --chip auto --port <PORT> flash_id Erase Flash:: esptool.py --chip esp32s3 --port <PORT> erase_flash Flash Firmware in .BIN: esptool.py --chip esp32s3 --port <PORT> --baud 460800 write_flash -z 0x0 <.BIN> Disconnect and connect USB again. It will run in CircuitPython. Exercises of CircuitPython run on YD-ESP32-S3-EYE: ~  YD-ESP32-S3-EYE/CircuitPython 8, control LCD and Camera .

MicroPython/CircuitPython, enter bootloader programmatically, without BOOT button.

Image
MicroPython/CircuitPython, enter bootloader programmatically, without BOOT button. (Tested on Raspberry Pi Pico) In case the Raspberry Pi Pico is flashed MicroPython : import machine machine.bootloader() In case of CircuitPython : import microcontroller microcontroller.on_next_reset(microcontroller.RunMode.BOOTLOADER) microcontroller.reset()

Flash CircuitPython firmware to ESP32-S3/C3 using esptool on Windows 11

Image
This video show steps to flash CircuitPython 8.0.5 to  Espressif ESP32-S3-DevKitC-1 , using esptool on Windows 11. Software preparation for Windows 11: - Install Python (and pip) - Install esptool - To recognize ESP32-S3-DevKitC-1 UART port, install CP210x USB driver Download CircuitPython firmware: - visit https://circuitpython.org/downloads - search ESP32-S3-DevKitC-1-N8R8, DOWNLOAD .BIN NOW To flash firmware to ESP32-S3-DevKitC-1-N8R8: - connect USB to the port marked "UART" To erase flash: esptool.py --chip esp32s3 --port <COM PORT> erase_flash To flash firmware to ESP32-S3: esptool.py --chip esp32s3 --port <COM PORT> write_flash -z 0x0 <firmware.bin> Optionally, you can check the chip ID and flash: esptool.py --chip auto --port <COM PORT> chip_id esptool.py --chip auto --port <COM PORT> flash_id Remake: ~ or using esptool instead of esptool.py. To flash firmware to Seeed Studio XIAO ESP32C3 : Download C...

CircuitPython on WeAct RP2040 Dev. Board (16M Flash)

Image
To install CircuitPython on  WeAct RP2040 Dev. Board , visit CircuitPython Download Page , search and install "WeAct Studio Pico (16MB Variant) by WeAct Studio" . Total space is reported 15 MB. Related: ~  RP2040/CircuitPython display on SH1107 SPI OLED

CircuitPython 8.0.0 Beta 5 released with one-line status bar

Image
CircuitPython 8.0.0 Beta 5 released .  A one-line status bar added to displays connection status, last exception, and version on a terminal window title or on the top line of an attached display. It need Mu 1.2.0 or Thonny 4.0.x and later to suppress status bar information in the REPL output. Currently on Linux Mint 21, the Thonny available to be installed with apt is ver 3.3.14, not the most update 4.0.1. Refer last post " Install Thonny 4.0.1 on Linux Mint 21 ". Raspberry Pi Pico W with CircuitPython 8.0.0 Beta 5, work with Thonny 4.0.1. Work on Raspberry Pi Pico with CircuitPython 8.0.0 Beta 5, one-line status bar added on top of attached display ST7789.

CircuitPython how to: Erase and re-create the CIRCUITPY filesystem

Image
In CircuitPython, calling storage.erase_filesystem() will erase and re-create the CIRCUITPY filesystem. On boards that present USB-visible CIRCUITPY drive (e.g., SAMD21 and SAMD51), then call microcontroller.reset() to restart CircuitPython and have the host computer remount CIRCUITPY. This function can be called from the REPL when CIRCUITPY has become corrupted. Warning All the data on CIRCUITPY will be lost, and CircuitPython will restart on certain boards. Just enter in REPL: import storage storage.erase_filesystem() Then, Use Stop/Restart to reconnect.

Install CircuitPython Firmware on Seeed Studio XIAO nRF52840 Sense

Image
To install CircuitPython on XIAO nRF52840 Sense is straightforward. Basically follow the steps in the guide XIAO BLE with CircuitPython . This video show how, but download firmware from CircuitPython, instead of download from Seeed Studio page. Download Firmware Visit CircuitPython Download page , Search "Seeed XIAO nRF52840 Sense by SEEED" and download firmware in .UF2 form. Enter Bootloader Mode Make XIAO nRF52840 Sense enter Bootloader Mode by double clicking on the RESET button. Install firmware Once entered Bootloader Mode, drag the downloaded firmware (.uf2) to the XIAO nRF52840 Sense drive. After installed, XIAO nRF52840 Sense will reset and CircuitPython device re-appear again as "CIRCUITPY". Then, you can test it using Thonny Python IDE. more of CircuitPython on XIAO nRF52840 Sense: ~ Erase and re-create the CIRCUITPY filesystem by calling storage.erase_filesystem() . ~ Scan I2C devices address . ~  XIAO nRF52840 Sense/Cir...

ESP32-S3-DevKitC-1/CircuitPython to drive NeoPixel, onboard and offboard.

Image
This exercise show how ESP32-S3-DevKitC-1 (running CircuitPython 7.3.2) to drive NeoPixel, onboard RGB and offboard 16 x WS2812 5050 RGB LED Square with Integrated Drivers. Please note that ESP32-S3-DevKitC-1 have two version, ver 1.0 and ver 1.1, The main difference lies in that the RGB LED is connected to different pins. On ver 1.0, my board, it's driven by GPIO48. On ver 1.1, driven by GPIO38. Adafruit CircuitPython NeoPixel library is needed. To install library, read last post " Download and install CircuitPython Library to CIRCUITPY drive's lib folder ". cpyS3_NEOPIXEL.py , drive onboard RGB. import time import neopixel import board def cycleNeopixel(wait): for r in range(255): pixel[0] = (r, 0, 0) time.sleep(wait) for r in range(255, 0, -1): pixel[0] = (r, 0, 0) time.sleep(wait) for g in range(255): pixel[0] = (0, g, 0) time.sleep(wait) for g in range(255, 0...

Download and install CircuitPython Library to CIRCUITPY drive's lib folder

Image
The CircuitPython Library Bundle contains all current libraries available for CircuitPython. This video show steps to download and install CircuitPython Library to CIRCUITPY drive's lib folder. Visit CircuitPython Libraries page ,  download the appropriate bundle for your version of CircuitPython. Unzip the file, open the resulting folder and find the lib folder. Open the lib folder and find the library files you need to load. Create a lib folder on your CIRCUITPY drive. Copy the individual library files you need to the lib folder on your CIRCUITPY drive. More details are available here . Next: ~  ESP32-S3-DevKitC-1/CircuitPython to drive NeoPixel, onboard and offboard .

Flash CircuitPython on ESP32-S3-DevKitC-1 using esptool, run on Ubuntu MATE 22.04 LTS.

Image
Flash CircuitPython 7.3.2 on ESP32-S3-DevKitC-1 using esptool, run on Ubuntu MATE 22.04 LTS . -  Install esptool    (esptool is a serial utility to communicate & flash code to Espressif chips) - Download firmware Visit CircuitPython download page . Search "S3" and download firmware for "ESP32-S3-DevKitC-1-N8R8 by Espressif". Download firmware in .bin. - Flash firmware using esptool Connect USB to the port marked "UART". Erase flash: esptool.py --port /dev/ttyUSB0 erase_flash Flash firmware: esptool.py --chip esp32s3 --port <port> write_flash -z 0x0 <firmware.bin> To run it in CircuitPython REPL, connect to the port marked "USB". remark: If you cannot connect/detect ttyUSB0, check previous post  cp210x converter now disconnected from ttyUSB0 by 'brltty', on Ubuntu MATE 22.04 LTS . Next: -  Download and install CircuitPython Library to CIRCUITPY drive's lib folder Exercise of C...