Posts

ESP-NOW on CircuitPython 9.0.3, tested on ESP32-S3/ESP32-C3.

Image
ESP-NOW is a kind of connectionless Wi-Fi communication protocol that is defined by Espressif. In ESP-NOW, application data is encapsulated in a vendor-specific action frame and then transmitted from one Wi-Fi device to another without connection. CircuitPython espnow module provides an interface to the ESP-NOW protocol. It's exercises of CircuitPython espnow to communicate between sender ( Waveshare ESP32-S3-Zero / Seeed Studio XIAO ESP32C3 ) and receiver ( Espressif ESP32-S3-DevKitC-1 ). In the receiver side, the receiver message are display on ILI9341 SPI LCD. For the setting of using ILI9341 SPI LCD, read  3.2" 320x240 IPS LCD (ILI9341 SPI) with Cap. Touch (FT6336) and Micro SD Slot on ESP32-S3/CircuitPython 9.0.3 . Exercise Code: cpyS3_ili9341_espnow_receiver.py , run on Espressif ESP32-S3-DevKitC-1 and display on ILI9341 SPI LCD. """ CircuitPython exercise of espnow Act as ESP-NOW receiver, display received msg/mac-ad

CircuitPython to download bmp images from web, and display on ILI9341 SPI TFT.

Image
Last post show ESP32-S3 running CircuitPython 9.0.3 to display on ILI9341 SPI LCD, detect FT6336 Cap. Touch, and load bmp from SD card using adafruit_imageload . The post show exercise to download bmp images from internet and display on ILI9341 SPI LCD. Basically, the network part follow the CircuitPython  adafruit_imageload example imageload_from_web.py . In the original example, bmp file is downloaded from https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_ImageLoad/main/examples/images/4bit.bmp . In this exercise, my own Python http server was setup on Raspberry Pi 5/64-bit Raspberry Pi OS (bookworm), to store my bmp images. Enter the command in Terminal: python3 -m http.server Or save it in a executable shell script as shown in the video. Exercise code: cpyS3_ili9341_imageload_from_web.py """ CircuitPython exercise run on ESP32-S3, to load image from web and display on ILI9341 SPI LCD. ref: https://github.com/adafruit/

3.2" 320x240 IPS LCD (ILI9341 SPI) with Cap. Touch (FT6336) and Micro SD Slot on ESP32-S3/CircuitPython 9.0.3

Image
Exercise to work with 3.2" 320x240 IPS LCD (ILI9341 SPI) with Cap. Touch (FT6336) and Micro SD Slot , on Espressif ESP32-S3-DevKitC-1 running CircuitPython 9.0.3. Connection: ESP32-S3-DevKitC-1 +---USB-----USB---+ |GND      GND | |GND      5V0 | |GPIO19      GPIO14| |GPIO20      GPIO13| |GPIO21      GPIO12| |GPIO47      GPIO11| |GPIO48      GPIO10| |GPIO45      GPIO9 | |GPIO0      GPIO46| |GPIO35      GPIO3 | |GPIO36      GPIO8 | |GPIO37      GPIO18| |GPIO38      GPIO17| LCD_CS |GPIO39      GPIO16| LCD_RST |GPIO40      GPIO15| LCD_RS |GPIO41      GPIO7 | SDI (MOSI) CTP_SCL |GPIO42      GPIO6 | SCK CTP_RST |GPIO2      GPIO5 | LED CTP_SDA |GPIO1      GPIO4 | SDO (MISO) CTP_INT |GPIO44      RST | SD_CS |GPIO43      3V3 | GND |GND      3V3 | 3V3 +-----------------+ ILI9341 Module 1 VCC 3V3 2 GND GND 3 LCD_CS GPIO17 4 LCD_RST GPIO16 5 LCD_RS

Python 3/PyQt5 + picamera2 on Raspberry Pi, list available cameras.

Image
In previous exercises of Python/PyQt5 GUI to control Raspberry Pi Camera using picamera2 lib , with camera_controls and White Balance , camera is assigned manually in Python code or command line argument. In this exercise (picam2_qt5_global.py), number of cameras attached and cameras info are retrieved by calling Picamera2.global_camera_info(), then run picam2_qt5_.py base on user selection. Code: picam2_qt5_global.py """ Python 3/PyQt5 + picamera2 List available cameras. Run picam2_qt5_.py base on user selection. """ from PyQt5.QtWidgets import (QComboBox, QMainWindow, QApplication, QWidget, QVBoxLayout, QLabel, QLineEdit, QPushButton) from PyQt5.QtCore import QProcess import sys from picamera2 import Picamera2 cameras_info = Picamera2.global_camera_info() num_of_cam = len(cameras_info) if num_of_cam == 0: print("No camera attached! Exit") exit(1) print("number of cameras: &

Take screenshots of Wayland desktops, works on Raspberry Pi OS (bookworm)

Image
grim is a command-line utility to take screenshots of Wayland desktops. It work on Raspberry Pi OS (bookworm). grim

Radar-like distance scanner on ESP32-S3/CircuitPython 9, using SG90 servo motor, VL53L0X distance sensor and SSD1306 OLED.

Image
With previous exercises of SSD1306 I2C OLED ,  VL53L0X distance sensor and SG90 servo motor run on ESP32-S3-Zero with CircuitPython 9.0.0-beta.0 installed . The following exercise implement a Radar-like distance scanner. cpy_C3-Zero_ssd1306_fb_servo_scanner.py """ CircuitPython 9.0.0-beta.0 exercise run on Waveshare ESP32-S3-Zero: - drive servo moto SG90 using adafruit_motor - detect distance using using adafruit_vl53l0x - display on SSD1306 I2C OLED using adafruit_ssd1306 lib needed: - adafruit_framebuf.mpy - adafruit_simplemath.mpy - adafruit_ssd1306.mpy - adafruit_vl53l0x.mpy - adafruit_motor folder """ import os import sys import board import busio import time import math import adafruit_ssd1306 import pwmio from adafruit_motor import servo import adafruit_vl53l0x from adafruit_simplemath import map_range # create a PWMOut object on Pin A2. pwm = pwmio.PWMOut(board.IO7, duty_cycle=2 ** 15, frequency=50) # Create a serv

CircuitPython exercise to control servo motor, run on ESP32-S3-Zero/CircuitPython 9.0.0-beta.0.

Image
CircuitPython exercise to control servo motor SG90, run on ESP32-S3-Zero / CircuitPython 9.0.0-beta.0 . cpyS3Zero-servo.py """ CircuitPython exercise to control servo motor run on ESP32-S3-Zero/CircuitPython 9.0.0-beta.0 ref: https://learn.adafruit.com/circuitpython-essentials/circuitpython-servo https://learn.adafruit.com/using-servos-with-circuitpython/circuitpython lib needed: - adafruit_motor folder Connection: (a external 5V power source is used for servo motor) Ext.5V Servo ESP32-S3-Zero ---------------------------------------- GND GND(Brown) GND +5V V+(Red) Signal(Yellow) IO7 """ import os, sys import time import board import pwmio from adafruit_motor import servo pin_signal = board.IO7 # create a PWMOut object on Pin GPIO7. pwm = pwmio.PWMOut(pin_signal, duty_cycle=2**15, frequency=50) # Create a servo object, my_servo. my_servo = servo.Servo(pwm, min_pulse=500, max_pulse=2500) print(&