0% found this document useful (0 votes)
27 views9 pages

SPLAB

Uploaded by

darkacc0un1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views9 pages

SPLAB

Uploaded by

darkacc0un1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Laboratory Report on

Voice Controlled LED Switch Circuit

SIGNAL PROCESSING LABORATORY


OPEN ENDED EXPERIMENT
BRANCH-ETC GROUP-2
SESSION-2024-2025

Submitted by:
Sudipon Makal 2304127
Kundan Kumar 2304100
Rishin Tarafder 2304110
Pranab Poddar 2304104
2

CONTENT:

Sl. No. Topic Page No.

1. Aim of Experiment 3

2. Components Required 3

3. Software Required 3

4. Theory 3

5. Code for Implementation 3

6. Circuit Diagram 7

7. Procedure 7

8. Advantages 8

9. Future Improvements 9

10. Conclusion 9

11. Reference 10
3

AIM OF THE EXPERIMENT:


Design and Implementation of Voice Controlled LED Circuit.

COMPONENTS REQUIRED:
ESP-32 board/Arduino Uno, 2 LEDs (Green & Pink), 2 220Ω Resistors, Relay Module.

SOFTWARE REQUIRED:
1. TinkerCAD.
2. Arduino IDE.
3. Sinric Pro.

THEORY:
1. ESP32:
 Main controller: Manages the system by connecting to Wi-Fi and receiving voice
commands from Sinric Pro, which can integrate with voice assistants like Alexa or
Google Assistant.
2. Relay Module:
 Switching control: The relay module is connected to the ESP32 and physically
controls the LEDs. The ESP32 sends signals to the relays, which switch the green and
pink LEDs on or off.
3. Sinric Pro:
 Cloud and voice integration: Sinric Pro acts as the bridge between the ESP32 and
voice assistants, sending voice command data to the ESP32 to control the relays.
Working Process:
 The ESP32 connects to Sinric Pro via the cloud.
 When a voice command is received, Sinric Pro forwards it to the ESP32.
 The ESP32 then activates or deactivates the corresponding relay to turn the green or
pink LEDs on or off, depending on the command.

CODE FOR IMPLEMENTATION:


#ifdef ENABLE_DEBUG
#define DEBUG_ESP_PORT Serial
#define NODEBUG_WEBSOCKETS
4

#define NDEBUG
#endif

#include <Arduino.h>
#if defined(ESP8266)
#include <ESP8266WiFi.h>
#elif defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
#include <WiFi.h>
#endif

#include "SinricPro.h"
#include "SinricProSwitch.h"

#define WIFI_SSID "realme 5i"


#define WIFI_PASS "hyxn9999"
#define APP_KEY "2ee87fc7-8076-4793-9967-2aef355e165c"
#define APP_SECRET "38a664d3-4c5c-4436-b9f3-83c7b51eb8c3-
28dd2fcc-0d3d-4e55-9d90-0411cb5d3b4e"

#define SWITCH_ID_1 "66d0485d54041e4ff62615e3"


#define RELAYPIN_1 12

#define SWITCH_ID_2 "66d04892deddece34b84e90a"


#define RELAYPIN_2 13

#define BAUD_RATE 115200 // Change baudrate


to your need

bool onPowerState1(const String &deviceId, bool &state) {


Serial.printf("Device 1 turned %s", state?"off":"off");
digitalWrite(RELAYPIN_1, state ? LOW:LOW);
return true; // request handled properly
}
5

bool onPowerState2(const String &deviceId, bool &state) {


Serial.printf("Device 2 turned %s", state?"on":"on");
digitalWrite(RELAYPIN_2, state ? HIGH:HIGH);
return true; // request handled properly
}

// setup function for WiFi connection


void setupWiFi() {
Serial.printf("\r\n[Wifi]: Connecting");

#if defined(ESP8266)
WiFi.setSleepMode(WIFI_NONE_SLEEP);
WiFi.setAutoReconnect(true);
#elif defined(ESP32)
WiFi.setSleep(false);
WiFi.setAutoReconnect(true);
#endif

WiFi.begin(WIFI_SSID, WIFI_PASS);

while (WiFi.status() != WL_CONNECTED) {


Serial.printf(".");
delay(250);
}

Serial.printf("connected!\r\n[WiFi]: IP-Address is %s\r\n",


WiFi.localIP().toString().c_str());
}

// setup function for SinricPro


