Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

ESP32-Controlled I2C LCD Display with Relay Switching

View and Edit Project In Cirkit DesignerImage of ESP32-Controlled I2C LCD Display with Relay Switching

Circuit Documentation

Summary

This circuit integrates an ESP32 microcontroller with an I2C LCD 16x2 screen and a 2-channel relay module. The ESP32 is programmed to display messages on the LCD screen and potentially control the relay module, although the specific control logic for the relays is not included in the provided code. The circuit is designed to operate with a common ground and a shared power supply voltage for both the LCD and the relay module, which is provided by the ESP32's Vin pin.

Component List

ESP32 (30 pin)

I2C LCD 16x2 Screen

Relay Module 2 Channel

Wiring Details

ESP32 (30 pin)

I2C LCD 16x2 Screen

Relay Module 2 Channel

Documented Code

/*
 * This Arduino Sketch interfaces an ESP32 with an I2C LCD 16x2 screen.
 * The ESP32 displays two messages on the LCD screen in a loop with delays.
 * Connections:
 * - ESP32 GND to LCD GND
 * - ESP32 Vin to LCD VCC (5V)
 * - ESP32 D22 to LCD SCL
 * - ESP32 D21 to LCD SDA
 */

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  Serial.begin(115200);
  lcd.init();
  lcd.backlight();
  lcd.print("UNDERWATER LEAK");
  delay(2000);
  lcd.init();
  lcd.backlight();
  lcd.print("");
  delay(2000);
}

void loop() {
  delay(1000);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("CHHECK SENSORS");
  delay(2000);
}

Filename: sketch.ino

Description: The code initializes the I2C LCD screen and prints the messages "UNDERWATER LEAK" and "CHHECK SENSORS" in an alternating fashion with delays between each message. The code contains a typo in the message "CHHECK SENSORS" which should likely be corrected to "CHECK SENSORS".