Envy Sams
Created September 3, 2024

UniControl Remote

UniControl Remote: Control all home appliances from anywhere with one device. Voice activation, mobile app, and long-range connectivity.

30
UniControl Remote

Things used in this project

Story

Read more

Code

UniControl Remote: Universal Remote Control for Home Appliances

C/C++
To use the UniControl Remote:

Power On: Turn on the UniControl Remote by pressing the power button.
Connect to WiFi: The remote automatically connects to your home WiFi network. Ensure your WiFi credentials are saved in the remote or enter them through the mobile app.
Select Appliance: Use the touchscreen interface to navigate and select the appliance you want to control.
Control: Adjust settings, turn devices on/off, or manage operations through the touchscreen, mobile app, or by voice command.
Voice Activation: Simply speak your command, like “Turn on the lights,” to control appliances hands-free.
Mobile App: For remote access, use the UniControl mobile app, which mirrors the remote's interface and offers real-time control from anywhere in your home.
#include <WiFi.h>
#include <ESP32Servo.h>
#include <IRremote.h>
#include <Wire.h>
// WiFi Credentials
const char* ssid = "your-SSID";
const char* password = "your-PASSWORD";
// Define pins for control
#define LED_PIN 2
#define SERVO_PIN 15
#define IR_SEND_PIN 4
#define BUTTON_PIN 5
#define APPLIANCE_PIN 16
// Define IR codes for kitchen appliance
#define MICROWAVE_ON_CODE 0xF7C03F
#define MICROWAVE_OFF_CODE 0xF740BF
// Create Servo and IR objects
Servo myServo;
IRsend irsend(IR_SEND_PIN);
// Variable to hold the LED and appliance states
bool ledState = false;
bool applianceState = false;
int buttonState = 0;
void setup() {
// Initialize serial communication
Serial.begin(115200);
// Setup pin modes
pinMode(LED_PIN, OUTPUT);
pinMode(APPLIANCE_PIN, OUTPUT);
pinMode(BUTTON_PIN, INPUT_PULLUP);
myServo.attach(SERVO_PIN);
// Initialize WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
// Initialize IR transmitter
irsend.begin();
}
void loop() {
// Handle button press to toggle LED
buttonState = digitalRead(BUTTON_PIN);
if (buttonState == LOW) {
ledState = !ledState;
digitalWrite(LED_PIN, ledState ? HIGH : LOW);
Serial.println(ledState ? "LED is ON" : "LED is OFF");
delay(300); // Debounce delay
}
// Example of controlling a servo (e.g., to open a cabinet door)
if (ledState) {
myServo.write(90); // Open position
} else {
myServo.write(0); // Closed position
}
// Check WiFi connection and control appliance
if (WiFi.status() == WL_CONNECTED) {
// Simulate receiving a command to turn on the microwave from the mobile app
String command = receiveCommandFromApp();
if (command == "MICROWAVE_ON") {
applianceState = true;
digitalWrite(APPLIANCE_PIN, HIGH);
irsend.sendNEC(MICROWAVE_ON_CODE, 32);
Serial.println("Microwave is ON");
} else if (command == "MICROWAVE_OFF") {
applianceState = false;
digitalWrite(APPLIANCE_PIN, LOW);
irsend.sendNEC(MICROWAVE_OFF_CODE, 32);
Serial.println("Microwave is OFF");
}
}
// Simulate power-saving mode after inactivity
if (!ledState && !applianceState) {
enterPowerSavingMode();
} delay(100); // Small delay for stability
}
// Simulate receiving a command from the mobile app
String receiveCommandFromApp() {
// In a real implementation, this function would receive data over WiFi from the mobile
app
// For now, we simulate by returning a fixed command
return "MICROWAVE_ON"; // Replace with logic to parse actual commands
}
// Simulate entering a power-saving mode
void enterPowerSavingMode() {
Serial.println("Entering power-saving mode...");
// Implement power-saving features like turning off unnecessary peripherals
delay(1000);
}

Credits

Envy Sams

Envy Sams

1 project • 0 followers

Comments