icon

Halloween trick or treat automata with Voice Recognition module

This time I didn’t miss the deadline for unveiling a Halloween project. Ā In this case, voice recognition, dfplayer mini and a servo motor are used to create a trick or treat automata.

Ā 

Gravity Voice Recognition Module

Ā 

Ā 

Gravity Voice Recognition module is a small device by DFRobot that can be used to add voice recognition to any Arduino, ESP and Raspberry Pi project. Some interesting features of this module are:

Ā 

. It works off line

. It comes with pre-trained commands

. It can learn new commandsĀ 

. It can be easily trainedĀ 

. Once it has been trained, a simple I2C or UART connection will give you the IDs of the commands


Ā 

What can you do with this module? You can add it to any interface instead of wiring buttons and coding bouncing.Ā 


Ā 

Functionality

Ā 


Ā 

When the button is pressed the device will start listening for ā€œtrick or threatā€ voice command.

After this point, the device will ask new questions and it will wait for answers. Some music and servo movements will be added to increase the dramatic effect.


Ā 

Ā 

Ā 

Ā 

HARDWARE LIST
1 Arduino Nano
1 Voice recognition module
1 DfPlayer Mini
1 4ohm speaker
1 SG90 Servo
1 Led button

Animated figure

Ā 

This figure was made with clay. There is a SG90 servo inside. The head is a separate part to ensure movement.

Ā 

Speech, sounds and movement

Ā 


Ā 

For the speech mp3 I have used https://elevenlabs.io/ Then I used Audacity to lower the voice pitch.

Ā 

The audio files should be placed into the microSD Ā 

Ā 

The code to play mp3 is:

Ā 

void playSound(int myId){Ā 

delay(500);

execute_CMD(0x0F,0x01,(byte)myId);Ā 

delay(500);

}


Ā 

Movement is easily obtained by sending angles to the servo motor.
Ā 

void right(){

myServo.write(160);

}

Teaching commands to the module

Ā 

The voice recognition module should be trained for new commands, since Yes/No, Trick or treat, etc are not included by default.
Ā 

Power up the module with 5v and say: ā€œHello robotā€ Then say ā€œLearning command wordā€ Now follow the instructions and repeat 3 times the following words:Ā 


Ā 

Kid

Adult

Yes

No

Trick or treat


Ā 

They will get assigned IDs from 5 to 9 and we will use those IDs from the code.


Ā 

Note: if you have uploaded the .ino code please consider that mute mode has been enabled. You can disable with:


Ā 

DF2301Q.setMuteMode(0);Ā 

Ā 

Forcing wake up word


Ā 

The Voice Recognition module, by default requires a wake up phrase like ā€œHello, robotā€Ā 

By giving that command through the code withĀ 


Ā 

DF2301Q.playByCMDID(1);


Ā 

The device will be at command mode with the front blue light turned on.

Ā 

Circuit


Ā 

Connect DFPlayer Mini TX and RX to Arduino Nano pins 10 and 11. DFPlayer Mini GND and VCC to the external 5v Power. Ā DFPlayer Mini SPK+ and SPK- to Speaker pins.


Ā 

Connect the servo motor signal to pin 12. Servo motor GND and VCC to external 5v Power


Ā 

Connect Led Button to pin 7 and GND.


Ā 

Connect Voice module to A4 and A5. GND and VCC to external 5v Power.

3d Parts

Ā 


Ā 

If you want to use the same 3d printed box I did use, download all 3d parts from https://cults3d.com/en/3d-model/game/halloween-voice-recognition-trick-or-treat and print with PLA

Ā 

Ā 

Other projects

Ā 

Interested in other projects using DFRobot parts?Ā 

Ā 

Unihiker TR808 Drum MachineĀ 

Yrigoyen ChatGPT reading news

mmWave radar alarmĀ 

Ā 

Follow me on InstagramĀ 

License
All Rights
Reserved
licensBg
1