Site icon Circuit Ideas for You

DIY Variable Power Supply Circuit using Arduino

This DIY Variable Power Supply Circuit using Arduino makes changeable power.

It uses transistor and resistors to change 9V output from IC 7809 regulator.

One 100uF capacitor help clean the output voltage.

Two pushbuttons can change the voltage by hand.

LCD screen show real output voltage.

Coding:

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int button1 = 7;
int button2 = 8;
int pwmPin = 9;

int dutyCycle = 0;

void setup() {
  lcd.begin(16, 2);
  lcd.print("Variable Power Supply");
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
  pinMode(pwmPin, OUTPUT);
}

void loop() {
  if (digitalRead(button1) == HIGH) {
    dutyCycle++;
    if (dutyCycle > 255) {
      dutyCycle = 255;
    }
  } else if (digitalRead(button2) == HIGH) {
    dutyCycle--;
    if (dutyCycle < 0) {
      dutyCycle = 0;
    }
  }

  analogWrite(pwmPin, dutyCycle);

  lcd.setCursor(0, 1);
  lcd.print("Voltage: ");
  lcd.print(dutyCycle * 9 / 255);
  lcd.print("V");
  delay(100);
}

Code Explanation:

Circuit Working:

DIY Variable Power Supply Circuit  Diagram using Arduino

Parts List:

ComponentQuantity
Resistors
1k 1/4 watt1
100k 1/4 watt2
Capacitor
100µF 25V1
Semiconductors
Arduino Uno Board1
LCD 16X21
IC 78091
Tactile switches2
Transistor 2N22221

Arduino Uno give power to this variable power supply circuit.

IC 7809 give fixed 9V output if input is more than 9V then it does not changes.

Voltage divider bring down voltage to 0 to 5V so Arduino can read it.

Pin 9 of Arduino send PWM signal.

PWM drive transistor like a switch.

Arduino read the small voltage and show it on LCD.

Arduino uses voltage divider calculation to find real output voltage.

1k resistor control transistor base current so it control how much it work.

100µF capacitor connect between 0 to 5V output and ground to make voltage stable and clean.

Capacitor also reduces the noise.

LCD show the voltage at that time.

How to Build:

To build a DIY Variable Power Supply Circuit using Arduino follow the below mentioned steps for connections:

Connect 2N2222 transistor:

Connect 100µF capacitor:

LCD Connections to Arduino Uno Board:

Arduino PinLCD PinFunction
2RSRegister Select
3ENEnable
4D4Data Bit 4
5D5Data Bit 5
6D6Data Bit 6
7D7Data Bit 7
11Backlight+Positive supply for backlight
12Backlight-Negative supply for backlight
5VVCCPositive supply for LCD
GNDGNDGround for LCD

Conclusion:

This project for DIY Variable Power Supply Circuit using Arduino show how make simple and easy variable power source.

PWM duty cycle changes so output voltage also change in a set range.

LCD give feedback to check output voltage.

Project can be made better by adding auto voltage control or more accurate voltage reading.

References:

Arduino Based VARIABLE Powersupply

Exit mobile version