SPLAB
SPLAB
Submitted by:
Sudipon Makal 2304127
Kundan Kumar 2304100
Rishin Tarafder 2304110
Pranab Poddar 2304104
2
CONTENT:
1. Aim of Experiment 3
2. Components Required 3
3. Software Required 3
4. Theory 3
6. Circuit Diagram 7
7. Procedure 7
8. Advantages 8
9. Future Improvements 9
10. Conclusion 9
11. Reference 10
3
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.
#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"
#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);
pinMode(RELAYPIN_1, OUTPUT);
pinMode(RELAYPIN_2, OUTPUT);
// 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);
}
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
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/
3. Sinric Pro Documentation. Guide for integrating Sinric Pro with IoT devices for
voice control. Available at: https://sinric.pro/en/docs.
STUDENT SIGNATURE:
…………………………
Faculty Signature