The Voice-Controlled Smart Home Assistant is an IoT device built using the Maixduino Kit for AI + IoT. It incorporates voice recognition and motion detection to interact with Home Assistant via MQTT. The assistant recognizes specific voice commands, detects motion, and provides visual feedback through four white LEDs and two vertical RGB LED light bars. It updates the state of various entities in Home Assistant, enabling automation and enhancing user interaction with the smart home environment.
Impact Statement
I have developed a voice-controlled smart home assistant that seamlessly integrates with Home Assistant via MQTT. By enhancing voice recognition accuracy through algorithmic improvements and providing intuitive visual feedback with an RGB LED, this project bridges the gap between voice commands and smart home automation. It demonstrates practical IoT implementation and significantly improves user interaction with smart devices, enhancing convenience and daily life efficiency.
Components Required
PIR Motion Sensor: HC-SR501 PIR Motion Sensor Module
4x White LED
1 x RGB LED (common cathode or anode, as required)
3 x 220Ω Resistors (current limiting for RGB LED)
Cables and Connectors
12V DC Power Supply (compatible with Maixduino's barrel input)
Custom 3D-Printed Enclosure: For housing the components and enhancing aesthetics
Raspberry Pi with Home Assistant or any other Home Assistant instance
To see the full demonstration video, click on the YouTube Video below
Circuit Diagram
Hardware Components:
1.Maixduino Kit for AI + IoT:
Core Functionality:
Serves as the main processing unit, handling AI tasks, voice recognition, and IoT communication.
Utilizes onboard capabilities for executing AI algorithms and interfacing with peripherals.
ESP32 Module:
The Maixduino includes an onboard ESP32 module responsible for Wi-Fi connectivity.
Handles MQTT communication with the broker and Home Assistant over Wi-Fi.
Enables the assistant to publish and subscribe to MQTT topics for real-time interaction.
Power Supply:
Powered via the 12V DC barrel input, simplifying the power design.
The Maixduino's voltage regulators provide the necessary voltages for onboard components and peripherals.
1.PIR Motion Sensor (HC-SR501):
Connection:
VCC connected to the Maixduino's 3.3V output (compatible with the sensor's operating voltage).
GND connected to GND.
Output connected to digital pin D8 on the Maixduino.
Function:
Detects motion to activate the assistant or trigger specific actions configurable in Home Assistant.
When motion is detected, it sets a flag in the system to start listening for voice commands.
Publishes motion detection events to Home Assistant via MQTT for further automation.
2.LEDs:
Connection:
Each white LED is connected to a digital output pin on the Maixduino through a 220Ω current-limiting resistor, with the cathode connected to ground.
System LED (Pin D5): Indicates whether the assistant is active.
Speech LED (Pin D4): Shows voice recognition activity.
Network LED (Pin D3): Displays MQTT connection status.
Motion LED (Pin D2): Indicates motion detection state.
Function:
Provide visual feedback for different system states and activities.
Helps the user understand the current status of the assistant at a glance.
3.Vertical RGB LED Light Bars:
Components:
Two light bars, each consisting of 104 addressable RGB LEDs, approximately 1.5 meters in length.
Controlled by an ESP8266 microcontroller running WLED firmware.
Connection:
The ESP8266 connects to the home Wi-Fi network and integrates with Home Assistant.
The light bars are mounted vertically beside the Maixduino board using 3M Velcro Command Strips, which allow easy mounting and removal without damaging the wall.
Function:
Provides dynamic visual feedback when motion is detected or voice recognition is active.
Enhances the user experience with vivid lighting effects that correspond to the assistant's activity.
Offers practical illumination at night, turning on when motion is detected and off after the user leaves.
4.Custom 3D printed case:
Software Components:
1.Voice Recognition:
Utilizes a custom-trained voice model to recognize specific wake words and commands.
Library Modification:
Modified the original speech recognition library to handle 14 voice models with 6 samples each.
Implemented an averaging algorithm across all samples for more accurate recognition.
Added error threshold filtering to reduce false positives and improve reliability.
Voice Model Creation:
Used the get_voice_model sketch provided in the speech recognition library to record voice samples.
Employed CoolTerm software to capture the serial monitor output, as the current version of the Arduino IDE doesn't support copying large outputs that don't display entirely on screen.
Developed a custom Python script to process the voice data and generate the voice_model.h file.
The script automates the conversion of raw voice data into a format suitable for the speech recognition library.
Recognizes phrases like:
"Alfred Let's Go" (ID 1)
"Bye Bye Jarvis" (ID 2)
"Cooking Mode" (ID 3)
"Goodnight Jarvis" (ID 4)
"Jarvis Good Morning" (ID 5)
"Jarvis Lights On" (ID 6)
"Lights Off Jarvis" (ID 7)
"Wake Up Jarvis" (ID 8)
"Clap Clap" (ID 9)
"Jarvis Demo Mode" (ID 10)
Each command has 6 samples recorded for better recognition accuracy.
2.MQTT Communication:
Enables seamless integration with Home Assistant for controlling smart devices and receiving status updates.
ESP32 Wi-Fi Module:
Handles Wi-Fi connectivity and MQTT communication.
MQTT Topics:
The assistant publishes state changes to topics such as:
"home-assistant/voice-control/motion/state"
"home-assistant/voice-control/system/state"
"home-assistant/voice-control/light/state"
And others corresponding to different modes and commands.
Sends "
ON
" or "OFF
" messages to indicate state changes.
Home Assistant Configuration:
Home Assistant runs on a Raspberry Pi 5 with a static IP address to ensure consistent MQTT communication.
Installed the Mosquitto MQTT broker as an add-on in Home Assistant to handle MQTT communication.
Modified the
configuration.yaml
file in Home Assistant to include MQTT settings and ensure proper communication.The static IP configuration prevents connection issues that could arise from dynamic IP assignment.
3.Light Bar Automations:
WLED Firmware:
The ESP8266 controls the addressable RGB LEDs using WLED firmware.
Connects to Home Assistant and can be controlled via MQTT or the WLED integration.
Home Assistant Automations:
When the PIR sensor detects motion, the assistant publishes "
ON
" to the"home-assistant/voice-control/motion/state"
topic.Home Assistant triggers an automation that turns on the light bars with dynamic lighting effects, providing visual feedback that the assistant is active.
The light bars turn off automatically after 4 seconds of no motion detection, which is helpful at night for illumination without the need to manually control lights.
Mounting:
The light bars are mounted using 3M Velcro Command Strips, allowing easy installation and removal without damaging walls.
4.System State Management:
Manages different system states such as active, inactive, and various modes.
State Transitions:
Responds to voice commands and motion detection to change states.
Updates are reflected both in the assistant's behavior and in Home Assistant via MQTT.
Visual Feedback:
The LEDs on the Maixduino provide immediate visual cues.
The light bars offer enhanced visual feedback with expressive lighting effects.
Use Cases and Achievements:
Enhanced Visual Feedback:
The addition of the RGB light bars provides a striking visual indication of the assistant's status.
When motion is detected, the light bars illuminate with dynamic effects, signaling that the assistant is ready to receive commands.
This is particularly useful at night, offering both practical lighting and an engaging user experience.
Automated Lighting Control:
The light bars turn off automatically after 4 seconds of no motion, conserving energy.
They can be used to create ambient lighting scenes controlled via voice commands or automations.
Ease of Installation:
The use of 3M Velcro Command Strips makes mounting the light bars simple and non-destructive.
Users can install or reposition the light bars without tools or damage to walls.
Example Use Case Scenario:
Evening Arrival:
Upon entering the room in the evening, the PIR sensor detects motion.
The assistant activates, indicated by the System LED and the light bars illuminating with a welcoming lighting effect.
You say, "Jarvis Lights On."
The assistant recognizes the command and publishes the state change.
Home Assistant turns on additional lights or adjusts the light bars to a different scene.
Nighttime Navigation:
If you get up during the night, the PIR sensor detects motion.
The light bars softly illuminate, providing enough light to navigate without turning on bright overhead lights.
After you leave, the light bars turn off automatically after 4 seconds.
Interactive Feedback:
While the assistant is processing a voice command, the light bars can display a specific animation, giving visual confirmation that your command is being handled.
By integrating voice recognition, IoT communication, and dynamic lighting, this project creates an interactive smart home assistant that enhances daily life. The assistant offers convenient, hands-free control over smart devices and provides immediate visual feedback. The combination of hardware components like the Maixduino Kit, PIR sensor, and LED indicators, along with software integrations using MQTT and Home Assistant, results in a customizable and efficient smart home solution.
Footnote:
This setup can also be achieved without using Home Assistant by utilizing HTTP API calls. Services like IFTTT (If This Then That) can be employed to trigger actions based on voice commands or other events. By directly sending HTTP requests to devices like the WLED-controlled light bars, you can control them locally without the need for a central home automation system. This approach allows for flexible integrations and can simplify the system for users who prefer a more straightforward setup.
For all the code, follow the GitHub link below: