esptool.py is a Python-based, open source, platform independent, utility to communicate with the ROM bootloader in Espressif ESP8266 & ESP32 chips, and also ESP32-S2.
To install on Raspberry Pi (running 32 bit Raspberry Pi OS), open Terminal and enter the command:
$ sudo pip install esptool
or install Development mode, allows you to run the latest development version from this repository.
For the code, simple foreward date from SerialUSB to Serial1, and foreward Serial1 to SerialUSB.
X_USBbridge.ino
/*
Xiao act as a bridge between USB and Serial device
It's assumed the device is running 3V3
Connection
Xiao Rx - device Tx
Xiao Tx - device Rx
XIAO GND - device GND
XIAO 3V3 - device VCC
*/
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
delay(1000);
SerialUSB.begin(9600);
Serial1.begin(9600);
//wait serial ports to device
//while(SerialUSB);
while(!Serial1);
//Blink the LED 3 times to indicate program started
for(int i=0; i<3; i++){
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}
}
void loop()
{
if(SerialUSB.available() > 0){
Serial1.write(SerialUSB.read());
}
if(Serial1.available() > 0){
SerialUSB.write(Serial1.read());
}
}
This video show how it work.
Before HC-08 connected (LED blinking), You can read/write HC-08 status with AT Command. After HC-08 connected with test app on Android phone (LED on), you can send/receive text to/from the app.
To know where/how to download datasheet (with AT Command Set) and test app for HC-08, read the post "HC-08 Bluetooth Module (BLE 4.0)".
To install Seeeduino XIAO board to Arduino IDE, read the post "Seeeduino XIAO".
This can be used to access HC-04 Dual Mode BLE SPP Bluetooth Module also.