How to Build a Simple Arduino Voice Control System with Less than $20 Worth of Parts
Introduction
Building a voice control system with Arduino is an enjoyable electronics project that can be completed on a budget under $20. With just a few electronic components, some basic coding knowledge, and a desire to learn, you can construct your own basic voice-activated automation device.
In this guide, I will walk you through a step-by-step process on how to build a simple Arduino voice control system using inexpensive parts. I will cover:
- The components needed and where to buy them
- Assembling the circuit on a breadboard
- Installing Arduino IDE and necessary libraries
- Coding the Arduino to recognize voice commands
- Connecting the components to the Arduino
- Testing the voice control system
With just a weekend and less than $20, you can gain valuable experience working with Arduino and voice recognition modules to create your own fun electronics project. Let's get started!
Parts Needed
To build the voice control system, you will need the following main components:
-
Arduino Uno - The microcontroller board where our code will run. Can be purchased for around $10.
-
Microphone sound sensor - Detects your voice commands and inputs them to the Arduino. These are a couple dollars.
-
LEDs - For visual output. I recommend getting a pack with different colors. Just a few dollars.
-
Resistors - Current limiting resistors for the LEDs. Can get a pack for under $5.
-
Breadboard - For connecting the components. Basic ones are ~$5.
-
Jumper wires - For wiring up the circuit. You can get a pack for just a few dollars.
All these components can easily be purchased online from electronics retailers like Adafruit, SparkFun, or Amazon. Buying generic brand parts helps keep the cost low while still allowing you to build the project.
Assembling the Circuit
Once you have all the components, it's time to assemble the circuit on the breadboard.
First, insert the Arduino into the breadboard aligning with the power and ground bus strips.
Next, insert the microphone sound sensor. Connect the GND
pin to ground, VCC
to 5V, and OUT
to Analog Pin A0.
Then insert the LEDs and resistors. Connect the positive legs of the LEDs to Arduino pins ~ 2 through 7 (vary the pins for fun). Connect 220 ohm resistors between the negative legs and GND
.
Finally use jumper wires to make all necessary connections. Double check your wiring matches the circuit diagram.
Having the components neatly wired on the breadboard will allow us to later connect them to the Arduino when coding the voice control program.
Installing Arduino IDE and Libraries
With our circuit complete, let's now setup the development environment to load programs onto the Arduino board.
The main piece of software needed is the Arduino IDE. This open source program allows you to write and upload code the Arduino.
First, go to www.arduino.cc and download + install the latest version for your computer OS.
Next, you need to install the Voice Recognition V3 library. This will provide easy voice command functionality. Go to Sketch > Include Library > Manage Libraries and search to download it.
Finally, you may need to install the SerialCommand library as well, using the same menu process.
With the Arduino IDE set up and necessary libraries installed, you are ready to start coding!
Coding the Arduino
Now for the fun part - programming the Arduino to respond to voice commands!
I recommend beginning with a simple demo sketch to test the basic voice recognition. The full code is available in this GitHub repo, but I will walk through the key parts here:
```cpp
// Import libraries
include
// Create voice recognition object
VR myVR(10);
uint8_t records[7]; // save results
void setup() {
Serial.begin(9600);
// Set pins for LEDs
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
// Configure voice recognition
myVR.begin(9600);
}
void loop() {
// Detect voice and save command
int8_t r = myVR.recognize(records, 50);
if (r == 0) {
// Act based on command
switch (records[1]) {
case 1:
digitalWrite(2, HIGH); // LED on pin 2
break;
case 2:
digitalWrite(3, HIGH); // LED on pin 3
break;
// Add cases for other pins
}
}
delay(10);
}
```
Key points:
- Create a VoiceRecognition object to handle voice commands
- Set Arduino pins as OUTPUTS for the LEDs
- In
loop()
, callmyVR.recognize(records, 50)
to detect voice input - Switch on the correct LED based on the voice command recognized
With this demo script, you should be able to issue voice commands like "One", "Two", "Three" etc. and the corresponding LED will turn on!
From here, you can expand the code and add functionality for controlling motors, servos, music and more!
Connecting and Testing
You're almost there! The last step is to connect the components to the Arduino board and test out the voice control.
First, connect the Arduino to your computer with a USB cable.
Then in the Arduino IDE, select the right Board and Port.
Next upload the demo sketch to the board.
Now open the Serial Monitor at 9600 baud to see the recognition results.
Finally, issue some voice commands and see if the corresponding LEDs light up! Debug any issues with your wiring or code as needed.
Once it's working as expected, you now have a functioning DIY Arduino voice control system - congrats! You can now enhance it and add functionality to create even more complex voice-activated projects.
Summary
Building your own Arduino voice control system is an attainable and engaging electronics project. With around $20 worth of parts, some coding experience, and following this guide, you can construct a fun voice-activated device.
The key steps are:
- Obtaining components like an Arduino, microphone, LEDs, etc.
- Assembling the circuit on a breadboard
- Installing the Arduino IDE and voice recognition libraries
- Coding a simple Arduino sketch to detect voice commands
- Connecting all components to the Arduino
- Testing and debugging the system
From there, you can expand on the project to add home automation controls, robots and more that activate based on your voice.
The ability to vocally control devices is not only useful, but provides excellent practice working with Arduino, sensors and modules. I hope this guide provided a step-by-step plan to building your own budget voice recognition system with Arduino! Let me know if you have any other questions.