Variable Power Supply (Buck Converter)
by indoorgeek in Circuits > Electronics
16343 Views, 70 Favorites, 0 Comments
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
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
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
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!