Building a voice-controlled LED light strip with Arduino is an easy and fun DIY smart home project that can be done on a budget. With just a few affordable components, you can make your own custom voice assistant to control colorful lighting in your home.
Introduction
A voice-controlled LED strip allows you to change the color and brightness of the lights with simple voice commands. This is achieved using an Arduino microcontroller, a microphone module, and an LED strip.
The total cost to build this project is less than $20 if you purchase inexpensive components. It's a perfect weekend project for Arduino beginners who want to learn about voice control and RGB lighting.
In this guide, I'll walk you through every step to build your own voice-controlled LED strip including:
-
Required components - A list of all the hardware you need and where to buy it cheaply.
-
Circuit diagram - Wiring up the components properly.
-
Arduino code - Programming the Arduino to respond to voice commands.
-
Customizing the lights - Setting different colors and patterns.
By the end, you'll have an awesome DIY voice assistant to control your LED strip and impress your friends. Let's get started!
Required Components
To build this project, you'll need just a few affordable components:
-
Arduino Uno - The brain of the project. The Uno is very beginner friendly and costs around $10.
-
Microphone sound detection sensor - Detects your voice commands. These are under $2 on eBay.
-
WS2812B addressable RGB LED strip - Allows color control of each LED. 5 meters is around $10.
-
Breadboard - For connecting the components. Can get for $5.
-
Jumper wires - For wiring up the electronics. A pack of various colors is about $5.
-
USB cable - For powering the Arduino and uploading code. Most Arduinos include one.
-
12V power supply - Powers the LED strip. A 5A supply works well and costs $5-10.
So in total, you can build this voice-controlled LED strip for around $20 and have components left for future projects. Now let's look at how to put everything together.
Circuit Diagram
Here is the circuit diagram showing how to wire up the components:
The connections are fairly straightforward:
-
The Arduino is powered via the USB cable connected to a computer or power bank.
-
The microphone sensor connects to the Arduino's 5V and GND pins to receive power. The output signal pin connects to Arduino pin A0.
-
The input pin of the LED strip gets connected to Arduino pin 6 via a 220 ohm resistor. This allows the Arduino to control the color.
-
The 12V power supply connects directly to the LED strip to provide enough power for all the LEDs.
-
The Arduino GND connects to both the microphone GND and LED strip GND to complete the circuit.
As long as you wire up the components according to this diagram, you shouldn't have any issues. The Arduino will receive the voice commands through the microphone and send the appropriate signals to the LED strip to change the colors.
Arduino Code
Now for the brain of the operation - the Arduino code which will allow the voice commands to control the LED strip.
The full code can be found on GitHub here but I'll go through the key sections below:
```cpp
// Import the FastLED and VoiceRecognition libraries
include
include
// Set up the LED strip pins and number of LEDs
define LED_PIN 6
define NUM_LEDS 60
// Create the LED strip object
CRGB leds[NUM_LEDS];
// Set up the voice recognition commands
const char on = "on";
const char off = "off";
const char red = "red";
const char green = "green";
const char* blue = "blue";
// And so on...
void setup() {
// Initialize serial communication
Serial.begin(9600);
// Initialize the LED strip
FastLED.addLeds
// Set brightness to 50%
FastLED.setBrightness(127);
// Initialize the voice recognition
vr.begin(9600);
}
```
The setup initializes the LED strip, sets the brightness, and starts the voice recognition module.
The main loop listens for voice commands and takes the appropriate actions:
```cpp
void loop() {
// Check if a voice command is detected
if (vr.recognize(commands, numCommands)) {
if (vr.found(on, numCommands)) {
FastLED.setBrightness(255);
// Turn on LEDs at full brightness
} else if (vr.found(off, numCommands)) {
FastLED.setBrightness(0);
// Turn off LEDs
} else if (vr.found(red, numCommands)) {
setSolidColor(255, 0, 0);
// Set color to red
} else if (vr.found(green, numCommands)) {
setSolidColor(0, 255, 0);
// Set color to green
// And so on for other colors and patterns
}
}
```
This allows you to just say the command and the LEDs will change!
The full code has lots of nice effects like rainbow and fire animations. Take a look at the GitHub repo to see all the possibilities and customize it for your own needs.
Customizing the LEDs
The great thing about addressable LED strips is that you have full control over each LED. This allows for limitless color combinations, patterns, animations, and effects.
Here are some examples of what you can do:
-
Set a solid color - Like red, green, blue, yellow, purple, etc.
-
Fade between colors - Smooth transitions from one color to the next.
-
Rainbow animation - Cycles through all colors of the rainbow.
-
Pulse effect - Brightness pulses like a heartbeat.
-
Fire animation - Simulates flickering flames.
-
Music visualization - Flashes and fades to music.
-
Text scrolling - Scrolls text across the LEDs.
So feel free to tweak the code from the GitHub repo linked above and make the lighting effects match your style!
Conclusion
Building your own voice-controlled LED strip with Arduino is an achievable weekend project that doesn't have to break the bank. For under $20, you can make a custom voice assistant using simple components.
Follow the circuit diagram to wire up the Arduino, microphone, and LEDs. Then flash the code from the GitHub repo to enable the voice control functionality. Customize the lighting animations and effects to your liking by modifying the Arduino sketch.
This is a great DIY project for learning more about Arduino programming, sound sensors, and addressable RGB LED strips. Once you have it up and running, just say a few words and your lights will change color on command!
Let me know in the comments if you end up building your own voice-controlled LED strip. I'd love to see what customizations you come up with. Have fun and happy making!