Variable Power Supply (Buck Converter)

by indoorgeek in Circuits > Electronics

16162 Views, 70 Favorites, 0 Comments

Variable Power Supply (Buck Converter)

YouTube Thumbnail 22.jpg
Make a Variable Power Supply | Buck Converter

A power supply is an essential device when you are working with electronics. If you want to know how much power your circuit is consuming, you will need to take voltage and current measurements and then multiply them to get power. Such a time-consuming work. This becomes even more difficult if you want to continuously monitor the power over a period of time. Well, let your microcontroller do all the hard work. In this video, we will see how to make a cheap variable power supply and learn its working.

Let's get started!

Buck Converter and Its Working

Sequence 01.00_00_51_00.Still003.jpg
Sequence 01.00_01_01_02.Still004.jpg
Sequence 01.00_01_07_20.Still005.jpg
Sequence 01.00_01_15_07.Still006.jpg
Sequence 01.00_01_32_09.Still008.jpg
Sequence 01.00_01_34_16.Still009.jpg
Sequence 01.00_01_43_23.Still010.jpg
Sequence 01.00_02_01_27.Still011.jpg
VID_20181210_190350.mp4.00_00_57_19.Still001.jpg
Sequence 01.00_02_08_24.Still012.jpg

Let us take a look at this module based around LM2596 IC which gives variable DC voltage at its output terminals. To study the circuit deeply, I took out my multimeter, put it in continuity mode and started probing to find what is connected to what. After some probing, I came up with the circuit as shown. This is a Buck Converter, also known as a step-down converter. Varying the potentiometer gives any voltage between 1.25V and the input voltage. By taking a look at the datasheet of LM2596 we can see that it is a simple switching device with some features which we can ignore for now.

So for clear understanding, we can replace some part of the circuit with a simple switch as shown in the picture.

Case 1: Switch is closed (Ton)

When the switch is closed, current flows through the load. This energizes the inductor which stores energy in its magnetic field. The diode is reverse biased and acts as an open circuit.

Case 2: Switch is open (Toff)

When the switch is open, the inductor’s magnetic field collapses which induce an emf and hence current flows through the load and diode which is now forward biased.

The job of the capacitor is to reduce the ripple content in the output waveform. This is done again and again.

The current flowing through the load will look like as shown in the picture. The current will rise during Ton and fall during Toff. By doing some maths, we can come up with the formula

Vout = α x Vin

where ‘α’ is known as the duty cycle which is equal to Ton/T. As α varies from 0 to 1, we can see that the output voltage is the fraction of the input voltage.

Things You Will Need

Sequence 01.00_02_39_01.Still013.jpg

1x Arduino of your choice (smaller the better)

1x INA219 Power Monitor

1x LM2596 Module

1x LM7805 Voltage Regulator

1x OLED Display (128 x 64)

1x DC Power Socket

2x Terminal blocks

1x SPDT switch

1x 10k Potentiometer (Use a precision 10 turn pot if possible)

1x Enclosure box

Let's Get to the Build

IMG_20181206_175657-01.jpeg
Sequence 01.00_02_43_28.Still014.jpg
Sequence 01.00_02_50_23.Still015.jpg
Sequence 01.00_03_18_09.Still018.jpg
Sequence 01.00_03_26_02.Still019.jpg
Sequence 01.00_03_00_27.Still016.jpg
Sequence 01.00_03_06_25.Still017.jpg
Sequence 01.00_03_28_21.Still020.jpg
Sequence 01.00_03_35_04.Still021.jpg

Enough of the theory. Let us gather all the required components and build a cheap little power supply using this converter. The circuit diagram and code are attached hereby. Make sure you install SSD1306 and INA219 libraries by Adafruit.

To get all the required measurements, I went with INA219. It is a Bidirectional Power Monitor with I2C. This tiny device makes the job of measuring current easy.

We will be using just two pins of the Arduino for I2C. I only had Arduino Nano at the time of making the project. A smaller alternative can be used.

I desoldered the tiny potentiometer which was on the PCB and replaced it with a 10k potentiometer which was attached in the front of the box. If possible, use ten turn precision potentiometer. This will help in making fine adjustments.

A small 0.96 inch 128x64 OLED display is used to display all the measurements from INA219.

Finally, a small enclosure for everything to fit in. Be creative in choosing the layout for the components as long as it is sensible.

Enjoy!

That's it! Upload the code and start playing with your little device. Just remember that the maximum current which can be drawn from the converter is 3A. This type of module does not have any protection against short circuit.

Thank you for sticking till the end. Hope you all love this project and learned something new today. Let me know if you make one for yourself. Subscribe to my YouTube channel for more upcoming projects. Thank you once again!