DIY Voice-Controlled RGB LED Strip

This project will use a smartphone to set the color of the RGB LED strip. These RGB strips have built-in Bluetooth functionality and can receive commands sent from an Android application on the smartphone. This way, we can control the color of the RGB LED strip through the phone. If you think this is not cool enough, the latter part of the article introduces the making of a voice-controlled RGB LED strip, the same circuit, two uses!

Circuit Diagram and BOM List

This project has only three key components. The BOM list is as follows: – Bluetooth module (HC05) – Arduino NANO development board – Addressable RGB LED strip – Dupont wire

DIY Voice-Controlled RGB LED Strip

The RGB LED strip has only three interface wires: 12V, Gnd, Din. Among them, Din is used for data input and is connected to digital pin D13 of the Arduino development board; the strip and Arduino NANO development board are powered by the same 12V power supply from the adapter. HC05 has four pins: Vcc, Gnd, TXD, RXD. The Vcc pin is powered by 5V from the Arduino development board; Gnd is connected to the common ground pin, and TXD and RXD are connected to digital pins D4 and D5, respectively.

Operating Instructions

After powering the circuit from the adapter, all the LEDs on the strip will turn off, and only the HC05 module will blink, indicating that it is looking for another Bluetooth device to pair with. If you want to change the color of the strip, send the pairing information using your smartphone, the default password for the HC05 module is 1234. Once the phone connects to the HC05 module, the blinking speed will slow down. Enter and send the letter ‘R’ from the phone, and the phone will send ‘R’ to the HC05 module via Bluetooth. After receiving ‘R’, the HC05 module will send it to Arduino via serial. Once Arduino receives ‘R’, it will pass the data to the RGB strip and set the color of all RGB LEDs on the strip to red (RED), lighting up all the LEDs on the strip in red (RED). Similarly, sending the following letters via the Android application will show the expected color on the strip.

DIY Voice-Controlled RGB LED Strip

Finally, if you want all the LEDs on the strip to turn off, just send the letter ‘X’ via the Android program.

Interesting, right? Here is the Arduino code for this project:

#include

#include

#define NUM_LEDS 40

#define DATA_PIN1 13

#define Tx_pin 4

#define Rx_pin 5

int i;

char recv_char;

CRGB led_strip1[NUM_LEDS];

SoftwareSerial BT_serial(Rx_pin,Tx_pin);

void setup()

