Header Ads

Header ADS

Build a 12V Battery Autocut System with LCD Display

Build a 12V Battery Autocut System with LCD Display

Are you looking for an efficient and affordable way to protect and monitor your 12V battery system? In this tutorial, we will guide you through the process of creating a 12V Battery Autocut System with an LCD display for monitoring. This project is ideal for DIY enthusiasts and makers who want to control charging and discharging cycles automatically.

Below, we'll cover the complete circuit design, list of components, and code required for this project. The design is based on the ATmega328P microcontroller and features a 16x2 LCD for easy status updates.

$5 10pcs 1-2 layer PCB Order from PCBWay: https://www.pcbway.com/?from=technology4power
💡 PCBWay 7th Project Design Contest: https://www.pcbway.com/activity/7th-project-design-contest.html



Circuit Diagram

The circuit diagram provides a clear layout of how components should be connected. You can view it in the image provided above. Below is a description of the key elements:



Key Components

  1. ATmega328P: Acts as the brain of the system, handling voltage sensing and relay control.

  1. 16x2 LCD Display: Displays the current battery voltage, charging status, and load status.

  2. Relays: Controls the connection of the load and charger to the battery.

  3. Voltage Divider (10kΩ and 5.6kΩ): Reduces the battery voltage to a level suitable for ADC input.

  4. Buttons: Used for manual full-cut and low-cut settings.

  5. Diodes (1N4007/1N5408): Prevent reverse current and protect the circuit.

  6. BC547 Transistors: Drives the relays.


Pin Configuration

  • LCD Pins:
  • RS: Pin 4
  • E: Pin 3
  • D4-D7: Pins 5-8
  • Relays:

    Load Relay: Pin 13
  • Charge Relay: Pin 12
  • Voltage Sensing:

  • Analog Pin A0

  1. Ensure proper connections as shown in the schematic diagram to avoid errors.


PCB Design & Order from PCBWay.com

To make your project more professional and reliable, designing a PCB is a great choice. With PCBWay.com, you can easily create and order your custom PCB for this project. Here’s how:


Design Your PCB:

  1. Use software like EasyEDA or KiCAD to create the PCB layout based on the schematic.
  2. Ensure proper placement of components such as the ATmega328P, relays, voltage divider, and LCD.

$5 10pcs 1-2 layer PCB Order from PCBWay: https://www.pcbway.com/?from=technology4power
💡 PCBWay 7th Project Design Contest: https://www.pcbway.com/activity/7th-project-design-contest.html

1. Upload to PCBWay:

  1. Export the Gerber files from your PCB design software.
  2. Visit PCBWay.com and create an account.
  3. Upload your Gerber files and select specifications like PCB size, layer count, and color.

2. Order and Assemble:

  1. Place your order and wait for the PCB to be delivered.
  2. Once you receive the PCB, solder the components following the layout.

Using PCBWay ensures high-quality PCBs at an affordable price. They also provide assembly services if you prefer a ready-to-use board.


Code for the 12V Battery Autocut System

Below is the Arduino code for this project:

#include <LiquidCrystal.h>

// Pin Definitions
#define LOAD_RELAY_PIN 13
#define CHARGE_RELAY_PIN 12
#define VOLTAGE_SENSOR_PIN A0

// LCD Pin Configuration
LiquidCrystal lcd(4, 3, 5, 6, 7, 8);

// Voltage Cutoff Levels
#define FULL_CUT_VOLTAGE 13.6  // Maximum voltage before charging stops
#define LOW_CUT_VOLTAGE 10.6  // Minimum voltage before load disconnects

// Variables
float batteryVoltage = 0;

void setup() {
  lcd.begin(16, 2);  // Initialize the LCD
  lcd.print("12V AutoCut");
  delay(2000);

  // Configure relay pins as output
  pinMode(LOAD_RELAY_PIN, OUTPUT);
  pinMode(CHARGE_RELAY_PIN, OUTPUT);

  // Start with relays off
  digitalWrite(LOAD_RELAY_PIN, LOW);
  digitalWrite(CHARGE_RELAY_PIN, LOW);
}

void loop() {
  // Read battery voltage
  int sensorValue = analogRead(VOLTAGE_SENSOR_PIN);
  batteryVoltage = (sensorValue / 1023.0) * 5.0 * ((10.0 + 5.6) / 5.6); // Adjust for voltage divider

  // Update LCD Display
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Battery: ");
  lcd.print(batteryVoltage);
  lcd.print("V");

  // Check voltage levels and control relays
  if (batteryVoltage > FULL_CUT_VOLTAGE) {
    digitalWrite(CHARGE_RELAY_PIN, LOW);  // Stop charging
    lcd.setCursor(0, 1);
    lcd.print("Charging: OFF");
  } else {
    digitalWrite(CHARGE_RELAY_PIN, HIGH); // Start charging
    lcd.setCursor(0, 1);
    lcd.print("Charging: ON ");
  }

  if (batteryVoltage < LOW_CUT_VOLTAGE) {
    digitalWrite(LOAD_RELAY_PIN, LOW);    // Disconnect load
    lcd.setCursor(0, 1);
    lcd.print("Load: OFF    ");
  } else {
    digitalWrite(LOAD_RELAY_PIN, HIGH);   // Connect load
    lcd.setCursor(0, 1);
    lcd.print("Load: ON     ");
  }

  delay(1000);  // Update every second
}


Code Explanation

  1. Voltage Measurement: The battery voltage is sensed through a voltage divider and converted to a readable value using the ADC.

  2. Relay Control Depending on the voltage levels, the relays are turned on or off to control charging and load connection.

  3. LCD Updates: The current status (voltage, charging, and load state) is displayed on the LCD.


Step-by-Step Assembly Instructions

  1. Gather Components: Collect all required components listed above.

  2. Connect the Circuit: Use the schematic diagram to connect all components accurately.

  3. Upload Code: Use the Arduino IDE to upload the code to the ATmega328P microcontroller.

  4. Test the System: Power the circuit and monitor the LCD for status updates. Verify the relays are working as expected based on voltage thresholds.


Applications

  1. Solar charge controllers
  2. Battery protection systems
  3. DIY battery management systems

This project ensures the longevity of your battery by preventing overcharging and deep discharging. With a straightforward design and reliable components, you can easily build your own 12V Battery Autocut System.


Video Reference:


$5 10pcs 1-2 layer PCB Order from PCBWay: https://www.pcbway.com/?from=technology4power
💡 PCBWay 7th Project Design Contest: https://www.pcbway.com/activity/7th-project-design-contest.html



No comments

Theme images by Bim. Powered by Blogger.