Back to All Blog Posts
Tutorial β€’EltroNerd Engineering

Voice-Enabled Robot Car controlled via LoRa using VC-02

Voice-Enabled Robot Car controlled via LoRa using VC-02

πŸ€– Voice-Enabled Robot Car with VC-02 LoRa Control & OLED Display


πŸ“Œ 1. Introduction

Enhancing the previous design, an OLED display is added to the transmitter (master node) to:

  • Display the recognized voice command in real time
  • Provide visual feedback before sending the command
  • Improve usability in noisy environments

The rest of the system remains the same: voice commands recognized by VC-02 β†’ transmitted via LoRa β†’ robot car executes commands.


🎯 2. Additional Hardware for Transmitter

  • 0.96" or 1.3" OLED display (I2C, SSD1306)
  • SDA β†’ ESP32 GPIO (e.g., 21)
  • SCL β†’ ESP32 GPIO (e.g., 22)
  • 3.3V and GND

πŸ”Œ 3. Updated System Architecture

  1. Master Node (Transmitter)

    • VC-02 voice recognition module
    • OLED display for command visualization
    • LoRa module (RA-08H) for transmitting commands
  2. Robot Car Node (Slave)

    • ESP32 receives LoRa commands
    • Controls motors through motor driver
  3. Dashboard / Status (Optional)

    • Central logging of commands and robot status

πŸ“œ 4. Updated Master Node Code (ESP32 + VC-02 + OLED)

c
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <SoftwareSerial.h>
#include <LoRa.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

SoftwareSerial vc02(4, 5); // RX, TX to VC-02

void setup() {
  Serial.begin(115200);
  vc02.begin(9600);
  
  // Initialize OLED
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println("OLED init failed");
    while(true);
  }
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.println("Voice Car");
  display.display();

  // Initialize LoRa
  LoRa.begin(915E6);
}

void loop() {
  if(vc02.available()){
    String command = vc02.readStringUntil('\n');
    command.trim();
    
    // Display on OLED
    display.clearDisplay();
    display.setCursor(0,0);
    display.setTextSize(2);
    display.println("Cmd:");
    display.setTextSize(2);
    display.setCursor(0, 30);
    display.println(command);
    display.display();

    // Send via LoRa
    LoRa.beginPacket();
    LoRa.print(command);
    LoRa.endPacket();

    Serial.println("Sent Command: " + command);
    delay(1000);
  }
}

Robot Car Node (Slave)

c
#include <LoRa.h>
#define MOTOR_LEFT_FORWARD 14
#define MOTOR_LEFT_BACK 12
#define MOTOR_RIGHT_FORWARD 27
#define MOTOR_RIGHT_BACK 26

void setup() {
  Serial.begin(115200);
  LoRa.begin(915E6);
  pinMode(MOTOR_LEFT_FORWARD, OUTPUT);
  pinMode(MOTOR_LEFT_BACK, OUTPUT);
  pinMode(MOTOR_RIGHT_FORWARD, OUTPUT);
  pinMode(MOTOR_RIGHT_BACK, OUTPUT);
}

void loop() {
  int packetSize = LoRa.parsePacket();
  if(packetSize){
    String command = LoRa.readString();
    Serial.println("Received Command: " + command);

    if(command == "FORWARD"){
      digitalWrite(MOTOR_LEFT_FORWARD, HIGH);
      digitalWrite(MOTOR_RIGHT_FORWARD, HIGH);
    } 
    else if(command == "BACK"){
      digitalWrite(MOTOR_LEFT_BACK, HIGH);
      digitalWrite(MOTOR_RIGHT_BACK, HIGH);
    } 
    else if(command == "LEFT"){
      digitalWrite(MOTOR_LEFT_BACK, HIGH);
      digitalWrite(MOTOR_RIGHT_FORWARD, HIGH);
    } 
    else if(command == "RIGHT"){
      digitalWrite(MOTOR_LEFT_FORWARD, HIGH);
      digitalWrite(MOTOR_RIGHT_BACK, HIGH);
    } 
    else if(command == "STOP"){
      digitalWrite(MOTOR_LEFT_FORWARD, LOW);
      digitalWrite(MOTOR_LEFT_BACK, LOW);
      digitalWrite(MOTOR_RIGHT_FORWARD, LOW);
      digitalWrite(MOTOR_RIGHT_BACK, LOW);
    }
  }
}

πŸ”Ž Working Principle

The voice-enabled robot car with OLED feedback and LoRa control works as follows:

  1. Voice Command Recognition

    • The VC-02 module on the transmitter recognizes predefined voice commands such as β€œForward”, β€œLeft”, β€œRight”, and β€œStop”.
  2. Visual Feedback on OLED

    • The recognized command is displayed on the OLED screen in real time, providing visual confirmation before transmission.
  3. LoRa Transmission

    • The command is transmitted wirelessly via the RA-08H LoRa module from the master (transmitter) node to the robot car (slave node).
    • LoRa ensures long-range, low-power communication without Wi-Fi or Bluetooth.
  4. Command Reception and Motor Control

    • The robot car receives the command via LoRa.
    • The ESP32 interprets the command and drives the motors through a motor driver (e.g., L298N) to execute the action.
  5. Optional Feedback

    • The robot can transmit status updates (e.g., movement state, battery level) back to the master node or dashboard for monitoring.
  6. Continuous Operation

    • This process repeats, enabling real-time, voice-controlled navigation of the robot car.

🏁 Conclusion

The voice-enabled robot car with VC-02, OLED display, and LoRa control demonstrates:

  • Real-time voice-controlled navigation of a mobile robot.
  • Visual confirmation of commands via the OLED display, enhancing usability.
  • Long-range, low-power wireless communication using LoRa for remote control.
  • Integration of speech recognition, embedded control, and IoT communication in a single system.
  • Practical application for remote robotics, IoT learning, and intelligent automation projects.

This system serves as a hands-on example of combining voice recognition, visual feedback, and wireless robotics control for engineering students and IoT enthusiasts.

Try this project in your browser

Compile code and simulate hardware output with EltroNerd Cloud IDE.

Launch Cloud IDE