Introduction
Controlling appliances with Wi-Fi and IR often requires multiple modules. The WiFIRCardsolves this problem by combining everything into a tiny, credit card-sized board powered by the ESP32-S3.
In this project, we’ll set up WiFIRCard with the Arduino IDE, use Wi-Fi to toggle relays from a web interface, and control IR devices like a TV or AC.
Features We’ll Use
- Dual relays to switch lights/fans/appliances
- IR transmitter/receiver to emulate remote controls
- ESP32-S3 Wi-Fi to host a simple web server
- Onboard LEDs for status indication
Getting Started with Arduino IDE on WiFIRCard
Step 1: Install ESP32 Board Support
- Open Arduino IDE → go to File → Preferences.
- Add the following URL in Additional Board Manager URLs:
https://espressif.github.io/arduino-esp32/package_esp32_index.json
Go to Tools → Board → Board Manager, search for ESP32, and install it.
Step 2: Select WiFIRCard Board
- Go to Tools → Board → ESP32 Arduino → ESP32S3 Dev Module.
- Select correct COM port.
Step 3: Blink Example (Hello World)
#define LED_PIN 2 // Replace with actual onboard LED pin
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, HIGH);
delay(500);
digitalWrite(LED_PIN, LOW);
delay(500);
}
Upload the code and check the onboard LED blinking. ✅
Step 4: Control Relay via Web Server#include <WiFi.h>
const char* ssid = "Your_SSID";
const char* password = "Your_PASSWORD";
#define RELAY1 15 // Replace with actual relay GPIO
#define RELAY2 16
WiFiServer server(80);
void setup() {
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
digitalWrite(RELAY1, LOW);
digitalWrite(RELAY2, LOW);
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("WiFi connected");
server.begin();
}
void loop() {
WiFiClient client = server.available();
if (!client) return;
String req = client.readStringUntil('\r');
client.flush();
if (req.indexOf("/relay1/on") != -1) digitalWrite(RELAY1, HIGH);
if (req.indexOf("/relay1/off") != -1) digitalWrite(RELAY1, LOW);
if (req.indexOf("/relay2/on") != -1) digitalWrite(RELAY2, HIGH);
if (req.indexOf("/relay2/off") != -1) digitalWrite(RELAY2, LOW);
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("");
client.println("<h1>WiFIRCard Web Control</h1>");
client.println("<p><a href=\"/relay1/on\">Relay 1 ON</a> | <a href=\"/relay1/off\">Relay 1 OFF</a></p>");
client.println("<p><a href=\"/relay2/on\">Relay 2 ON</a> | <a href=\"/relay2/off\">Relay 2 OFF</a></p>");
}
Now, connect to your Wi-Fi and open the ESP32 IP in a browser – you can toggle your appliances from anywhere on the local network.
Step 5: IR Remote Example (Send Signal)
Add the IRremoteESP8266library from Arduino IDE Library Manager.
#include <IRremoteESP8266.h>
#include <IRsend.h>
#define IR_LED 4 // Replace with actual IR TX pin
IRsend irsend(IR_LED);
void setup() {
irsend.begin();
}
void loop() {
// Example: Send NEC signal for "Power On" (replace with actual code)
irsend.sendNEC(0x20DF10EF, 32);
delay(5000);
}
Applications
- Toggle lights/fans via smartphone
- Replace TV/AC remote with WiFIRCard
- Integrate with Alexa/Google Assistant via MQTT or Blynk
- Expand with PIR motion sensors for automation
The WiFIRCardbrings together relays, Wi-Fi, and IR into one board, making smart automation projects much easier. Using the Arduino IDE, you can quickly build web-controlled appliances and IR remote emulators, with plenty of room to expand.
👉 Project built using WiFIRCard, now live on Kickstarter.
Comments