Introduction

In this article, I will show you how I built a voice controlled home automation system with an Arduino microcontroller for well under $50. Home automation allows you to control devices and appliances in your home with your voice, bringing ease and convenience to daily activities. With an Arduino, some basic electronic components, free software, and a little bit of programming knowledge, you can create an intelligent home automation system on a budget.

Components Needed

To build the voice controlled home automation system, you will need the following components:

Arduino Uno

The Arduino Uno is the microcontroller board that will function as the brain of the system. It will receive voice commands and control the appliances accordingly. The Uno model is inexpensive but powerful enough for this project.

Jumper wires

Jumper wires are used to connect the Arduino to the other components in the circuit. You will need both male-to-male and male-to-female jumper wires.

Breadboard

A breadboard provides a place to prototype the circuit and make temporary connections between components.

Relays

Relays are essentially remote controlled switches. They take a signal from the Arduino and can turn appliances on or off.

Microphone

A basic microphone is needed to capture your voice commands and input them to the Arduino. Any electret microphone will work.

Resistors

Resistors limit the flow of current in the circuit. You will need a mix of 220ohm, 10kohm, and 1kohm resistors.

LEDs

LEDs provide visual indicators when a relay is activated. Any color will do.

Wires

Wires are used to make permanent connections between relays and appliances.

Assembling the Circuit

Here are the step-by-step instructions for assembling the home automation circuit on the breadboard:

Connect the Arduino

First, insert the Arduino into the breadboard. Be sure to place it across the center ditch so the pins are accessible on both sides.

Wire the relays

Next, connect one side of each relay module to 5V and GND pins on the Arduino. Use jumper wires to make the connections.

Add LED indicators

LEDs show when a relay is activated. Connect 220ohm resistors in series with LEDs and attach to the signal pins on each relay.

Hook up the microphone

The microphone needs power so connect the red wire to 5V. The black wire goes to GND. Use a jumper wire to connect the white wire to an analog input pin on the Arduino.

Include pull down resistors

Place 10kohm resistors between each relay signal pin and GND. This prevents floating inputs.

Once all the components are wired up, double check the connections match the circuit diagram before powering it on.

Installing the Software

To give the Arduino voice control capabilities, you need to install the following software:

Arduino IDE

The Arduino IDE (Integrated Development Environment) is needed to program the Arduino itself. This is where you will write and upload the Arduino sketch.

Speech Recognition Library

The Speech Recognition Library by Elechouse enables Arduino to interpret voice commands. It must be downloaded and added to the Arduino IDE.

IFTTT

IFTTT (If This Then That) is a free web service that links internet connected devices and triggers actions when certain conditions are met. This enables the Arduino to control appliances through voice commands.

Programming the Arduino

Here are the steps to program the Arduino to respond to voice commands using the Speech Recognition Library:

Include the library

At the top of the Arduino sketch, include the line:

#include <SpeechRecognizerV2.h>

This makes the speech recognition functions available.

Define voice commands

Use an array to define the voice control vocabulary. For example:

const char* voiceCommands[] = {"ON", "OFF","LIGHT ON", "LIGHT OFF"};

This defines the words the Arduino will listen for.

Set up the recognizer

In the setup function, start the speech recognizer and link it to the words array:

SpeechRecognizer.init(voiceCommands, 4);

The second number specifies how many words are in the array.

Listen and act

In the main loop, check if a word was recognized and trigger the corresponding action:

if (SpeechRecognizer.hasResult()) {
    int commandNum = SpeechRecognizer.getResult();

    if (commandNum == 0) {
       digitalWrite(relay1, HIGH); 
    }
    else if (commandNum == 1) {
       digitalWrite(relay1, LOW);
    }
   // add cases for other commands
}

This turns relay1 on or off depending on the detected command. Expand this to add controls for the other relays.

Connecting Appliances via IFTTT

To enable voice control of appliances, you need to connect the Arduino to IFTTT and create Applets:

Install the IFTTT app

Download the IFTTT app on your smartphone and create an account if you don't already have one.

Connect to the Arduino

Search the IFTTT app for the Arduino channel and connect your account. This links the Arduino to IFTTT.

Create Applets

Applets define "if this then that" rules. For example, you can create an Applet like:

If Arduino turns on pin 13, then turn on plug switch.

This would turn on a smart switch when pin 13 is triggered. Create similar Applets for each appliance you want to control.

Now when you give the Arduino a voice command, it will activate the corresponding IFTTT Applet and control devices around your home!

Conclusion

Building a DIY voice controlled home automation system with Arduino is simple and affordable. With just $50 of basic electronic components, free software, and a bit of programming, you can set up an intelligent system to control appliances and devices in your home through voice commands. This project is a great way to get started with Arduino, electronics, and home automation. The possibilities are endless for adding enhancements and integrating new features down the road. I hope you found this guide helpful for creating your own budget voice controlled smart home with Arduino! Let me know if you have any other questions.