Posts

Showing posts with the label XIAO ESP32C3

Flash ESP-AT firmware to XIAO ESP32C3

Image
ESP-AT is a project based on ESP-IDF. It makes an ESP32-C3 board work as a slave, and an MCU as a host. The host MCU sends AT commands to the ESP32-C3 chip and receives AT responses back. ESP-AT provides a wide range of AT commands with different functions, such as Wi-Fi commands, TCP/IP commands, Bluetooth LE commands, Bluetooth commands, MQTT commands, HTTP commands, and Ethernet commands. (ref:  https://docs.espressif.com/projects/esp-at/en/latest/esp32c3/Get_Started/What_is_ESP-AT.html ) This video show steps to flash ESP-AT firmware to XIAO ESP32C3 using esptool in Windows 11. Then, Raspberry Pi Pico is used as USB-to-serial bridge to send and receive command with XIAO ESP32C3. Connection: In my test on XIAO ESP32C3: Download/Log output port is already established internally on the board, via USB connector. You only need to provide USB cable between the board and PC. For AT command/response port , I use TX/RX pins only: - GPIO6 (...

UART (Serial1) communication between XIAO ESP32C3 and Raspberry Pi Pico (RP2040), in Arduino framework.

Image
This exercise show UART (Serial1) communication between XIAO ESP32C3 and Raspberry Pi Pico (RP2040) , in Arduino framework. Connection:      Pico TX GP0 (pin 1) <-----> XIAO ESP32C3 RX GPIO20 (pin 8)      Pico RX GP1 (pin 2) <-----> XIAO ESP32C3 TX GPIO21 (pin 7)      Pico GND                        <-----> XIAO ESP32C3 GND Code: The main issue for this exercise is how to handle Serial1.begin() for XIAO ESP32C3. Ref: https://wiki.seeedstudio.com/XIAO_ESP32C3_Pin_Multiplexing/#serial---uart There is no Serial2 for XIAO ESP32 C3. Also If you need to use Serial1, you must define the pins; otherwise, it may not receive data. For XIAO ESP32 series, use Serial1 as follows:      Serial1.begin(115200, SERIAL_8N1, RX, TX); rp_SerialPassthrough_115200_8N1.ino /* UART/Serial1 exercise run on Raspberry Pi Pi...

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

128x160 TFT/ST7735 SPI wih EP32C3 (arduino-esp32) using Arduino_GFX Library

Image
Previous post show 3.5 inch 480x320 TFT/ILI9488 SPI wih EP32C3 (arduino-esp32) using Arduino_GFX Library , here is how it display on 1.8 inch 128x160 ST7735 SPI TFT . Both the 3.5 inch 480x320 ILI9488 SPI TFT and 1.8 inch 128x160 ST7735 SPI TFT have the same pins assignment on TFT part, keep the connection keep no change. Code: c3_st7735_test.ino , for color and resolution test. /******************************************************************************* * Exercise of Arduino_GFX, color testing. * Run on Xiao ESP32C3 + 1.8 inch 128x160 ST7735 SPI TFT ******************************************************************************/ #include <Arduino_GFX_Library.h> #define TFT_CS 5 //GPIO5 #define TFT_RESET 3 //GPIO3 #define TFT_DC 4 //GPIO4 #define TFT_MOSI 10 //GPIO10/MOSI #define TFT_SCK 8 //GPIO8/SCK #define TFT_LED 2 //GPIO2 #define TFT_MISO -1 // not used for TFT #define GFX_BL TFT_LED // backlight pin /* More data bus cl...

480x320 TFT/ILI9488 SPI wih EP32C3 (arduino-esp32) using Arduino_GFX Library

Image
Display on 3.5 inch 480x320 TFT with SPI ILI9488 (SKU:MSP3520) with XIAO EP32C3 (arduino-esp32) using Arduino_GFX Library. Install GFX Library for Arduino (Arduino_GFX) in Library Manager. Arduino_GFX is a Arduino graphics library supporting various displays with various data bus interfaces. This library start rewrite from Adafruit_GFX, LovyanGFX, TFT_eSPI, Ucglib, and more... Connection:      Connection between XIAO ESP32C3 and      3.5" 480x320 TFT with SPI ILI9488 (SKU:MSP3520)      XIAO ESP32C3                        +-------------+           +---------|GPIO2    5V      |          | +-----|GPIO3    GND    |-----------+ | +-|-----|GPIO4    3V3    |---------+ | | | | +---|GPIO5    GPIO10|-----...

Read TMP102 with XIAO ESP32-C3 (Arduino Framework)

Image
Read TMP102 with XIAO ESP32C3 (in Arduino Framework) using Temperature_LM75_Derived . Connection: TMP102 XIAO ESP32-C3 --------------------- VCC 3V3 GND GND SDA SDA/D4 SCL SCL/D5 Install I2C Temperature Sensors derived from the LM75. This library supports a large range of I²C temperature sensors based on the industry-standard LM75 package. Click on File > Examples > I2C Temperature Sensors derived from the LM75 > BasicUsage To run on ESP32C3, comment the line: while(!Serial) {} /* Read the temperature from an LM75-derived temperature sensor, and display it in Celcius every 250ms. Any LM75-derived temperature should work. */ #include <Temperature_LM75_Derived.h> // The Generic_LM75 class will provide 9-bit (±0.5°C) temperature for any // LM75-derived sensor. More specific classes may provide better resolution. Generic_LM75 temperature; void setup() { //while(!Serial) {} Serial.begin(9600); Wire.begin(); } void loop() { Serial...

XIAO nRF52840/CircuitPython implement BLE UART Service, linked with XIAO ESP32C3/Arduino BLE UART Client.

Image
  The BLE GATT Nordic UART Service (NUS) is a custom service that receives and writes data and serves as a bridge to the UART interface. ref: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/nrf/libraries/bluetooth_services/services/nus.html In this exercise, XIAO nRF52840 Sense running CircuitPython, implement BLE UART Service. cpynRF_ble.py """ Circuitpython BLE exercise Run on XIAO nRF52840 Sense/CircuitPython 8.1.0-beta.1 Provide an echo service over BLE UART. Act as BLE UART server, receive from BLE UART and echo back ref: https://learn.adafruit.com/circuitpython-ble-libraries-on-any-computer/ble-uart-example """ import os, sys import time import board, busio from adafruit_ble import BLERadio from adafruit_ble.advertising.standard import ProvideServicesAdvertisement from adafruit_ble.services.nordic import UARTService #------------------------ print("========================================") print(...

Xiao ESP32C3 (in arduino-esp32 framework) act as socket client, connect to HC-25 WiFi Module.

Image
Last post show my first test HC-25 WiFi Module, with AT Command; act as AP, setup socket server . Here is my exercise using Xiao ESP32C3 (in arduino-esp32 framework) to implement the client side: act as STA, join HC-25 WiFi network, connect to HC-25 socket server, receive and echo back in upper case. Exercise code: XiaoESP32C3_TCPclient.ino /* A simple TCP client run on ESP32-C3, * connect socket server run on HC-25 as AP. * * Have to set WAP in HC-25 using AT command: * AT+WMODE=AP * AT+WAP=myHC-25,password * * 192.168.4.1:8080 is the socket server on HC-25 */ #include <WiFi.h> // AP of HC-25 const char *ssid = "myHC-25"; const char *password = "password"; // server IP and port const IPAddress serverIP(192,168,4,1); uint16_t serverPort = 8080; WiFiClient client; void setup() { delay(200); Serial.begin(115200); delay(200); Serial.println("\n\r- Socket Client run on Xiao ESP32C3 (arduino-esp32) -"); Serial.printl...

BLE UART Communication between ESP32-C3 (Xiao ESP32C3 and NodeMCU ESP-C3-32S-Kit)

Image
The previous post show a exercise of " BLE UART Communication between XIAO ESP32C3 (client/central) and nRF52840 (server/peripheral), in Arduino Framework ". This exercise implement the server/peripheral side on NodeMCU ESP-C3-32S-Kit with SSD1331 SPI Color OLED . The client/central side, XESP32C3_BLE_client_OLED_Terminal.ino, run on XIAO ESP32C3 with SSD1306 OLED, refer to the previous exercise . ESP32C3_BLE_uart_server_SSD1331.ino, server/peripheral side on NodeMCU ESP-C3-32S-Kit with SSD1331 SPI Color OLED. /* * Modify Examples for ESP32C3 Dev Module * > ESP32 BLE Arduino * > BLE_uart * Run on NodeMCU ESP-C3-32S-Kit. * With UUID of Nordic UART Service (NUS), to work with * XESP32C3_BLE_client_OLED_Terminal run on Xiao ESP32C3. */ #include <BLEDevice.h> #include <BLEServer.h> #include <BLEUtils.h> #include <BLE2902.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1331.h> #inc...

BLE UART Communication between XIAO ESP32C3 (client/central) and nRF52840 (server/peripheral), in Arduino Framework.

Image
Last post I have a  BLE UART Peripheral run on XIAO nRF52840 Sense (in Arduino Framework) , in this post I implement client/Central side running on XIAO ESP32C3 (in Arduino Framework also), modified from  ESP32 BLE Arduino > BLE_client example. Noted that the XIAO nRF52840 Sense server/Peripheral implemented a Nordic UART Service (NUS), so we have to use the matched UUIDs in client/Central side. - Nordic UART Service (NUS) UUID (6E400001-B5A3-F393-E0A9-E50E24DCCA9E) - RX Characteristic UUID (6E400002-B5A3-F393-E0A9-E50E24DCCA9E) - TX Characteristic UUID (6E400003-B5A3-F393-E0A9-E50E24DCCA9E). XESP32C3_BLE_client.ino /* * Modify Examples for XIAO_ESP32C3 * > ESP32 BLE Arduino * > BLE_client * Run on Xiao ESP32C3. * With UUID of Nordic UART Service (NUS), to work with * XnRF52_bleuart_OLED_Terminal run on Xiao nRF52840 Sensse. * Read from Serial and send to BLE UART server/peripheral. */ /** * A BLE client example tha...

Xiao ESP32C3 display on SSD1306 128x64 OLED (I2C & SPI) using U8g2 Library

Image
Xiao ESP32C3  (arduino-esp32 framework) exercise to display 128x64 SSD1306 OLED, both I2C and SPI. Tested on  XIAO Expansion board ,  SSD1315 I2C OLED (SSD1306 compatible) and  SSD1306 SPI OLED . U8g2 Library is used to drive the OLEDs, make sure it's installed in Arduino IDE. Connection for SPI interface: OLED SPI Xiao ESP32C3 GND GND VCC 3V3 SCL GPIO8 SDA GPIO10 RST GPIO2 D/C GPIO3 for I2C interface: OLED I2C Xiao ESP32C3 GND GND VCC 3V3 SCL GPIO7 SDA GPIO6 Exercise Code: XiaoESP32C3_Serial_Terminal.ino Accept user input from Serial Monitor, and display on OLED as a terminal (U8X8LOG). /* * Read from Serial and display on * XIAO Expansion board I2C SSD1306 OLED (128x64) * using U8g2 library. * In this exercise, the OLED act as a terminal (U8X8LOG). */ #include <Arduino.h> #include <U8x8lib.h> #ifdef U8X8_HAVE_HW_SPI #include <SPI.h> #endif // U8x8 Contructor U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* reset=*...

Get info of XIAO ESP32C3 (Arduino)

Image
XiaoESP32C3_info.ino , Arduino code to read info of XIAO ESP32C3 . #include <Esp.h> void setup() { delay(500); Serial.begin(9600); delay(500); Serial.println("\n\n================================"); Serial.println("Seeed Studio XIAO ESP32C3"); Serial.println("================================"); Serial.printf("Chip Model: %s\n", ESP.getChipModel()); Serial.printf("Chip Revision: %d\n", ESP.getChipRevision()); Serial.printf("with %d core\n", ESP.getChipCores()); Serial.printf("Flash Chip Size : %d \n", ESP.getFlashChipSize()); Serial.printf("Flash Chip Speed : %d \n", ESP.getFlashChipSpeed()); esp_chip_info_t chip_info; esp_chip_info(&chip_info); Serial.printf("\nFeatures included:\n %s\n %s\n %s\n %s\n %s\n", (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded flash" : "", (chip_info.features & CHIP_FEATURE_...

Seeed Studio XIAO ESP32C3

Image
 My dev.board -  Seeed Studio XIAO ESP32C3 pinout: ref: ~  Getting Started with Seeed Studio XIAO ESP32C3 Exercise on Arduino Framework: ~  Get info of XIAO ESP32C3 ~  display on SSD1306 128x64 OLED (I2C & SPI) using U8g2 Library ~  BLE UART Communication between XIAO ESP32C3 (client/central) and nRF52840 (server/peripheral), in Arduino Framework . ~  Read TMP102 (I2C Temperature Sensors) with XIAO ESP32-C3 ~  480x320 TFT/ILI9488 SPI wih EP32C3 (arduino-esp32) using Arduino_GFX Library ~  128x160 TFT/ST7735 SPI wih EP32C3 (arduino-esp32) using Arduino_GFX Library . ~  UART (Serial1) communication between XIAO ESP32C3 and Raspberry Pi Pico (RP2040) . for CicuitPython: ~ Flash CircuitPython firmware to ESP32-S3/C3 using esptool on Windows 11 ~  ESP-NOW on CircuitPython 9.0.3, tested on ESP32-S3/ESP32-C3 . Others: ~  Flash ESP-AT firmware to XIAO ESP32C3