Smart IoT-Based Changeover System for DC Freezers Using ESP32

by olaideagbolade1 in Circuits > Arduino

51 Views, 0 Favorites, 0 Comments

Smart IoT-Based Changeover System for DC Freezers Using ESP32

2.jpg

Hello, IoT enthusiasts! Today, I'm excited to share a project where I developed a smart IoT-based changeover system to optimize the use of solar energy for a DC freezer. During peak sunlight hours, when I’m usually not at home, my solar panels generate the most energy. This project ensures my DC freezer switches seamlessly between grid power and solar energy based on availability, maximizing efficiency.

I specialize in creating smart IoT solutions like this one, helping users automate and optimize their energy usage, and I’m thrilled to share the details of this project. If you’re interested in building something similar or have custom requirements, keep reading to see how you can get in touch!

Project Overview:

This project uses an ESP32 microcontroller to control a DC freezer, switching between two DC power sources: the grid (via an AC to DC converter) and a 12V, 200Ah deep-cycle battery of my solar installation. The system ensures that the freezer is powered primarily by solar energy when available, while also being connected to the grid as a backup source.

Supplies

ESP32 Microcontroller

Voltage Divider Circuit (10k and 3.3k resistors)

Voltage sensing Circuit (10K and 2.2k resistor)

5v relay module

SPDT switch (for bypass)

Push Switch

LCD1602

LM2596 Buck converter

Connectors

Power Supply

The two major components in the setup are the ESP32 microcontroller and the ESP32 microcontroller and the 5V voltage relay module. I powered the entire setup using LM2596 switching regulator. The system draw power from my 12v 220ah deep cycle battery through my solar charge controller from my solar installation. The LM2596 steps down the 12v to a confortable 5V for the microcontroller, the lcd and the relay module

Inputs and Outputs Setup

My project provides the following information:

Solar Inverter battery voltage. I used a 10K and 2.2k resistor for a voltage divider circuit on the ESP32 ADC to calculate my battery voltage

Grid presence or absence. I used a 10K and 3.3k resistor to provide 3v on a digital pin on the ESP32. A high indicates grid presence and a low indicates otherwise.

I also used a 10K and 3.3k resistor to provide a feedback on whether the freezer is on or off.

My connections on the ESP32 are as follows:

  1. GPIO 18 (Input): Monitors whether the load (freezer) is running. If the pin reads high (3.3V), it indicates that the freezer is active. The system then sends a status update to the ThingSpeak server.
  2. GPIO 19 (Input): Detects grid availability. A high signal on this pin means the grid is available, prompting a status update to ThingSpeak.
  3. GPIO 21 (Output): Receives commands from ThingSpeak, allowing remote control of the freezer. This pin is set high or low based on commands sent via the ThingSpeak server.
  4. GPIO 22 (Output): Manages the switching logic. If the grid is available (pin 19 is high) and the freezer is not actively being controlled (pin 21 is low), the system waits 5 minutes before setting pin 22 high. If pin 21 is already high, it waits only 15 seconds before activating pin 22.
  5. ADC Pin 32 (Input): Reads the battery voltage through a voltage divider circuit. The ESP32 periodically updates the battery voltage status on the ThingSpeak server.


Monitoring and Communication

At first, I used a sim800 internet shield module for connectivity. After network issues with this module, i ditched it for the native wifi that came with the ESP32.

Warning: If you ever want to use SIM800 for your project, you must be aware that this module is limited to 2G and has a very small buffer memory plus you need to fine tune your code to arrest every potential issues that may arise down the line. Also Sim800 may be good for hobbyist project that is meant to run for just a few hours but for a project that is meant to run continuously for months and that requires data security, SIM800 is not the right module to use.

The wifi approached worked better and limited latency. I used thingspeak for my backend server with two different channels. One channel to read data from an android app that is used to remotely turn the freezer on or off and the second channel receives battery voltage, grid status and inverter status from the developed hardware. I send data to thingspeak every 35 seconds and update this to my android app. The device also read the status of the second channel to know if a command has been issued to turn on or off the freezer.

The Android App

android app.jpg

I built a minimal android app to get feedback from the hardware as well as to turn on and off the device.The app displays both internet and server connection status. It also shows battery, grid and freezer status as well as the current power source of the dc freezer. There are also two buttons which is used to select the desired power source and a timestamp at the base of the app to show when the data were fetched.

Programming and Installation

1.jpg

I programmed the entire hardware using Arduino IDE and installed it on the wall. I ensured the device has a bypass switch to ensure I can manually turn on or off my freezer in case something goes wrong.

Boom and everything is done nice and well.

In the afternoon, when solar panels are producing optimal energy, the system prioritizes solar energy to power the freezer. If the grid becomes available and the solar power isn’t sufficient, the system waits for a set period before switching to the grid, ensuring there’s no unnecessary switching that could damage the freezer.

With the ThingSpeak platform, Ican easily monitor the battery voltage, grid availability, and freezer status in near real time. Additionally, Ican remotely control the system by sending commands to the ESP32 through ThingSpeak, ensuring full control no matter where I am.

If you’re inspired by this project and would like assistance with designing or developing a similar system, feel free to reach out! You can check out more of my projects and services through my portfolio here or get in touch for custom solutions.