Voice Controlled Home Automation:

Here is a basic code for a voice-controlled home automation system using an Arduino board and a Voice Recognition module:

Python Code:

#include <SoftwareSerial.h>

const int voiceRecognitionRX = 2;

const int voiceRecognitionTX = 3;

const int relay1 = 4;

const int relay2 = 5;

const int relay3 = 6;

SoftwareSerial voiceSerial(voiceRecognitionRX, voiceRecognitionTX);

void setup() {

  voiceSerial.begin(9600);

  pinMode(relay1, OUTPUT);

  pinMode(relay2, OUTPUT);

  pinMode(relay3, OUTPUT);

}

void loop() {

  if (voiceSerial.available()) {

    int incomingByte = voiceSerial.read();

    switch (incomingByte) {

      case 1:

        digitalWrite(relay1, HIGH);

        break;

      case 2:

        digitalWrite(relay2, HIGH);

        break;

      case 3:

        digitalWrite(relay3, HIGH);

        break;

      case 4:

        digitalWrite(relay1, LOW);

        break;

      case 5:

        digitalWrite(relay2, LOW);

        break;

      case 6:

        digitalWrite(relay3, LOW);

        break;

      default:

        break;

    }

  }

}

Hardware and electronic items required:

  • Arduino board (e.g. Arduino Uno)
  • Voice Recognition module (e.g. Voice Recognition V3)
  • Relay module (e.g. 4 Channel Relay Module)
  • Jumper wires
  • Power supply (e.g. 5V power adapter)
  • Breadboard (optional, for prototyping)

Circuit diagram:

+--------------+ | Voice | | Recognition | | Module o| | RX o-----+----> Arduino Digital Pin 2 (voiceRecognitionRX) | TX o-----+----> Arduino Digital Pin 3 (voiceRecognitionTX) | GND o-----+----> Arduino GND +--------------+ +--------------+ | Relay | | Module o| | IN1 o-----+----> Arduino Digital Pin 4 (relay1) | IN2 o-----+----> Arduino Digital Pin 5 (relay2) | IN3 o-----+----> Arduino Digital Pin 6 (relay3) | VCC o-----+----> 5V Power Supply | GND o-----+----> GND +--------------+


No comments:

Post a Comment

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.