LilyBot Dancing

Build Your Dancing Lilybot: Voice-Controlled Musical Robot

Project Overview

This work instruction guides you through building the project Lily~Bot Dancing through Voice Control. Lily~Bot responds to voice commands, performs a choreographed dance routine to music you upload, can be interrupted with an emergency stop, and uses a sonar sensor for basic obstacle detection.

Features:

  • Voice Control: Responds to custom voice commands (“Zora”, “Boogie”, “Freeze”, “Ping”, “Check”).
  • Dancing: Performs a multi-move dance sequence for approx. 2 minutes 53 seconds.
  • Music Integration: Toggles music module ON/OFF via relay.
  • Emergency Stop: Stops motors, music, and LEDs instantly.
  • LED Indicator: Visual cue for dance or obstacles.
  • Sonar Detection: Adjusts dance for nearby objects.
  • Music State Reset: Command to re-sync music state.

Make sure you have all these parts before you begin.
Bill of Materials (BOM) 

Software Needed

  • Computer with Arduino IDE installed
  • Small Screwdriver 
  • (Optional) Multimeter for troubleshooting voltage
  • Always disconnect power from Lily~Bot before making or changing any wiring connections.
  • Double-check all wiring before applying power. Incorrect wiring can damage components.
  • Be aware of moving parts once motors are powered. Keep fingers and loose items away from wheels.
  • Handle batteries carefully to avoid shorts.

Install Arduino to your computer

This is the step where you install Arduino to your computer, if you already have Arduino installed you may skip this step.
https://docs.arduino.cc/tutorials/uno-rev3/getting-started/

Add Music to Sound Module

This is the step where you add music of your choice to the 8M Recordable Sound Play Module.

  1. Add Battery to the Music Module
    • Find a mp3 version of the music of your choice
      • You may download this from any free music on the internet 
    • With a MicroUsb, connect the module to your computer. The module is going to show as a drive. 
    • Drag and drop the music of your choice into the drive.
      • You may delete the test music that came with the device or you may use it as your music
      • Disconnect the music module from your computer using the safe to remove device option.
    • Open the battery case and add 3 AAs battery. 
    • Test that your music is in the drive by pressing the switch button
      • The music should play once the switch is set to on.
      • If music does not play
        1. Troubleshooting 
          1. Verify that the battery is correctly placed in the battery pack 
          2. Verify that the music is installed correctly and it plays
    • Cut the 2 wires going to the switch
    • Connect one end of the wire into the one end of the connector
    • Connect another wire out of the 2nd end of the connector 
    • Connect the 2nd wire into another connector 
    • Connect a wire out of the 2nd end of the connector

Connect Sound Module to Relay

This is the step where you connect the two wires from the switch to the Relay.

  • From the wires on the connector to the Sound module, connect one of the wires on the connector to COM (Common) on the relay board and connect the other wire from the 2nd connector to the NO (Normally Open) on the relay board.

This is a CRITICAL step. The Elechouse Voice Recognition Module V3 needs to be trained with your voice for the specific commands at the exact IDs used in the code.

  1. Solder a connector to the Elechouse Voice Recognition Module V3
    • Solder the connector to the 4 pin UART connector of (Vcc, Gnd, RxD, TxD)
    • We have created soldering videos to teach you how to solder
    • You may also check online if you can find a module already soldered. 
  2. Wire the Voice Module to Lily~Bot Arduino
    • You will need a Microphone (I recommend using the Microphone that came with the device) to communicate with the module.
    • Connect the GND pin to GND on the arduino board. That is the ground pin.
    • Connect VCC to 5V 
    • Connect RxD to Digital Pin 3 of Arduino 
    • Connect TxD to Digital Pin 2 of Arduino
  3. Download the dedicated software for your Elechouse Voice Recognition Module V3 from the manufacturer’s website.
  1. Connect Lily~Bot to your computer using the USB cable.
  2. Install Arduino IDE: If you don’t have it, download and install the latest version from arduino.cc.
  3. Install VoiceRecognitionV3 Library:
    • Open Arduino IDE.
    • Go to Sketch > Include Library > Manage Libraries…
    • Search for “VoiceRecognitionV3” and install it.
  4. Verify Arduino setup
    • Select the right Arduino board, go to Tools > Board 
    • Select the right COM port Tools > Port 
  5. Train the Voice Module using sample program for training module 
    • Go to File > Examples > VoiceRecognitionV3 > vr_sample_train
  • Select the vr_sample_train and compile it
    • Compile vr_sample_train sketch 
    • Use the checkmark for compiling code.
  • Upload vr_sample_train sketch 
    • Use the right arrow to upload code.
  • Open the Serial Monitor. (Ctrl + Shift +M)
    • Make sure that the baud rate is set to 115200 and the “Newline” option is selected.
  • If everything is fine, a menu will be shown on the serial monitor like the image, with instructions on how to train and load voice command. 
  1. Train the following phrases to their corresponding Command IDs (Index Numbers):
    • ID 0: “Zora” (To Turn on)
    • ID 1: “Boogie” (To Dance)
    • ID 2: “Freeze” (To Stop)
    • ID 3: “Ping” (To Stop)
    • ID 10: “Check” (To Stop)
  2. Speak Clearly: Follow the Vr_Sample_Train instructions.
    It would direct you to train each command multiple times per ID for consistency. Speak in the same tone and volume you’ll use when operating Lilybot.
  3. Load and Test Data: After training, follow the instructions to load and test the trained data.
    • Tips: You do not have to use the words I used, just ensure you put them in the same ID location to do the same things.

