• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Circuit Ideas for You

Get free circuit ideas online.

  • Home
  • Privacy Policy
  • About
Home » DIY Variable Power Supply Circuit using Arduino

DIY Variable Power Supply Circuit using Arduino

Last updated on 25 August 2024 by Admin-Lavi Leave a Comment

This project DIY Variable Power Supply Circuit shows how to use an Arduino Uno board to generate a variable power source.

A transistor and resistors are used to modify the circuits steady 9V output, which is produced by an IC 7809 voltage regulator.

A 100uF capacitor filters the output voltage.

The output voltage may be manually adjusted using two pushbuttons.

Actual feedback on the current output voltage is provided by an LCD monitor.

Coding with Explanation:

#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);
}
  • Include is the Liquid Crystal library for controlling LCD displays.
  • Setup prints a greeting, initializes the LCD screen, and configures the input and output pins.
  • Loop constantly assesses the push buttons condition.
  • The duty cycle rises when button 1 is pressed and falls when button 2 is pressed.
  • The PWM output is then controlled by the duty cycle, which modifies the voltage.
  • The LCD shows the output voltage at this moment.

Circuit Working:

DIY Variable Power Supply Circuit  Diagram using Arduino

Parts List:

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

The variable power supply circuit is powered by the Arduino Uno.

TThe output of the 7809 is set at 9V.

The output voltage is fixed as long as the input voltage is more than 9V since it is not adjustable.

The output voltage is lowered by the voltage divider to a value that the Arduino can read, between 0 and 5V.

Pin 9 of the Arduino Uno produces a PWM signal.

Driven by the PWM signal, the transistor functions as a switch.

The scaled voltage is read by the Arduino and shown on the LCD.

The scaled reading is converted to the real output voltage using the voltage divider factor.

Resistor 1k control the transistors base current, which in turn affects the transistors conduction.

To stabilize the output voltage, connect an 100µF capacitor between the output pin 0-5V and ground.

To cut down on noise, the capacitor 100µF filters the output voltage.

The current output voltage is shown on the LCD monitor.

How to Build:

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

  • Gather all the components as shown in the above circuit diagram.
  • Connect a regulated IC1 7809 to provide a regulated 9V DC to the Arduino board.
  • Connect Tactile switch button1 one leg from pin 7 on the Arduino board and other leg to ground.
  • Connect Tactile switch button2 one leg from pin 8 on the Arduino board and other leg to ground.
  • Connect one 100k resistor between pin 7 and positive 5V on Arduino board.
  • Connect other 100k resistor between pin 8 and positive 5V on Arduino board.
  • Connect R/W on the LCD display with the ground supply on the Arduino
  • Connect Transistor 2N2222 collector to the 5V power supply, connect base to pin 9 on Arduino board through resistor 1k, and connect emitter to 0-5V output.
  • Connect capacitor 100µF positive leg to 0-5V output and negative leg to negative of output.

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 shows how to use an Arduino Uno to create a variable power source in a simple and efficient manner.

Within a specific range, the output voltage may be changed by varying the PWM signals duty cycle.

An important source of feedback for keeping an eye on the output voltage is the LCD display.

By including features like automated voltage control or a more accurate voltage measurement, this project may be improved even further.

References:

Arduino Based VARIABLE Powersupply

Filed Under: Arduino Projects, Power Supply Circuits

About Admin-Lavi

Lavi is a B.Tech electronics engineer with a passion for designing new electronic circuits. Do you have questions regarding the circuit diagrams presented on this blog? Feel free to comment and solve your queries with quick replies

Previous Post: « Digital Code Lock Circuit using Arduino
Next Post: Exploring the Reality of Free Energy: Debunking Myths and Understanding Conservation Principles »

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Categories

  • Alarm Circuits (30)
  • Amplifier Circuits (67)
  • Arduino Projects (29)
  • Audio Circuits (93)
  • Automobile Circuits (19)
  • Battery Charger Circuits (48)
  • Free Energy (13)
  • Heater and Temperature Controllers (9)
  • Indicator Circuits (38)
  • Inverter Circuits (13)
  • LDR Circuits (13)
  • LED and Lamps (111)
  • Meters and Testers (27)
  • Motor Controllers (18)
  • Oscillator Circuits (32)
  • Power Supply Circuits (91)
  • Remote Control Circuits (6)
  • Security and Protection (23)
  • Sensors and Detectors (71)
  • Solar Circuits (16)
  • Timer Circuits (27)
  • Transistor Circuits (56)
  • Transmitter Circuit (12)
  • Tutorials (4)
  • Water Level Controller (4)

Copyright © 2025 | New Circuit Ideas