Adjustable Electronic DC Load using Arduino – ALLPCB

Hello and welcome to another video of circuit digest. In this video, I’ll
show you how you can build your very own Arduino based adjustable DC load source like this
one. So a circuit like this can be very useful when you’re testing a new power source like
a newly purchased battery or DC adapter or your very own SMPSs circuit.
So what you can do with this module is you can load all these power sources in a sequential
manner. That is you can control the output current and see how they perform. To give
you a quick demonstration, let me collect this famous nine volt battery which is a really
dodgy one to a module and show you how it works. As you can see, our module has two
DC adapter plugs. One is used to power our module and the other is used to connect the
power source which has to be tested. So I’m using a 12 volt adapter to just power
our module you can use any power source, I’m just using it to power our module and as you
can see, it’s circuit edges with some logo information. And then we have three parameters
over here. One is the set value other is the current and others is the voltage. So the
set value is used to set how much current should be drained from the source here the
nine volt battery, and the I and V shows the current value of voltage and current. So you
can see two push buttons over show one is to decrease and another is to increase the
set value. So let me go ahead and connect the nine volt battery. As soon as I connect it you can see that our
module says that the battery is currently of 8.5 volts and we haven’t set any current so the current
current is zero amps. Let me go ahead and increase it 100 milliamps as soon as I increase
it 100 milliamps, the module starts to drain hundred milliamps from the battery and you
can see the voltage has already dropped to 6.68 watts. Let me increase it to 200 milliamps and the
voltage is Already lower than five volts so which means that the battery is not a very
good one and the power source is not very reliable if you’re consuming more than 200
milliamps so in this video i’ll teach you how the entire circuit works and how to build
one on your own. So let’s get started. Let’s begin by taking a closer look at the module over here. As you would have already noticed, we have
an already know nano which acts as the brain of the entire module. So whenever you connect
a DC load to this DC battery jack, the circuit gets closed through this shunt resistor and
the MOSFET. The responsibility of the Arduino is to switch the MOSFET in such a way that
the current drain from the source is equal to the current that we have said previously
using these push buttons. So this can be done using these two IDs. The
first one is MCP4921 Digital to Analog controller IC from micro chip. And the second one is
the most famous LM358 OP-Amp Talking about PCBs publication we should definitely mention
ALLPCB who’s the sponsor of this Video. ALLPCB is known for the ultra fast PCB services.
They promised 24 hands of lead time with two to five days of delivery time. They deliver
high quality PCBs and also promise 24×7 services. If you order now you can also get five PCBs
for just $2. To understand how exactly it is done, let’s take a look at the circuit
diagram. As you can see, we have the Arduino Nano over here which is connected to the LCD,
and we have the other two ICS which I told you the MCP4921 on the OP-AMP over here. So
let’s begin from this DC barrel jack section. As I told you earlier, the DC load which is
connected to this particular jack will be connected to a MOSFET and a shunt Resistor
before it reaches the ground. Now as you can see, we also have two other sisters over here
R8 and R9 which forms a potential divider. Basically what happens is this potential divider will map down the voltage that is connected
to this particular jack between zero to five. Say for example, if you connect a 24 volt
power source over here, it will convert it into five volt so that your Arduino can easily
feed it. So if you can see this, potential divider maps don’t zero to 24 volts to zero
to five volts and it uses a voltage sense label which is connected to the A1 pin of
our Arduino. Now to measure the current we are going to use this Shunt resistor As you
can see the value of the Shunt resistor is 0.1 ohms and five watts. This means that when
one amps of current is being drained from the load, the voltage drop across the shunt
resistor will be 0.1 mode, which is a very small value, and that is why we are going to use an op amp to amplify it. So let’s forget about this one over here. Let’s take a look at only this op-amp. As
you can see the Op-Amp directly reads the voltage drop across the Shunt Resistor and
increases it with the gain value of six the resistors R5 and R6 which is of 2K and 6K is used to set
the gain value of Op-Amp. In this case it is six. So what happens is this 0.1 volt drop
across the shunt Resistor will be increased to 0.6 volt because of this op amp. Now again,
it has a label called current sense, which is connected to our Arduino over here to the
analog pin A0, so whit this the Arduino will be able to read the current as well as the voltage of the power source
that’s connected to this DC barel Jack jack. Now all it has to do is to switch this
MOSFET in such a way that the current that is being read from this pin is equal to the
current that we have set already using the push button. To understand how the current
regulation part works, let’s take a look at this Op-Amp. So let me just cover this Op-Amp.
And if you take a closer look at this op-amp, you can see that the pin number two is actually
connected to measure the voltage drop across the shunt resistor again, and pin number three
is connected to our DAC which I will get back to it and the output pin is directly connected to the
MOSFET. So the oppan can either turn on or off the MOSFET directly. So let’s go back
to our example bad there is 1A of current flowing through the circuit. And in that case,
we’ll have a voltage drop of 0.1 volt across the Shunt Resistor. In this case the open
will read this voltage drop and hence the voltage here will also be 0.1 volt and based
on the voltage given to pin number three the open will either turn on or off the MOSFET.
So, let’s say for example, if we give 0.1 volt to this pin, then out MOSFET will be
turned on as far as the voltage across this resistor is 0.1 volt, if the voltage increases
the MOSFET will be turned off, this will be kept on repeated, like if the voltage exceed
0.1 the MOSFET will turn off and hence the current will go down and when the current
goes down the OP-Amp will that we have a DC which is the realize that the voltage has gone below 0.1
volt and it will turn on the MOSFET again and the current will rise back to one amps
and the voltage drops will again be 0.1 volt. So, this way whatever voltage we are giving
to this pin number three, the Op-Amp will make sure that the voltage drop across the
shunt resistor will be equal to the voltage given to pin number three. So, if you want
to increase the current we just have to change this voltage to 0.2 volt and the op amp will
keep the MOSFET turned on As far as the current flowing through this circuit creates a voltage
drop across this shunt resistor which is equal to 0.2 volts, which will also make the number
2 at 0.2 volts. So, the op amp will now keep this MOSFET turned on as far as the voltage
is 0.2 volts and it will turn it off when the voltage exceeds 0.2 volts. So, this way
whatever voltage is given to pin number three based on that voltage, the Op-Amp will control
the current flowing through the circuit. So, this is what is called a voltage controlled
current source. So, now all we have to do is provide a variable voltage to pin number
three and to do MCP4921 this IC. So, this IC is interfaced with already
know through SPI communication. So, from the Arduino we can tell Hey MCP just set the voltage
to 0.1 volt and the Arduino will Talk to your MSP with SPI communication and your MCP will provide
an awesome voltage which is exactly equal to 0.1 volts so based on the voltage and the
current value that we have set here, you Arduino will ask your MCP to set the analog voltage
over here and as I told you based on this analog voltage, the current for the MOSFET can be controlled. So this is how the entire circuit diagram books hope you understood
it. So once you’re comfortable with the circular
diagram, you can modify it according to our needs. For example, here I have used a five
watts resistor, which allows me to control current up to five amps and the potential
divider allows me to control load up to 24 volts. So once you have understood how the
whole circuit works, you can make few changes if required, like changing the output voltage
and the current rating of the circuit and then proceed with PCB design. I have used
Eagle to design my PCB and the final file look something like this. You can use any
software but once the design is complete, you can generate a Gerber file like this one.
Once your Gerber file is ready, we can proceed with PCB fabrication to get your PCBs from
ALLPCB you just have to get into their website. And over here you have to enter the dimension
of your PCB like mine, let’s assume 100x80mm and select the number of PCBs required and
then click on quote now. This will take you to another page where you can select few other
parameters like the number of layers, and if you come down you can even select the color
of your PCB that is the solder mask color, and few other parameters if you like to explore.
On the right hand side we have some interesting parameters which is like your shipping method and the lead time. For example, if you’re selecting
DHL, the shipping will be for three to seven days. And you can even change it to Hong Kong
post if you want a cheaper shipping, but let’s select DHL and click on Add to cart
to proceed with a checkout. Now just click Checkout now, and this will take you to another
page which gives you option to upload the GERBER File. To upload your Gerber file just
click on Upload Gerber and we already have our Gerber file ready just click on it. And
once the upload is complete, go ahead and click on buy. On the next page you have an
option to add a new address. And down here you can check the total price that you have
to pay for your PCB there are two payment methods. One is through PayPal and other through
bank transfer, select your mode of payment and then click on Submit. This will take you
to another page where you have to make the payment once the payment is made, sit back
and relax. And within few days your PCB will arrive at your doorstep. After few days I
received a package from a courier guy and as you can see for yourself, it was from ALLPCB.
The packaging was very neatly done and on unboxing I found our new PCBs neatly wrapped
under a bubble sheet. As you can see for yourself, there was no damaging made during the shipping
process and everything looks intact. So let me cut it open and bring a new PCBs outside.
As you can see for yourself, the quality of the PCB was very good so immediately proceeded
with soldering all the components and uploaded the code to our Arduino board. The Arduino
code for our project is pretty simple. The complete code along with its explanation can
be found at the link given in the description of this video. There are three important functions
one of which is to Convert_DAC, which is used to communicate with the MC P DAC IC. So this
function passes a value called value and it is used to control the output voltage from
the IC other than that we have the read current and read voltage function which is used to
read the voltage and current of the DC loop. inside the loop we have two important functions
which reads the status of the push buttons that is used to increase or decrease the set
current value. Based on the status of the push button we generate a value on the variable
called number and pass it to our DAC using the Convert underscore DC function. Apart
from that we have few other basic LCD functions which is used to display the set current,
the actual current and the actual voltage on our LCD. So once the code is ready, you
can upload it to your Arduino Nano and be ready to test your project. For testing a setup I have connected 7.4 volt lithium battery to our DC Jack over
here and I have powered using the 12 volt adapter as usual. So as you can see the set
value is currently zero mA and the battery voltage is at 7.5 volts and the current is
also zero since the set value is zero I have also connected my clamp meter to compare the
reading shown on the LCD display with the actual value that’s being measured by the
Clamp Meter. So now let me go ahead and increase the current. As you can see, I have increased
the set value to 100 mA and the current draw is now 100 milliamps and the voltage has dropped
from 7.5 volts to 7.3 volts and the multimeter here is also showing around 0.14, there is
some error and I was not able to calibrate it very perfectly, but this is by far the
most accurate value that I could get. So if I increase it to 200 milliamps, you can see
the multimeter actually reads to 220 milliamps, but the voltage has dropped to 6.8 was already
just for consuming 200 millions. Let me go ahead and increase it to 300. And you can
see the multimeter also shows 300 milliamps Exactly. So this is the sweet spot of the
calibration and the voltage has dropped to 6.8 volts. Let me go ahead and increase the
load further. 400 milliamps, the multimeter shows 400 mA and the voltage has dropped to
6.3 volts. Let me go ahead and increase it further to 500 milliamps. The voltage is already
6.2. Let me just go up to 700 milliamps, and you can see the voltage is almost six Volt.
And I think this is the maximum current that I could load this battery for. So this way
you can also leave the battery in such a state and see how far your battery is able to discharge
this particular current. Here, I’m not risking loading the battery because there is a safety
circuit inside this battery. But if you’re using a battery that doesn’t have a safety
circuit, be careful that you’re not overloading the battery. So let me just increase the current
to 800 milliamps. So you can see the multimeter is still reading 740 mA when you’re doing
some heavy loading, just make sure you’re adding a heatsink to your MOSFET because the
most would would would get really, really hot. And let’s just go up to one amps. So
this is one amps, the multimeter also reads 900 milliamps, but you know, even the multimeter
is not to the mark. So let’s just assume that One amps and the voltage just dropped to 5.3
volts. I think this is the maximum I could go with this battery. But let me just go to
1.2 and as you can see at 1.2 the multimeter also reads 1.12 so let’s decrease go back
all the way down to 300 milliamps Okay, so this way you can set the current and then
monitor how far your battery is able to supply that continuous
current. It just it doesn’t need to be a battery you
can also use an SMPS circuit and see at work loading current your smps shuts down. So there are so many advantages for using this adjustable DC load. Hope you liked the project
and enjoyed this video. Thank you for watching. Bye bye Transcribed by

One comment on “Adjustable Electronic DC Load using Arduino – ALLPCB”

  1. Elektronik Atölyem says:

    Excellent project

Leave a Reply

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