Translate

Arduino-Based Variable Smart Power Supply

 1. Introduction

A variable smart power supply allows continuous adjustment of voltage for electronics experiments, testing, and prototyping. By using a DC-DC buck converter, this supply is highly efficient, generates minimal heat, and can handle higher currents than linear regulators like LM317.

Integrating Arduino allows real-time monitoring of voltage and current on an LCD, software protection, and optional digital voltage control, making it ideal for labs, DIY electronics, and robotics projects.


2. Components

ComponentQuantityDescription
                Arduino Uno      1Microcontroller to control and monitor the system
     DC-DC Buck Converter                  (LM2596)      1            Adjustable step-down voltage        module
    ACS712 Current Sensor (5A/20A)      1                   Measures load current
        16x2 I2C LCD Display      1              Displays voltage and current
      10k Potentiometer      1               Sets desired output voltage
        Push Buttons      2 (optional)          Increment/decrement voltage digitally
     Wires & Breadboard/PCBAs required                          Connections
     12–24V DC Power Supply     1                  Input to buck converter
                HeatsinkOptional                   For high-current loads

3. Circuit and Connections

Pinout Diagram of Arduino Uno R3

PInout Diagram ACS712
Pinout ACS712

Pinout Diagram of LCD with I2C
PINOUT LCD WITH I2C

Pinout Diagram LM2596
Pinout Diagram LM2596

Pinout Diagram of Push Button Module

Circuit Overview:

  1. Power Input: Connect 12–24V DC to the buck converter module.
  2. Voltage Adjustment: Arduino reads a potentiometer for voltage setpoint. Optional buttons can increment/decrement output.
  3. Current Sensing: ACS712 senses current and sends analog voltage to Arduino.
  4. Display: LCD shows live voltage and current values.

Pin Connections:

ComponentArduino PinNotes
             LCD I2C 16x2SDA → A4, SCL → A5         5V & GND connected
              ACS712 Sensor             A0Analog voltage proportional to current
              Potentiometer            A1Analog voltage input for desired output
    Buck Converter PWM/Control               D9Optional, for PWM-based voltage control
            Push Buttons      D2 & D3Optional voltage increment/decrement

Note: If your buck converter does not support PWM input, adjust the onboard potentiometer manually; Arduino will still monitor voltage/current.


4. Detailed Step by Step Circuit Working

  1. Voltage Regulation:
    The DC-DC buck converter efficiently steps down input voltage (12–24V) to the desired output. Arduino reads the potentiometer (analog input) to determine the desired output voltage. If the module supports analog control or PWM input, Arduino can adjust the voltage digitally.
  2. Current Monitoring:
    The ACS712 sensor detects current drawn by the load. Its analog output is proportional to the current, which Arduino reads to calculate the actual current in amperes.
  3. Display & Feedback:
    The 16x2 LCD displays real-time voltage and current. Users can monitor the load and adjust voltage for different devices safely.
  4. Protection:
    Arduino software can limit maximum voltage or current to prevent overload or short circuits, making it a smart, protected supply.

5. Code

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

LiquidCrystal_I2C lcd(0x27,16,2);

int currentPin = A0; // ACS712 current sensor
int potPin = A1; // Potentiometer for voltage
int pwmPin = 9; // Optional PWM control for buck converter

float voltageSet;
float currentValue;

void setup() {
lcd.init();
lcd.backlight();
pinMode(pwmPin, OUTPUT);
}

void loop() {
// Read potentiometer
int potValue = analogRead(potPin);
voltageSet = map(potValue, 0, 1023, 0, 120)/10.0; // 0-12V output

// Read current from ACS712
int currentAnalog = analogRead(currentPin);
currentValue = ((currentAnalog - 512) * 5.0 / 1023) / 0.185; // 5A sensor

// Output voltage control using PWM (if module supports)
int pwmValue = map(voltageSet, 0, 12, 0, 255);
analogWrite(pwmPin, pwmValue);

// Display on LCD
lcd.setCursor(0,0);
lcd.print("V: ");
lcd.print(voltageSet,2);
lcd.print("V ");

lcd.setCursor(0,1);
lcd.print("I: ");
lcd.print(currentValue,2);
lcd.print("A ");

delay(200);
}

6. Detailed Step by Step Code Working

  1. Libraries Initialization:
    LiquidCrystal_I2C library initializes the LCD display for voltage and current readings.
  2. Analog Inputs:
    • A1 reads potentiometer for desired voltage setpoint.
    • A0 reads ACS712 sensor analog output to measure current.
  3. Voltage Mapping:
    The potentiometer analog value (0–1023) is mapped to the output voltage range (0–12V).
  4. Current Calculation:
    ACS712 analog output is converted to current using the sensor formula:

    I=(VoutVoffset)SensitivityI = \frac{(V_{out} - V_{offset})}{Sensitivity}
  5. PWM Output:
    If buck converter supports PWM voltage control, Arduino outputs a PWM signal proportional to the desired voltage.
  6. LCD Display:
    • Top row shows voltage (V: xx.xx V)
    • Bottom row shows current (I: xx.xx A)
    • Updated every 200 ms
  7. Delay:
    Small delay ensures stable readings without flickering the display.

7. Tips

  • Ensure input voltage is always higher than desired output (at least 2–3V higher) for proper buck converter operation.
  • Add heatsink for high-current loads to prevent overheating.
  • If you want smoother voltage adjustment, use a larger potentiometer (10k–50k).
  • For digital adjustment, use push buttons for incremental changes.
  • Double-check ACS712 orientation; connecting it backwards will give negative readings.

8. Uses

  • Electronics prototyping and testing
  • Battery charging with adjustable current
  • Robotics and IoT projects
  • LED, motor, and sensor testing
  • Educational electronics lab experiments

9. Conclusion

This Arduino-based variable smart power supply combines efficiency, flexibility, and safety. Using a DC-DC buck converter ensures minimal heat and higher output current. Arduino adds intelligence, allowing real-time monitoring, software protections, and optional digital voltage control. This project is ideal for electronics labs, robotics, and DIY experimentation.

തുടക്കക്കാർക്കായി ഇലക്ട്രോണിക്സ് ലളിതമായി പഠിക്കാം.

Empowering students in Kerala with hands-on technical skills.