Useful Voice Training Tips:

    • 1. There are bad voice commands which could not be recognized easily, such as “come on”. Change your command to get better performance if necessary.
    • Make sure your command list doesn’t contain simple-pronunciation command, such as “Hi”, Hey”. The longer, the better.
    • Make your command pronunciation different each other. The following two are not good if they are all in the same group: “There you are” “Here you are”
    • Add commands used frequently in daily life as anti-interference commands. You may only need several valid commands for your application. For example, you are building a robot car. You need “go ahead”, “turn right”, “turn left”, “stop”, etc.
  1. Prepare Lily~Bot: Using Velcro set Lily~Bot to be able to get components
  2. Mount Components:
    • Mount the HC-SR04 Sonar Sensor on the front of the robot, facing forward, clear of obstructions.
    • Mount the Voice Recognition Module in a place where its microphone can easily pick up your voice commands.
    • Mount the 8M Recordable Sound Play Module and the Relay Module in a convenient location.
    • Place the LED in a visible spot on the breadboard.

IMPORTANT: Refer to your specific component’s pin labels if they differ slightly from the common ones.

“Source Device” & “Source Pin”: Where the wire originates.

“Destination Device” & “Destination Pin”: Where the wire connects to.

“Function / Notes”: Provides a brief description of the connection’s purpose or specific details (e.g., resistor value).

Relay Terminals: IN (or SIG) for the control signal, DC+ (VCC) and DC- (GND) for power, and NO (Normally Open) and COM (Common) for the switching contacts.

Motor Driver Pins: VM for motor voltage input, VCC for logic voltage, GND for ground, AIN1/2 & BIN1/2 for motor direction, PWMA/B for motor speed.

Voice Module: Assumes the Elechouse Voice Recognition Module V3 uses SoftwareSerial on Arduino pins D2/D3.

8M Music Module: The two bare wires connected to the switch will be cut and connected to the relay’s NO and COM terminals.

 

Wiring Connections:

  • TB6612 Motor Driver:
    • VM: Connect to Arduino Vin.
    • VCC: Connect to Arduino 5V.
    • GND: Connect to Arduino GND. (Ensure all GND points on Motor driver are connected)
    • AIN1 (D13), AIN2 (D12), BIN1 (D8), BIN2 (D9): Control motor direction.
    • PWMA (D11), PWMB (D10): Control motor speed using PWM.
    • Motor A+ / A-: To one DG01D-48-1 motor.
    • Motor B+ / B-: To the other DG01D-48-1 motor.
  • Elechouse Voice Recognition Module V3:
    • 5V: To Arduino 5V.
    • GND: To Arduino GND.
    • TX: To Arduino Digital Pin 2.
    • RX: To Arduino Digital Pin 3.
  • 8M Recordable Sound Play Module:
    • 5V: To Arduino 5V.
    • GND: To Arduino GND.
    • Two Bare Wires (Pushbutton): Connect one wire to the COM terminal of the 5V Relay Module, and the other wire to the NO (Normally Open) terminal of the 5V Relay Module.
  • 1-Channel 5V Relay Module:
    • DC+ (VCC): To Arduino 5V.
    • DC- (GND): To Arduino GND.
    • IN (or SIG): To Arduino Analog Pin A0.
    • NO (Normally Open) & COM (Common): Connect the two bare wires from the 8M Music Module here.
  • LED:
    • Connect the longer leg (Anode) of the LED to one end of the 330 Ohm resistor.
    • Connect the other end of the resistor to Arduino Digital Pin 4 (D4).
    • Connect the shorter leg (Cathode) of the LED to Arduino GND.
  • HC-SR04 Ultrasonic Sensor:
    • VCC: To Arduino 5V.
    • GND: To Arduino GND.
    • Trig: To Arduino Digital Pin 5 (D5).
    • Echo: To Arduino Digital Pin 6 (D6).
  • Motor Battery Pack:
    • Already powered by Lily~Bot

