Posts

Showing posts with the label Waveshare ESP32-S3-Zero

CircuitPython ESP-NOW: Remote control on-board RGB LED via wireless, between ESP32-S3.

Image
With previous CircuitPython  exercises of  CircuitPython/ESP-NOW and  Touch buttons on ILI9341 SPI LCD with FT6336 Cap. Touch , this exercise implement remote control on-board RGB LED wirelessly, between ESP32-S3-DevKitC-1 (sender) and Waveshare ESP32-S3-Zero (receiver). cpyS3_ili9341_FT6336_grouped_color_TouchButtons_espnow_sender.py """ ESP32-S3/CircuitPython 9.0.5 exercise, act as ESP-NOW sender, send msg to receiver to control onboard RGB, with ILI9341 SPI LCD + FT6336 cap. touch. --------------------------- Display Module: 3.2 inch IPS SPI Module ILI9341 with cap. touch FT6336U Test on: dev. board: Espressif ESP32-S3-DevKitC-1 CircuitPython: 9.0.5 Libraries needed: - adafruit_ili9341.mpy - adafruit_focaltouch.mpy - adafruit_display_text folder - adafruit_button folder - adafruit_cursorcontrol folder - adafruit_display_shapes folder (It's needed by adafruit_button, so you have to load in /lib folder.) """ import os, sys import b...

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...

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(...

3-wire 9-bit SPI ST7789 TFT with FT6236 capacitive touch on ESP32-S3-Zero/CircuitPython

Image
This video show Waveshare ESP32-S3-Zero running CircuitPython 9.0.0-beta.0 , display on 1.54" 240x240 3-wire 9-bit SPI ST7789 TFT with capacitive touch driver FT6236G . About 9-bit SPI: The display module use ST7789 driver with 3-wire SPI, no DC pin. On CircuitPython (9.0.0-beta.0 in this exercise),  if the command (DC) pin is not specified, a 9-bit SPI mode will be SIMULATED by adding a data/command bit to every bit being transmitted, and splitting the resulting data back into 8-bit bytes for transmission. The extra bits that this creates at the end are ignored by the receiving device . ref:  https://docs.circuitpython.org/en/latest/shared-bindings/fourwire/index.html#fourwire.FourWire About fourwire library: Start from  CircuitPython 9.0.0 Alpha 2 : Split off parts of displayio into multiple modules: busdisplay, fourwire, epaperdisplay, i2cdisplaybus, paralleldisplaybus. The existing displayio hierarchy will still be available 9.x.x...

Use VL53L0X (Time of Flight distance sensor) on ESP32-S3/CircuitPython

Image
The VL53L0X is a Time of Flight distance sensor contains a very tiny invisible laser source (invisible for human eyes, but can be seen by digital camera), and a matching sensor. The VL53L0X can detect the "time of flight", or how long the light has taken to bounce back to the sensor. Here is my exercise of using VL53L0X (or GY-530) on Waveshare ESP32-S3-Zero running  CircuitPython 9.0.0-beta.0 , to read VL53L0X and display on 128x64 SSD1306 I2C OLED, and control onboard RGB LED if too close. Connection: Both VL53L0X and SSD1306 OLED share the same I2C bus. VL53L0X SSD1306 I2C ESP32-S3-Zero VIN GND GND GND VCC 3V3 SCL SCL GP5 SDA SDA GP4 Exercise code: cpy_S3-Zero_I2CIO45_vl53l0x.py """ Simple exercise of using VL53L0X Distance Sensor Run on Wave ESP32-S3-Zero/CircuitPython 9.0.0-beta.0 library need: - adafruit_vl53l0x.mpy """ import board import busio import adafru...

ESP32-S3-Zero/CircuitPython read single key using keypad.Keys and control onboard RGB LED (NeoPixel)

Image
ESP32-S3-Zero/CircuitPython exercises to read single key using keypad.Keys and control onboard RGB LED (NeoPixel). neopixel is a CircuitPython NeoPixel strip driver. keypad module provides native support to scan sets of keys or buttons, connected independently to individual pins, connected to a shift register, or connected in a row-and-column matrix. (misspelled filename, it's S3) cpy_C3-Zero_RGB.py """ ESP32-S3-Zero/circuitpython 9.0.0-beta.0 exercise to control on-board RGB (NeoPixel) """ import os, sys 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, -1): pixel[0] = (0, g, 0) time.sleep(wait) for b in range(255): ...

CircuitPython I2C Scanner, run on ESP32-S3-Zero

Image
CircuitPython I2C Scanner, run on WaveShare ESP32-S3-Zero / CircuitPython 9.0.0-beta.0 . cpy_S3-Zero_I2C_Scanner.py """ CircuitPython run on ESP32-S3-Zero scan I2C devices' address """ import sys, os import board import busio SCL = board.IO1 SDA = board.IO2 i2c = busio.I2C(SCL, SDA) print("=================================================") info = sys.implementation[0] + ' ' + os.uname()[3] + '\n' + \ 'run on ' + os.uname()[4] print(info) print("I2C Scanner") print("=================================================") # wait untill i2c locked while not i2c.try_lock(): pass print([hex(x) for x in i2c.scan()]) i2c.unlock()

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 ...

Fix Waveshare ESP32-S3-Zero/Nologo ESP32C3SuperMini Serial.print() not work - enable USB CDC on Boot

Image
Waveshare ESP32-S3-Zero   does not have a USB to UART chip mounted, you need to use the USB of the ESP32-S3 as the download interface and the Log print interface, and you need to enable the USB CDC when using the Arduino IDE . ~ ref:  https://www.waveshare.com/wiki/ESP32-S3-Zero This apply to  Nologo ESP32C3SuperMini also .

my dev.board - Waveshare ESP32-S3-Zero

Image
ESP32-S3-Zero by Waveshare Product page: ~  ESP32-S3-Zero - Waveshare Wiki Pinout: Close-up view: Arduino Exercise: ~  BlinkRGB Exercise run on WaveShare ESP32-S3-Zero, in Arduino Framework ~  ESP32-S3-Zero display on 0.85 inch 128x128 LCD with GC9107 SPI driver, using Arduino_GFX . ~  Fix ESP32-S3-Zero Serial.print() not work - enable USB CDC on Boot CircuitPython: ~  Install esptool inside Virtual Environment, on Raspberry Pi 5 running 64-bit Raspberry Pi OS (bookworm) . ~  Install CircuitPython firmware on Waveshare ESP32-S3-Zero ~  CircuitPython I2C Scanner, run on ESP32-S3-Zero ~  ESP32-S3-Zero/CircuitPython Display on 128x64 SSD1306 I2C OLED ~  ESP32-S3-Zero/CircuitPython read single key using keypad.Keys and control onboard RGB LED (NeoPixel) ~  Use VL53L0X (Time of Flight distance sensor) on ESP32-S3/CircuitPython ~  3-wire 9-bit SPI ST7789 TFT with FT6236 capacitive touch...

ESP32-S3-Zero display on 0.85 inch 128x128 LCD with GC9107 SPI driver, using Arduino_GFX.

Image
This post show steps to using Waveshare ESP32-S3-Zero to display on Waveshare 0.85 inch 128x128 LCD with GC9107 SPI driver , using GFX Library for Arduino (Arduino_GFX)​. Make sure GFX Library for Arduino (Arduino_GFX) is installed in Library Manager. Connection: GC9107 ESP32-S3-Zero --------------------- VCC 3V3 GND GND DIN GP11 CLK GP12 CS GP10 DC GP9 RST GP8 BL GP7 Code for Arduino_GFX setting: //========== Arduino_GFX setting =============================================== #define TFT_DIN 11 #define TFT_CLK 12 #define TFT_CS 10 #define TFT_DC 9 #define TFT_RST 8 #define TFT_BL 7 #define GFX_BL TFT_BL // https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class#spi-1 Arduino_DataBus *bus = new Arduino_ESP32SPI(TFT_DC, TFT_CS, TFT_CLK, TFT_DIN, GFX_NOT_DEFINED /* MISO */, HSPI /* spi_num */); //https://github.com/moononournation/Arduino_GFX/wiki/Display-Class#gc9107-ips-lcd-128x128 Arduino_GFX *gfx = new Ardu...

BlinkRGB Exercise run on WaveShare ESP32-S3-Zero, in Arduino Framework

Image
BlinkRGB Exercise run on WaveShare ESP32-S3-Zero , in Arduino Framework. Open example: > File > Examples > ESP32 > GPO > BlinkRGB On ESP32-S3-Zero, onboard RGB LED is connected to GP21, change all accordingly. /* BlinkRGB Demonstrates usage of onboard RGB LED on some ESP dev boards. Calling digitalWrite(RGB_BUILTIN, HIGH) will use hidden RGB driver. RGBLedWrite demonstrates controll of each channel: void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val) WARNING: After using digitalWrite to drive RGB LED it will be impossible to drive the same pin with normal HIGH/LOW level */ //#define RGB_BRIGHTNESS 64 // Change white brightness (max 255) // the setup function runs once when you press reset or power the board #define NEOPIXEL 21 void setup() { // No need to initialize the RGB LED } // the loop function runs over and over again forever void loop() { #ifdef NEOPIXEL digitalWrite...