Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

ESP32 Controlled I2C LCD Display for EV Charging Status

Image of ESP32 Controlled I2C LCD Display for EV Charging Status

Circuit Documentation

Summary

This circuit integrates an ESP32 microcontroller with an I2C LCD 16x2 screen, a DC power source, an HC-SR04 Ultrasonic Distance Sensor, and a 2-channel relay module. The ESP32 is programmed to display messages on the LCD screen. The power for the circuit is provided by a 5V DC source, which powers both the ESP32 and the LCD screen. The ESP32 communicates with the LCD screen via the I2C protocol using its dedicated SDA and SCL pins.

Component List

ESP32 (30 pin)

  • Description: A microcontroller with Wi-Fi and Bluetooth capabilities, featuring a wide range of GPIO pins.
  • Pins: EN, VP, VN, D34, D35, D32, D33, D25, D26, D27, D14, D12, D13, GND, Vin, D23, D22, TX0, RX0, D21, D19, D18, D5, TX2, RX2, D4, D2, D15, 3V3

I2C LCD 16x2 Screen

  • Description: A 16x2 character LCD display that uses the I2C bus for communication.
  • Pins: SCL, SDA, VCC (5V), GND, VDD, VO, RS, RW, E, D0, D1, D2, D3, D4, D5, D6, D7, BLA, BLK

DC Source 5V

  • Description: A power supply module that provides a regulated 5V output.
  • Pins: VCC, GND

HC-SR04 Ultrasonic Distance Sensor (Wokwi Compatible)

  • Description: A sensor that measures distance by emitting ultrasonic waves and measuring the time taken for the echo to return.
  • Pins: VCC, TRIG, ECHO, GND

Relay Module 2 Channel

  • Description: A module with two relays that can control the power to other devices.
  • Pins: GND, IN1, IN2, VCC, NC1, COM, NO1, NC2, NO2

Wiring Details

ESP32 (30 pin)

  • GND connected to common ground.
  • Vin connected to 5V from the DC Source.
  • D22 (SCL) connected to SCL on the I2C LCD Screen.
  • D21 (SDA) connected to SDA on the I2C LCD Screen.

I2C LCD 16x2 Screen

  • SCL connected to D22 on the ESP32.
  • SDA connected to D21 on the ESP32.
  • VCC (5V) connected to 5V from the DC Source.
  • GND connected to common ground.

DC Source 5V

  • VCC connected to Vin on the ESP32 and VCC (5V) on the I2C LCD Screen.
  • GND connected to common ground.

HC-SR04 Ultrasonic Distance Sensor (Wokwi Compatible)

  • Wiring details not provided.

Relay Module 2 Channel

  • Wiring details not provided.

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("Welcome");
  delay(2000);
  lcd.init();
  lcd.backlight();
  lcd.print("EV CHRG");
  delay(2000);
}

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

The code initializes the I2C LCD screen and prints a welcome message followed by "EV CHRG". In the loop, it periodically clears the screen and prints "SLOT1".