The LC-Relay-ESP12-2R-D8 is a versatile relay module that integrates an ESP12 Wi-Fi module, enabling remote control of two relays via Wi-Fi. This component is ideal for Internet of Things (IoT) applications, allowing users to switch devices on and off remotely. Common use cases include home automation, industrial control systems, and smart appliances.
Parameter | Value |
---|---|
Operating Voltage | 5V DC |
Relay Channels | 2 |
Wi-Fi Module | ESP12 |
Max Current (Relay) | 10A @ 250V AC / 10A @ 30V DC |
Power Consumption | < 1W |
Communication | Wi-Fi (802.11 b/g/n) |
Dimensions | 50mm x 50mm x 20mm |
Pin Number | Pin Name | Description |
---|---|---|
1 | VCC | Power supply (5V) |
2 | GND | Ground |
3 | IN1 | Control signal for Relay 1 |
4 | IN2 | Control signal for Relay 2 |
5 | TX | UART Transmit (ESP12) |
6 | RX | UART Receive (ESP12) |
7 | CH_PD | Chip Power-Down (ESP12) |
8 | RST | Reset (ESP12) |
Terminal | Description |
---|---|
NO1 | Normally Open contact for Relay 1 |
COM1 | Common contact for Relay 1 |
NC1 | Normally Closed contact for Relay 1 |
NO2 | Normally Open contact for Relay 2 |
COM2 | Common contact for Relay 2 |
NC2 | Normally Closed contact for Relay 2 |
#include <ESP8266WiFi.h>
// Define relay control pins
const int relay1Pin = D1; // GPIO5
const int relay2Pin = D2; // GPIO4
// Wi-Fi credentials
const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";
void setup() {
// Initialize serial communication
Serial.begin(115200);
// Initialize relay control pins as outputs
pinMode(relay1Pin, OUTPUT);
pinMode(relay2Pin, OUTPUT);
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
// Turn off relays initially
digitalWrite(relay1Pin, LOW);
digitalWrite(relay2Pin, LOW);
}
void loop() {
// Example: Toggle relays every 5 seconds
digitalWrite(relay1Pin, HIGH); // Turn on Relay 1
delay(5000); // Wait for 5 seconds
digitalWrite(relay1Pin, LOW); // Turn off Relay 1
digitalWrite(relay2Pin, HIGH); // Turn on Relay 2
delay(5000); // Wait for 5 seconds
digitalWrite(relay2Pin, LOW); // Turn off Relay 2
}
Wi-Fi Connection Problems:
Relays Not Switching:
Module Not Powering On:
By following this documentation, users can effectively integrate and utilize the LC-Relay-ESP12-2R-D8 in their IoT projects, ensuring reliable and efficient remote control of devices.