{

FastLED.addLeds(led_strip1, NUM_LEDS);

for(i=0;i

FastLED.show();

delay(1000);

for(i=0;i

FastLED.show();

delay(1000);

for(i=0;i

FastLED.show();

delay(1000);

BT_serial.begin(9600);

BT_serial.println(“select desired color”); }

void loop()

{

if(BT_serial.available())

{

recv_char = BT_serial.read();

BT_serial.println(recv_char);

switch(recv_char)

{

BT_serial.println(recv_char);

case ‘R’:

for(i=0;i

FastLED.show();

break;

case ‘Y’:

for(i=0;i

FastLED.show();

break;

case ‘O’:

for(i=0;i

FastLED.show();

break;

case ‘G’:

for(i=0;i

FastLED.show();

break;

case ‘L’:

for(i=0;i

FastLED.show();

break;

case ‘B’:

for(i=0;i

FastLED.show();

break;

case ‘S’:

for(i=0;i

FastLED.show();

break;

case ‘C’:

for(i=0;i

FastLED.show();

break;

case ‘P’:

for(i=0;i

FastLED.show();

break;

case ‘M’:

for(i=0;i

FastLED.show();

break;

case ‘x’:

for(i=0;i

FastLED.show();

break;

case ‘W’:

for(i=0;i

FastLED.show();

break;

}

}

}

Project Upgrade: Voice-Controlled LED Strip

If you think Bluetooth is not convenient enough, then let’s go for voice control! This means you can say the color you want for the LED strip. For example, if you say “BLUE” loudly, the LED strip will display blue!!!!

In fact, this does not require additional circuits, just download an “Arduino Bluetooth controller” app from the Google store, which will convert voice commands into text and send them via the phone’s Bluetooth to another phone. The specific steps are as follows: 1. Download and install the Arduino Bluetooth controller application. 2. Open and install it, the program will prompt you to enable your phone’s Bluetooth. 3. Turn ON Bluetooth. 4. The program will look for another Bluetooth device, tap “available device” and you will find the HC05 module. 5. Finally, connect to the HC05 module. 6. Download the following Arduino code:

#include

#include

#define NUM_LEDS 43

#define DATA_PIN1 4

#define Tx_pin 3

#define Rx_pin 2

int i,j=0,k;

char recv_color_str[8];

char red[4] = “red”;

char green[6] = “green”;

char blue[5] = “blue”;

char magenta[8] = “Magenta”;

char yellow[7] = “yellow”;

char orange[7] = “orange”;

char white[6] = “white”;

char purple[7] = “purple”;

char rainbow[8] = “rainbow”;

char black[6] = “black”;

CRGB led_strip1[NUM_LEDS];

SoftwareSerial BT_serial(Rx_pin,Tx_pin);

void setup()

{

FastLED.addLeds(led_strip1, NUM_LEDS);

for(i=0;i

FastLED.show();

delay(1000);

for(i=0;i

FastLED.show();

delay(1000);

for(i=0;i

FastLED.show();

delay(1000);

BT_serial.begin(9600);

// Serial.begin(9600);

//Serial.println(“select desired color”);

}

void loop()

{

while(BT_serial.available())

{

if(BT_serial.available()>0)

{

recv_color_str[j] = BT_serial.read();

Serial.print(recv_color_str[j]);

j++;

}

}

if(strcmp(recv_color_str,black)==0)

{

//Serial.println(recv_color_str);

for(i=0;i

FastLED.show();

j=0;

for(k=0;k<8;k++) recv_color_str[k] = ‘\0’;

}

else if(strcmp(recv_color_str,red)==0)

{

//Serial.println(recv_color_str);

for(i=0;i

FastLED.show();

j=0;

for(k=0;k<8;k++) recv_color_str[k] = ‘\0’;

}

else if(strcmp(recv_color_str,purple)==0)

{

// Serial.println(recv_color_str);

for(i=0;i

FastLED.show();

j=0;

for(k=0;k<8;k++) recv_color_str[k] = ‘\0’;

}

else if(strcmp(recv_color_str,white)==0)

{

// Serial.println(recv_color_str);

for(i=0;i

FastLED.show();

j=0;

for(k=0;k<8;k++) recv_color_str[k] = ‘\0’;

}

else if(strcmp(recv_color_str,green)==0)

{

// Serial.println(recv_color_str);

for(i=0;i

FastLED.show();

j=0;

for(k=0;k<8;k++) recv_color_str[k] = ‘\0’;

}

else if(strcmp(recv_color_str,blue)==0)

{

// Serial.println(recv_color_str);

for(i=0;i

FastLED.show();

j=0;

for(k=0;k<8;k++) recv_color_str[k] = ‘\0’;

}

else if(strcmp(recv_color_str,yellow)==0)

{

//Serial.println(recv_color_str);

for(i=0;i

FastLED.show();

j=0;

for(k=0;k<8;k++) recv_color_str[k] = ‘\0’;

}

else if(strcmp(recv_color_str,orange)==0)

{

// Serial.println(recv_color_str);

for(i=0;i

FastLED.show();

j=0;

for(k=0;k<8;k++) recv_color_str[k] = ‘\0’;

}

else if(strcmp(recv_color_str,magenta)==0)

{

//Serial.println(recv_color_str);

for(i=0;i

FastLED.show();

j=0;

for(k=0;k<8;k++) recv_color_str[k] = ‘\0’;

}

else if(strcmp(recv_color_str,rainbow)==0)

{

//Serial.println(recv_color_str);

for(i=0;i<3;i++) {led_strip1 = CRGB::Yellow;}

for(i=3;i<6;i++) {led_strip1 = CRGB::Magenta;}

for(i=6;i<9;i++) {led_strip1 = CRGB::Orange;}

for(i=9;i<12;i++) {led_strip1 = CRGB::Blue;}

for(i=12;i<15;i++) {led_strip1 = CRGB::Green;}

for(i=15;i<18;i++) {led_strip1 = CRGB::Red;}

for(i=18;i<21;i++) {led_strip1 = CRGB::Cyan;}

for(i=21;i<24;i++) {led_strip1 = CRGB::Yellow;}

for(i=24;i<27;i++) {led_strip1 = CRGB::Magenta;}

for(i=27;i<30;i++) {led_strip1 = CRGB::Orange;}

for(i=30;i<33;i++) {led_strip1 = CRGB::Blue;}

for(i=33;i<36;i++) {led_strip1 = CRGB::Green;}

for(i=36;i<39;i++) {led_strip1 = CRGB::Red;}

for(i=39;i<43;i++) {led_strip1 = CRGB::Cyan;}

FastLED.show();

j=0;

for(k=0;k<8;k++) recv_color_str[k] = ‘\0’;

}

else

{

j=0;

for(k=0;k<8;k++) recv_color_str[k] = ‘\0’;

}

}

After uploading this code to the Arduino IDE, just shout the color name at your phone, and the strip will change color according to your request.

Author: Hard City Allchips, Source: Breadboard Community

Link: https://mbb.eet-china.com/blog/uid-me-3975615.html

Copyright statement: This article is original by the author, and reproduction is prohibited without permission

Leave a Comment

Your email address will not be published. Required fields are marked *