void setupSinricPro() {
// add devices and callbacks to SinricPro
6

pinMode(RELAYPIN_1, OUTPUT);
pinMode(RELAYPIN_2, OUTPUT);

SinricProSwitch& mySwitch1 = SinricPro[SWITCH_ID_1];


mySwitch1.onPowerState(onPowerState1);

SinricProSwitch& mySwitch2 = SinricPro[SWITCH_ID_2];


mySwitch2.onPowerState(onPowerState2);

// setup SinricPro
SinricPro.onConnected([](){ Serial.printf("Connected to SinricPro\
r\n"); });
SinricPro.onDisconnected([](){ Serial.printf("Disconnected from
SinricPro\r\n"); });

SinricPro.begin(APP_KEY, APP_SECRET);
}

// main setup function


void setup() {
Serial.begin(BAUD_RATE); Serial.printf("\r\n\r\n");
setupWiFi();
setupSinricPro();
}

void loop() {
SinricPro.handle();
}
7

CIRCUIT DIAGRAM:

Figure 1.1: Voice-controlled LED switch circuit using an Arduino and relay module

PROCEDURE:
1. Set up the hardware by connecting the ESP32 to the relay module. Connect Relay IN1
to ESP32 pin 12 for the green LED and Relay IN2 to pin 13 for the pink LED, using
220Ω resistors for each LED.
2. In the Arduino IDE, install the Sinric Pro library. Enter your Wi-Fi credentials and
Sinric Pro keys in the code, then upload the code to the ESP32.
3. On Sinric Pro, create two switch devices for each LED and link Sinric Pro to your
voice assistant (Alexa or Google Assistant).
4. Open the Serial Monitor to check the connection. Test the setup by giving voice
commands to control the LEDs.
8

Advantages Of Voice-Controlled Led Circuit


1. Hands-Free Operation: Allows control of LEDs without physical contact, making it
convenient for accessibility and multitasking.
2. Integration with Voice Assistants: Supports popular platforms like Alexa and
Google Assistant, providing seamless voice command functionality.
3. Remote Access: Enables LED control from anywhere through internet-connected
devices, increasing flexibility.
4. Energy Efficiency: Only activates LEDs when needed, potentially reducing
unnecessary power usage.
5. Scalable System: Easily expandable to control additional devices or sensors, making
it versatile for smart home applications.

Future Improvements for Voice-Controlled LED Circuit


1. Add Dimming Control: Integrate dimming functionality to adjust LED brightness
levels via voice commands for more precise lighting control.
2. Enhanced Device Integration: Expand the system to control other smart home
devices like fans, alarms, or temperature sensors, making it a comprehensive home
automation system.
3. Offline Voice Control: Implement offline voice processing to enable control without
internet, increasing reliability in areas with limited connectivity.
4. Power Usage Monitoring: Add a power monitoring module to track energy
consumption and optimize usage based on real-time data.
5. Mobile App Control: Develop a companion mobile app for additional control options,
enabling manual adjustments and scheduling beyond voice commands.

Conclusion
The voice-controlled LED circuit successfully demonstrates the integration of IoT and voice
recognition technology to achieve hands-free control. Using the ESP32, relay module, and
Sinric Pro, the system allows users to control LEDs via simple voice commands through
Alexa or Google Assistant. This project highlights the potential for voice-activated smart
home solutions, providing convenience, energy efficiency, and accessibility. With further
enhancements, this setup could be expanded to control additional devices, paving the way for
more comprehensive home automation.
9

REFERENCE:
1. Andrewfalc. How to Make Voice Controlled LED’s Using. Retrieved from
AUTODESK Instructables. Available at:
https://www.instructables.com/

2. ESP32 Documentation. "ESP32 Technical Reference Manual," Espressif Systems.


Available at: https://www.espressif.com/en/products/socs/esp32/resources.

3. Sinric Pro Documentation. Guide for integrating Sinric Pro with IoT devices for
voice control. Available at: https://sinric.pro/en/docs.

4. Voice Assistant Integration. Documentation on Alexa and Google Assistant


integrations for smart home control. Available at:
https://developers.google.com/assistant or https://developer.amazon.com/en-US/alexa

STUDENT SIGNATURE:

Sudipon Makal (2304127)

Kundan Kumar (2304100)

Rishin Tarafder (2304110)

Pranab Poddar (2304104)

…………………………
Faculty Signature

You might also like