How to Build a DIY Voice Controlled Home Automation System with Raspberry Pi
Building a voice controlled home automation system with Raspberry Pi is a fun and rewarding DIY project that allows you to control devices and appliances in your home using voice commands. With some basic hardware and free open-source software, I was able to create my own custom system that works great. Here is a step-by-step guide on how I built my DIY voice controlled home automation system using Raspberry Pi.
Hardware Needed
- Raspberry Pi - The brain of the system. I used a Raspberry Pi 3 Model B but any Pi with WiFi capabilities will work.
- MicroSD Card - To store the Raspberry Pi operating system and software. An 8GB card is sufficient.
- Power Supply - A 5V micro USB power supply to power the Pi. 2.5A is recommended.
- Microphone - To receive voice commands. I used a USB microphone but you can also use a Pi compatible microphone or adapter.
- Speakers - For voice responses. Any powered USB speakers will work.
- Relays - To control devices by opening/closing circuits. I used 8 channel relay modules.
- Jumper wires - For connecting components.
- Breadboard - Makes it easy to prototype circuits before soldering. Optional.
Software Required
- Raspberry Pi OS - The operating system. I recommend the full desktop version.
- VOICE CONTROL SOFTWARE - Open source software that enables voice control. I used Jasper.
- WiringPi - Provides GPIO access for controlling relays.
Steps to Build the System
1. Setup Raspberry Pi
- Flash Raspberry Pi OS to the microSD card.
- Insert SD card into Pi and connect keyboard, mouse, monitor, ethernet cable/WiFi dongle.
- Boot the Pi, configure OS settings like timezone, username, password etc.
- Enable SSH so you can access Pi without a monitor later.
- Connect Pi to speakers through the 3.5mm audio jack.
2. Install Required Software
- Update Pi OS to latest version:
sudo apt-get update
sudo apt-get upgrade - Install WiringPi for GPIO control:
sudo apt-get install wiringpi
- Install Jasper voice control software:
sudo apt-get install python-pyaudio python-dbus
git clone https://github.com/jasperproject/jasper-client.git
3. Connect Relays to Raspberry Pi
- Use jumper wires to connect the control pins of relays to Raspberry Pi GPIO pins. Pay close attention to voltages to avoid damage.
- For high power devices, connect the relays to wall sockets and plug devices into relays.
- For low power devices, connect devices directly to the relay boards.
4. Configure Jasper
- Customize Jasper modules in
profile.yml
to enable control of connected devices. - Map device names to GPIO pin numbers in
apps/ gpio_control.py
. - Add voice commands to activate devices in
vocab/en-us/HomeAutomation.voc
.
5. Start Jasper and Test Voice Commands
- Start Jasper in debug mode to test everything works:
python jasper.py --debug
- Say your custom voice command to toggle devices, like "Turn on office lights".
- Make sure devices connected to the relays turn on/off accordingly.
- Exit debug mode once testing is complete.
6. Configure Jasper to Run on Boot
- Create and configure a systemd service file so Jasper starts automatically when the Pi boots up.
- Reboot Pi and say voice commands to test that Jasper works automatically!
With those steps complete, you now have a fully functioning DIY voice controlled home automation system with Raspberry Pi! Feel free to customize and expand on this basic setup to control more devices and build more advanced automations. The possibilities are endless!