Posts

CircuitPython BLU UART on Seeed Studio XIAO nRF52840/ESP32S3 Sense, connect to Raspberry Pi as Serial Console.

Image
Implement CircuitPython BLU UART on Seeed Studio XIAO nRF52840 Sense / XIAO ESP32S3 Sense running CircuitPython 9.2.7. Library needed: ~ adafruit_ble To install adafruit_ble on CircuitPython device using circup: circup install adafruit_ble Read " Install and using CircUp (CircuitPython library updater) to install CircuitPython libraries " for more about CircUp. Code: cpy_ble_uart.py """ Circuitpython 9.2.7 BLE exercise Run on XIAO nRF52840 Sense/ESP32S3 Sense Act as bridge between BLE UART and UART To make it run as standalone (without REPL connection), copy to CircuitPython device, name "code.py". """ import os, sys import time import board, busio import digitalio from adafruit_ble import BLERadio from adafruit_ble.advertising.standard import ProvideServicesAdvertisement from adafruit_ble.services.nordic import UARTService #------------------------ print("========================================...

ESP32S3 (MicroPython) + MAX98357 I2S Audio Amplifier to play tones

Image
This post exercise on ESP32-S3-DevKitC-1 running MicroPython v1.24.1, to play tones using MAX98357 I2S Audio Amplifier. Connection between MAX98357 and ESP32-S3-DevKitC-1: MAX98357 ESP32-S3-DevKitC-1 ================================== VCC 3V3 GND GND MAX98357_LRC GPIO17 MAX98357_BCLK GPIO16 MAX98357_DIN GPIO15 MAX98357_GAIN GND mpy_s3_max98357.py , a simple MicroPython to play single tone on MAX98357 I2S Audio Amplifier. """ ESP32-S3-DevKitC-1 running MicroPython v1.24.1 Play single tone output to MAX98357. """ import math import array import time from machine import I2S, Pin print("Start") MAX98357_LRC = 17 MAX98357_BCLK = 16 MAX98357_DIN =15 i2s = I2S(0, sck=Pin(MAX98357_BCLK), ws=Pin(MAX98357_LRC), sd=Pin(MAX98357_DIN), mode=I2S.TX, bits=16, format=I2S.MONO, rate=44100, ibuf=44100, ) pr...

ESP32S3/MicroPython display bmp on ili9341 LCD

Image
Last post introduced setup and basic of ESP32-S3-DevKitC-1 running MicroPython v1.24.1 using 3.2" 320x240 IPS LCD (ILI9341 SPI) with Cap. Touch (FT6336U) and Micro SD Slot . This post further exercise to load 240x240 RGB888/RGB565 bmp from device/SD, display on ILI9341 LCD. Remark for ESP32-S3-DevKitC-1: For ESP32-S3-DevKitC-1 with Octal SPI flash/PSRAM memory, use the "spiram-oct" variant such as ESP32_GENERIC_S3-SPIRAM_OCT-20241129-v1.24.1.bin (ref:  https://micropython.org/download/ESP32_GENERIC_S3/ ). If use a in-correct firmware such as ESP32_GENERIC_S3-20241129-v1.24.1.bin, "MemoryError: memory allocation failed" will be raised. For boards with Octal SPI flash/PSRAM memory embedded ESP32-S3-WROOM-1/1U modules, and boards with ESP32-S3-WROOM-2 modules, the pins GPIO35, GPIO36 and GPIO37 are used for the internal communication between ESP32-S3 and SPI flash/PSRAM memory, thus not available for external use. (ref:  https://docs.espressif.c...

ILI9341/FT6336U/SD on ESP32S3/MicroPython

Image
Exercise of MicroPython v1.24.1 running on  ESP32-S3-DevKitC-1 , display on  3.2" 320x240 IPS LCD (ILI9341 SPI) with Cap. Touch (FT6336U) and Micro SD Slot . In the exercises, all the three parts of the display module have been tested: ILI9341 SPI LCD, FT6336U cap. touch, and MicroSD card slot. Connection: ESP32-S3-DevKitC-1 ILI9341 SPI display module +-----USB--UART-----+ |GND           GND | GND |GND           5V0 | |IO19 IO14| LCD_CS |IO20 IO13| LCD_RST |IO21 IO12| LCD_RS |IO47 IO11| SDI(MOSI) |IO48 IO10| SCK |IO45 IO9 | LED |IO0 IO46| |IO35 IO3 | |IO36 IO8 | SDO(MISO) |IO37 IO18| SD_CS |IO38 IO17| |IO39 IO16| |IO40 IO15| |IO41 IO7 | CTP_SCL |IO42 IO6 | CTP_RST |IO2 IO5 | CTP_SDA |IO1 IO4 | CTP_INT |IO44 RST | |IO43 3V3 | |GND 3V3 | VCC +-------------------+ Libraries: In the exercise...

CircuitPython on Pico 2 + Touch LCD, act as a HID mouse.

Image
Refer to the cpy_pico2_st7796_BusDisplay_FT6336.py exercise in last post " Use ST7796 SPI LCD on CircuitPython/Raspberry Pi Pico 2, by instancing BusDisplay object using custom init_sequence ", It simple read touch reported by adafruit_focaltouch and display a cursor on screen, no any actual function. In this exercise I will add a simple handler to detect touch action such as touch-down, touch-up, and touch-move, and finally report to PC as HID mouse function. Connection, refer to last post " Use ST7796 SPI LCD on CircuitPython/Raspberry Pi Pico 2, by instancing BusDisplay object using custom init_sequence ". To install libraries for following exercise using circup: circup install adafruit_display_text adafruit_focaltouch adafruit_hid adafruit_button Exercise Code: cpy_pico2_st7796_BusDisplay_FT6336_handler.py Before we report HID mouse function, we have to detect touch action touch-down, touch-up, and touch-move. In this code, a ...