Problem dfrobot voice and XIAO ESP32 C3
DENNIS.BRANDT 2026-07-16 03:02:53 61 Views1 Replies I’m having a difficult time getting Gravity: Offline Language Learning Voice Recognition Sensor for Micro: bit/Arduino / ESP32 - I2C & UART to function with the XIAO ESP32 C3 VIA Arduino.
Getting it powered is no issue but it won’t respond to voice command. Issue with configuring board maybe
An help/pointers would be great
Thanks
Sample sketch
I’m having a difficult time getting Gravity: Offline Language Learning Voice Recognition Sensor for Micro: bit/Arduino / ESP32 - I2C & UART to function with the XIAO ESP32 C3 VIA Arduino.
Getting it powered is no issue but it won’t respond to voice command. Issue with configuring board maybe
An help/pointers would be great
Thanks
Sample sketch
#include <SoftwareSerial.h>
// Define SoftwareSerial pins for the Voice Module
const int rxPin = D7; // Connects to Voice Module TX
const int txPin = D6; // Connects to Voice Module RX
SoftwareSerial voiceSerial(rxPin, txPin);
// Define Relay Pin (adjust based on your Grove Base connection)
const int relayPin = D2;
void setup() {
Serial.begin(115200);
voiceSerial.begin(9600); // Default DFRobot baud rate
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, LOW); // Relay normally OFF
}
void loop() {
// Check if the Voice Module has sent data
if (voiceSerial.available() > 0) {
int commandCode = voiceSerial.read();
Serial.print("Command received: ");
Serial.println(commandCode);
// Replace 103 and 104 with your specific DFRobot module command IDs
if (commandCode == 103) {
digitalWrite(relayPin, HIGH); // Turn Relay ON
Serial.println("Relay Activated");
}
else if (commandCode == 104) {
digitalWrite(relayPin, LOW); // Turn Relay OFF
Serial.println("Relay Deactivated");
}
}
}
Try the official DFRobot_DF2301Q library example first. This module is usually read with getCMDID(), not by reading one raw byte from SoftwareSerial.
For XIAO ESP32-C3, use hardware UART instead of SoftwareSerial:
DFRobot_DF2301Q_UART asr(&Serial1, D7, D6); // RX, T
X
Also check:
1. Set the module switch to UART mode.
2. Wire XIAO D7/RX to module TX, and XIAO D6/TX to module RX.
3. Wake the module first, then say “Turn on the light” / “Turn off the light”.
4. If UART is still troublesome, try I2C instead.
Wiki example:https://wiki.dfrobot.com/sen0539-en/docs/21330
Yx 

.jpg)