Posts

Showing posts from December, 2024

Seeed Studio XIAO ESP32S3 Sense/CircuitPython display on 1.28" 240x240 GC9A01 Round IPS LCD

Image
This exercise run on  Seeed Studio XIAO ESP32S3 Sense running CircuitPython 9.2.1, to display on  1.28" 240x240 GC9A01 Round IPS LCD . Also exercises to run Turtle graphics on CircuitPython. Libraries (or modules) gc9a01, adafruit_display_text and adafruit_turtle are needed. In old approach, you can download them from  CircuitPython Libraries and copy to CircuitPython device manually. In this video, the libraries were installed using another approach CircUp. To install CircUp, read my previous post " Install and using CircUp (CircuitPython library updater) to install CircuitPython libraries ". If you use old approach to download manually, notice that gc9a01.mpy is in Community Bundle (circuitpython-community-bundle-...), not Adafruit Circuit Bundle (adafruit-circuitpython-bundle-...). Connection: Exercise Code: cpy_XS3_gc9a01_color.py , simple demo exercise with color test. """ Color test on Seeed Studio XIAO ESP32S3...

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. To create a virtualenv for circup,...

Pico 2 W/CircuitPython download bmp via WiFi, and display using OnDiskBitmap.

Image
Previous Raspberry Pi Pico 2W/CircuitPython 9 exercise display bmp in local filesystem on 1.54" IPS 240x240 with SPI ST7789 driver using displayio.OnDiskBitmap . This exercise using Pico 2 W wireless feature, download bmp via WiFi to local filesystem, then display on ST7789 LCD using OnDiskBitmap. We are going to setup a python http server on Windows 11, then Pico 2 W connect to the same WiFi network ("ssid" here) and request bmp from the http server. The simplest way to setup http server in Python is: python -m http.server Then you can reach the http server at http://[IP address]:8000/ Exercise code: cpy_pico2w_wifi_OnDiskBitmap.py """ Raspberry Pi Pico 2 W/CircuitPython 9 to display bmp on 1.54" 240x240 ST7789 SPI IPS Download bmp from wifi and display on LCD using OnDiskBitmap Connection: ----------- GND GND VCC 3V3 SCL GP18 SDA GP19 RES GP20 DC GP21 CS GP17 BLK GP22 CircuitPython Libraries Bundle for Version 9.x nee...

Set CircuitPython file system Writable, and write/read text file on CircuitPython.

Image
This code simple try to write a text file in CircuitPython file system and read back, tested on  Raspberry Pi Pico 2 W running CircuitPython 9.2.1. cpy_write_and_read_text_file.py """ CircuitPython exercise to write and read text file. Tested on Raspberry Pi Pico 2 W/CircuitPython 9.2.1 """ print("- To write hello.txt -") try: with open("/hello.txt", "w") as fp: fp.write("hello, world! from coXXect") except OSError as err: print(err) print("- To read hello.txt 0") try: with open("/hello.txt", "r") as fp: print(fp.readline()) except OSError as err: print(err) It will raise OSError of Read-only filesystem. Because by default in CircuitPython, filesystem is read-only for running code. cpy_check_vfs_readonly.py , check if the filesystem is readonly or not. """ CircuitPython code to check if Filesystem is Read Only or Writable....

displayio.OnDiskBitmap on Pico 2 W/CircuitPython 9

Image
Last post Raspberry Pi Pico 2/CircuitPython 9 exercise to display bmp on ST7789 LCD using adafruit_imageload/adafruit_slideshow , here is another method on CircuitPython to display bmp, using  displayio.OnDiskBitmap , tested on my new  Raspberry Pi Pico 2 W running CircuitPython 9.2.1. Connection, same as in last post . To prepare 240x240 bmp, read  Resize jpg and convert to bmp in RGB888 and RGB565 mode, using Python/GIMP Exercise Code: cpy_pico2w_OnDiskBitmap.py , display bmp using OnDiskBitmap() """ Raspberry Pi Pico 2/CircuitPython 9 to display on 1.54" 240x240 ST7789 SPI IPS Display bmp using OnDiskBitmap() Connection: ----------- GND GND VCC 3V3 SCL GP18 SDA GP19 RES GP20 DC GP21 CS GP17 BLK GP22 CircuitPython Libraries Bundle for Version 9.x needed: (https://circuitpython.org/libraries) - adafruit_st7789.mpy ref: displayio.OnDiskBitmap() - https://docs.circuitpython.org/en/latest/shared-bindings/displayio/index....