Site icon Circuit Ideas for You

DIY Variable Power Supply Circuit using Arduino

To begin with, this DIY Variable Power Supply Circuit using Arduino makes changeable power, as it uses transistor and resistors to change 9V output from IC 7809 regulator.

Also, one 100uF capacitor help clean the output voltage, then two pushbuttons can change the voltage by hand and after that LCD screen show real output voltage.

Arduino Code:

#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:

ComponentsQuantity
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 and then IC 7809 give fixed 9V output if input is more than 9V then it does not changes.

After that voltage divider bring down voltage to 0 to 5V so Arduino can read it, then pin 9 of Arduino send PWM signal and PWM drive transistor like a switch.

Arduino read the small voltage and show it on LCD and then Arduino uses voltage divider calculation to find real output voltage.

Furthermore, 1k resistor control transistor base current so it control how much it work, then 100µF capacitor connect between 0 to 5V output and ground to make voltage stable and clean.

Finally, capacitor also reduces the noise and then 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:

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

Moreover, PWM duty cycle changes so output voltage also change in a set range and then LCD give feedback to check output voltage.

Therefore, we can improve the project by adding automatic voltage control or implementing more accurate voltage measurement.

Exit mobile version