Voice Controlled Lights using Raspberry Pi

Today we are building a very useful project in which we can control the LED lights using our voice through Smart Phone. In this project, we will send voice commands from Smart Phone to Raspberry Pi using Bluetooth Module and Raspberry Pi will receive that transmitted signal wirelessly and will perform respective task over the hardware. We can replace the LEDs with the AC home appliances using relays and can build a Voice Controlled Home Automation Project.

voice controlled lights using raspberry pi
Voice Controlled Home Automation using Raspberry Pi

Components Used:

  • Raspberry Pi 3 (any model shall work)
  • Bluetooth Module HC-06
  • Bread board
  • 100 ohm Resistors (3)
  • LED’s (blue, red, green)
  • Connecting wire
  • Power Supply
  • Ethernet cable
  • Android Phone

Bluetooth Module:

Bluetooth module consists two things one is Bluetooth serial interface module and a Bluetooth adaptor. Bluetooth serial module is used for converting serial port to Bluetooth.

How to operate Bluetooth module:

You can directly use the Bluetooth module after purchasing from market, because there is no need to change any setting of Bluetooth module. Default baud rate of new Bluetooth module is 9600 bps. You just need to connect rx and tx to controller or serial converter and give 5 volt dc regulated power supply to module.

Bluetooth module has two modes one is master mode and second one is slave mode. User can set either mode by using some AT commands. Even user can set module’s setting by using AT command. Here is some commands uses are given:

First of all user need to enter AT mode with 38400 bps baud rate by pressing EN button at Bluetooth module or by giving HIGH level at EN pin. Note: all commands should ends with \r\n (0x0d and 0x0a) or ENTER KEY from keyboard.

After it if you send AT to module then module will respond with OK

AT à Test Command

AT+ROLE=0 à Slave Mode select

AT+ROLE=1 à Master Mode select

AT+NAME=xyz  à Set Bluetooth Name

AT+PSWD=xyz à Set Password

AT+UART=<value1>,<value2>,<value3>  à set Baud rate

Eg. AT+UART=9600,0,0

Pin Description of HC-06 Bluetooth Module:

1. STATE  à Open

2. Rx  à Serial receiving pin

3. Tx  à Serial transmitting pin

4. GND   à ground

5. Vcc      à +5volt dc

6. KEY    à to enter in AT mode

Working Explanation:

Working of this Voice Controlled LEDs project is very easy. In this project we have used three LEDs of different colors (Blue, Red and Green). A HC-06 Bluetooth Module is used for receiving voice commands output in string format. Raspberry Pi receives that incoming string from Bluetooth Module and compares with predefined string and performs respective task.

In this project, to provide the voice commands to Raspberry Pi from our Smart Phone, we have used AMR Voice App in Android Phone (Android Meets Robots : Voice Recognition).

AMR Voice App installation and configuration:

AMR Voice App can be downloaded and installed from the Google Play Store. You also need to install Google Voice App for this project. AMR Voice app takes the voice as input and converts it into text string using Android mobiles internal voice recognition (Google Voice App) and sends this converted text serially over Bluetooth.

Now open the AMR voice app, go in option menu and connect it to Bluetooth module by clicking over ‘Connect Robot’:

Now user can tap over the Mic symbol on mobile screen and speak predefined Voice commands to operate the LEDs:

1. “blue light on”   (only blue LED turned on)

2. “blue light off”  (only blue LED turned off)

3. “red light on”     (only red LED turned on)

4. “red light off”    (only red LED turned off)

5. “green light on”  (only green LED turned on)

6. “green light off” (only green LED turned off)

7. “all lights on”     (blue, red and green LEDs turned on)

8. “all lights off”    (blue, red and green LEDs turned off)

9. “blink”                (all LEDs start blinking with a 100 millisecond time period)

Then AMR voice app records this voice and sends it to Google Voice app to convert it into the text string format. Now this converted string is sent to Raspberry Pi via Bluetooth module and Raspberry Pi reads this string from UART port and store in a string in the code. And then compare it with predefined strings, if any match occurs then Raspberry Pi takes a respective action or performs a task.

Circuit Explanation:

Circuit of this project is very simple, which contains Raspberry Pi 3 Board, LEDs and Bluetooth Module (HC-06). Raspberry Pi reads the Bluetooth Module and control the LEDs accordingly. LEDs Blue, Red and Green are connected at GPIO 17, 27 and 22. Rx and Tx of Bluetooth Module are directly connected to Tx and Rx pins of Raspberry Pi. Remaining connections are shown in circuit diagram.circuit explanation voice controlled lights using raspberry pi

For more detail: Voice Controlled Lights using Raspberry Pi


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

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

Scroll to Top