This project shows how to control LED with voice using Arduino and we can use speech recognition module with Arduino Nano; also it takes voice command.
It turns LED ON or OFF based on command and also this Arduino with Speech Recognition Circuit is simple project for beginners.
Arduino Code:
int led = D5;
char data;
void setup() {
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (Serial.available()) {
data = Serial.read();
if (data == '1') {
digitalWrite(led, HIGH);
}
if (data == '0') {
digitalWrite(led, LOW);
}
}
}
Coding Explanation:
- We have set pin 5 as output.
- We have started serial at 9600 baud.
- We checked if data comes from speech module.
- If data is ‘1’ then LED turns ON.
- If data is ‘0’ then LED turns OFF.
Circuit Working:

Parts List:
| Components | Quantity |
|---|---|
| Resistor 220Ω 1/4 watt | 1 |
| Arduino Nano | 1 |
| Voice Recognition Module V3 | 1 |
| LED 5mm 20mA | 1 |
First, power the circuit using Arduino Nano.
Then connect LED long leg anode to Arduino D5 and connect LED short leg to 220Ω resistor and other end of resistor to GND.
Now speech module listens to voice and it converts voice to digital data, after that Arduino reads this data from RX pin.
Arduino compares data with saved command, If command is “ON” then Arduino gives HIGH at D5 and if command is “OFF” then Arduino gives LOW at D5.
Hence, this turns LED ON or OFF and to stop, power OFF the circuit and first remove 5V then remove GND.
How to Build:
To build a Arduino with Speech Recognition Circuit follow the below mentioned steps:
- First, collect all parts shown in circuit diagram.
- Next, connect LED long leg (anode) to Arduino D5 pin and connect LED short leg (cathode) to one end of 220Ω resistor.
- Also connect other end of 220Ω resistor to Arduino GND.
- Now connect speech module VCC to Arduino 5V.
- Connect speech module GND to Arduino GND
- Connect speech module TXD to Arduino RX and connect speech module RXD to Arduino TX.
Conclusion:
Overall, this Arduino with Speech Recognition Circuit is easy for voice control system, it shows how to use speech recognition with Arduino.
Also, we can use this idea for many home automation projects.