Download Wiremap and other neccessary Documentation here: 
https://github.com/STEAMDivas/LilyBot-Dancing

  1. Copy the Code: Copy the full Arduino code provided into a new sketch in the Arduino IDE.
  1. Connect your Lily~Bot to your computer using the USB cable.
  2. In Arduino IDE, select Tools > Board > Arduino Uno.
  3. Select Tools > Port > (Your Arduino Uno’s COM Port).
  4. Click the Upload button (right arrow icon).
  5. Wait for “Done uploading.”

IMPORTANT: Perform these steps carefully before full operation.

    1. Initial Music Module State: Manually ensure your 8M Recordable Sound Play Module is OFF.
      If the music is on, press the switch to turn it off. If the switch is already cut off,  briefly short the two bare wires together. This is mimicking the switch. 
      If you have already connected the wires to the relay, remove the wires from the COM and NO and short them.
      This ensures the musicIsOn flag in the Arduino code starts in sync.
    2. Power On Arduino: Connect your Arduino Uno to its power source (USB or external DC jack).
    3. Open Serial Monitor: In Arduino IDE, go to Tools > Serial Monitor. Set the baud rate to 9600. You should see “Lilybot Init…” and “Ready!” messages.
    4. Test Voice Recognition (without movement):
      • Say “Zora”. You won’t see much output on Serial, but Lilybot’s LED might momentarily flicker (if it was OFF for idle sonar check) and then turn OFF. The motors won’t run. This is just a test of VR.
      • Say “Freeze”.
    5. Test Music Toggle (Relay):
      • Say “Ping” (the phrase you trained for ID 3). You should hear a click from the relay, and your music module should toggle its state (e.g., turn ON).
      • Say “Ping” again. You should hear another click, and the music should toggle again (e.g., turn OFF).
      • If this isn’t working: Recheck relay wiring (COM/NO), ensure it’s a 5V relay, and verify the correct pin (A0) is connected.
    6. Test Motors: In the code, find the VOICE_ZORA case in loop(). It calls setMotorSpeed(1, 150); setMotorSpeed(2, 150); delay(1000); stopMotors();. This should make Lilybot move forward for 1 second.
    7. Power Motors: Connect your motor battery pack to the TB6612 Motor Driver’s VM terminal and GND.
    8. Test Sonar & LED (Idle):
      • With Lilybot powered but not dancing, place your hand within 15cm of the sonar sensor. The LED (D4) should turn ON.
      • Remove your hand; the LED should turn OFF.
    9. Full System Test:
      • Ensure music module is OFF.
      • Say “Boogie” (your dance command).
        • Music should start playing.
        • LED should turn ON.
        • Lilybot should start dancing.
      • During the dance, say “Freeze” (your emergency stop command).
        • Lilybot should stop immediately.
        • Music should stop.
        • LED should turn OFF.
      • If the dance completes its full duration, Lilybot should stop gracefully, music off, LED off.
  1. Power Up: Connect Arduino to power, then connect the motor battery to the TB6612 driver.
  2. Initial State Check: Ensure the music module is OFF before starting Lilybot.
  3. Wake Up: Say “Zora”. (This command currently just makes Lilybot move forward briefly. You can change its action in the VOICE_ZORA case if desired).
  4. Start Dancing: Say “Boogie”. Lilybot will start dancing and playing music for approx. 2 minutes 53 seconds.
  5. Stop Dancing (Normal): Say “Freeze”, “Ping”, or “Check”. Lilybot will stop its current dance sequence, turn off music and LED.
  6. Emergency Stop: Say “Check” for an immediate, interruptive stop of all activity.
  7. Resync Music: If the music state ever gets out of sync (e.g., music is playing but Lilybot thinks it’s off), say “Ping” once. This will toggle the music module’s state and update Lilybot’s internal assumption. You might need to use it twice if it toggles to the wrong state initially.
  1. “Global Variable using 101% dynamic memory” Error:
    • The provided code is heavily optimized for SRAM. If this error still occurs, it means the VoiceRecognitionV3 library itself, combined with your robot’s features, is too large for an Arduino Uno’s 2KB SRAM.
    • Solution: You will need to either:
      • Use a simpler voice recognition module: One that outputs digital pulses or uses a very lightweight library.
      • Upgrade your Arduino board: To an Arduino Mega (8KB SRAM) or an ESP32 (much more RAM).
  2. No Voice Recognition:
    • Check Voice Module Training: Did you train all commands correctly at the specified IDs? Is the voice data saved to the module?
    • Speaking Consistency: Speak clearly, with the same tone and volume as during training. Minimize background noise.
    • Wiring: Double-check TX/RX connections between Voice Module and Arduino (Pin 2 and 3). TX to RX, RX to TX.
    • Baud Rate: Ensure myVR.begin(9600) matches the module’s baud rate (usually 9600).
    • Cooldown: Wait for the minTimeBetweenCommands (1.5 seconds) before speaking a new command.
  3. Music Not Toggling/Playing:
    • Relay Wiring: Ensure NO and COM on the relay are connected to the music module’s two bare wires.
    • Relay Power: Confirm the relay module is receiving 5V and GND from Arduino.
    • Relay Control Pin: Check Arduino A0 connection to the relay’s IN pin.
    • Relay Activation: Listen for a click from the relay when you expect the music to toggle. If no click, check relay power and Arduino A0.
    • Music Module Power: Ensure the 8M module battery is working and the switch is set to on.
    • Initial State: Did you manually ensure the music module was OFF before powering Lilybot? Use the “Ping” command.
  4. Motors Not Moving:
    • Motor Battery: Is the Lily~Bot receiving power?
    • TB6612 Power: Is the motor driver getting 5V and GND from Arduino?
    • Motor Wiring: Are motor wires correctly connected to TB6612 Motor A/B outputs?
    • Arduino Pins: Are AIN1/2, BIN1/2, PWMA/PWMB connected to the correct Arduino pins (13,12,8,9,11,10)?
    • Power source: Consider using a different power source with a higher current for your Lily~Bot than the 9V battery
  5. Robot Not Stopping (Emergency Stop):
    • Voice Recognition: Is the “Halt” command being recognized (check Serial Monitor if you temporarily re-enable the print statements).
    • delay() Duration: If your delay() calls within dance functions are still too long without checks, the robot might be unresponsive. The current code breaks them down, but review any custom additions.
    • emergencyStopActive Flag: Ensure the return; statements are present after checks within dance helper functions.
  6. Sonar Not Working:
    • Wiring: Check Trig (D5) and Echo (D6) connections.
    • Power: Ensure 5V and GND are supplied to HC-SR04.
    • Placement: Ensure no obstructions directly in front of the sensor.
  • More Complex Choreography: Expand the dance routines in lilybotDance() with more varied moves.
  • Multi-directional Sonar: Add more HC-SR04 sensors (e.g., left and right) to enable more sophisticated obstacle avoidance.
  • LED Patterns: Implement more complex LED blinking or fading patterns during different dance segments or for alerts.
  • Mobile App Control: Integrate a Bluetooth module (like HC-05) to control Lilybot from a smartphone app.
  • Pre-programmed Dances: Store multiple dance routines and use voice commands to select a specific dance.

Good luck building your Dancing Lilybot! It’s a fun and challenging project.

Required Components (Images)

Use Discount Code: STEAMDIVAS

It comes unsoldered with it’s microphone. Device would require soldering

It comes with a switch that you cut off to create bare wires for connecting to relay

Device may require soldering

You can print an easy mount on thingiverse

Any Color

You may use resistors from 220 Ohm to 1k Ohm, the size of the resistor determines the brightness of the LED, change LED value until you get the brightness level you want

Male-to-male, Male-to-female, female-to-female as needed

For connecting Sound Module Switch Wires to Relay wires

For Voice Module

For connecting Lily~Bot to computer. Depending on your computer USB port.

For connecting Lily~Bot to computer. Depending on your computer USB port.

For Lily~Bot

For Sound Module


Discover more from STEAMDivas

Subscribe to get the latest posts sent to your email.

Leave a Reply

Scroll to Top

Discover more from STEAMDivas

Subscribe now to keep reading and get access to the full archive.

Continue reading