Arduino Forum

Using Arduino => General Electronics => Topic started by: terraduino on May 17, 2017, 11:05 pm

Title: Adjustable current load with µC
Post by: terraduino on May 17, 2017, 11:05 pm
I was testing a rechargeable battery with 11 resistors in parallel that draw approx. 200 mA @ 4V.
While the battery depleted and voltage dropped, the load decreased due to ohms law. I already searched for "constant current load" but I do not have the parts that are usually needed.

I came up with the idea to use an ATTiny13ATmega328--but anymost µC would do--to drive NPN transistors, i.e. 2N2222, to add load dynamically. I know this is not very precise but that does not matter. Keep the current variation constant by, for example, 20mA would be good enough. Let's say I use 250 Ohm resistors.

Does the attached schematic work in general?
The max voltage of the battery to test will be in the range of 1.4-5.6V.
The ATmega328 will have its own power supply and I will measure the remaining voltage add load.
If useful, I have NE555, PNP transistors and some p-Mosfet at hand. Maybe there is another way to add load dynamically with one or more ATmega328?

If there are other and/or easier solution, feel free to tell me.

Thanks & best
Title: Re: Adjustable current load with µC
Post by: allanhurst on May 17, 2017, 11:41 pm
Hmmm.. not how I'd do it.

Something like the enclosed would do the job.

If you want to drive it with PWM from an arduino. tgo set the current  drive the chain at  the top of R3 with a well - filtered arduino output and remove the 1.2v reference..

Allan
Title: Re: Adjustable current load with µC
Post by: terraduino on May 18, 2017, 12:01 am
Thanks for your feedback.
Unfortunately, I don't have an LM358 or any other op-amp. :(
Title: Re: Adjustable current load with µC
Post by: allanhurst on May 18, 2017, 12:08 am
They're very cheap..

Allan
Title: Re: Adjustable current load with µC
Post by: terraduino on May 18, 2017, 12:30 am
You're right, unfortunately, that does not change the fact that I don't own one ;). In addition, in my small town there is not a single shop for electronics. :( Order online needs time to deliver ...
Title: Re: Adjustable current load with µC
Post by: Wawa on May 18, 2017, 01:43 am
A basic 20mA current sink can be made with a (2N2222) transistor, two (1N4148) diodes, and two resistors.

33ohm resistor (sets the current) from emitter to ground.
Two diodes in series from base to ground.
10k resistor from base to 5volt. Or to an Arduino output pin, to switch the circuit on/off.

Connect the battery to drain to the collector.
Google "current sink" (images) for more circuit diagrams.
Leo..

Title: Re: Adjustable current load with µC
Post by: edgemoron on May 18, 2017, 02:41 am
Try this:
(https://forum.arduino.cc/index.php?action=dlattach;topic=478035.0;attach=212316)
Title: Re: Adjustable current load with µC
Post by: allanhurst on May 18, 2017, 03:28 am
The op wants a 200mA drain... not 20.   Hence max dissipation is 5.6 x 0.2 = 1.12 W .

A 2N2222 won't handle that.

What devices do you have? any bigger NPN's? Or mosfets?

Allan
Title: Re: Adjustable current load with µC
Post by: edgemoron on May 18, 2017, 03:44 am
Circuit has been running for 2 + hrs drawing 200mA from a 5V phone charger, 2N2222 is dropping 0.99V = 200mW, it's pretty warm, but I can hold my finger on it for more than 10 seconds, might be 55C.
EDIT: mA meter is dropping 2.7V.
Title: Re: Adjustable current load with µC
Post by: promacjoe on May 18, 2017, 08:05 am
For those who have an adjustable Lab type power supply, You can stack them in series for higher voltage, or parallel them for higher current. You can also use It as an electronic load. First set the controls to 0V, 0A. Connect your battery positive to negative, and negative to positive. Adjust your current load accordingly. For low current applications It works well. Just make sure you do not exceed the current, voltage, wattage rating of the power supply.
Title: Re: Adjustable current load with µC
Post by: terraduino on May 18, 2017, 10:34 am
Thank you all for your input.
My constant resistor load was build of 220R resistors. Heat is negligible. I tried 22R but these were to hot for me. I've got plenty of 220R so it doesn't matter to use a dozen or more. That said, I could combine these behind a single NPN, see attached, to increase the dynamically added load.

@allanhurst I have: Schottky SMD diodes, 2N3906, 2N2222, 1N4007, NTR2101P (p-Mosfet), LDR, LED.
No other NPN, mosfet or the like.

@Wawa
I found a schematic (https://goo.gl/images/JNRLbs) that looks related to what you described. I simulated this circuit but the current drops with decreasing voltage. Where is the "adjustable" part in this circuit?

Thanks & Best
Title: Re: Adjustable current load with µC
Post by: Wawa on May 18, 2017, 01:01 pm
@Wawa
I found a schematic (https://goo.gl/images/JNRLbs) that looks related to what you described. I simulated this circuit but the current drops with decreasing voltage. Where is the "adjustable" part in this circuit?
This is a double transistor circuit (better). I described a single transistor circuit.
The top transistor of the current sink circuit conducts the load current, and can be bigger (or a mosfet).
The bottom transistor cuts base current (or gate voltage) when voltage across the current sense resistor reaches/stabilises at ~0.65volt. So a fixed current sink. R=0.65/I or 0.65/0.2A = ~3.3ohm for 200mA
The circuit can be switched on/off if base resistor(R) power comes from an Arduino pin.
Several if these circuits could be used in parallel to select different load currents.
Leo..
Title: Re: Adjustable current load with µC
Post by: Smajdalf on May 18, 2017, 01:31 pm
Filtered PWM from Arduino pin can be used as "constant voltage" that can be adjusted according to current required.

If you don't need constant current you may unfiltered PWM. On this (from Wiki (https://en.wikipedia.org/wiki/Current_source))
(https://upload.wikimedia.org/wikipedia/commons/thumb/0/0f/Const_cur_src_113.svg/330px-Const_cur_src_113.svg.png)

Connect R1 to PWM pin instead of Vs and battery (connected to GND) instead of load.
Title: Re: Adjustable current load with µC
Post by: terraduino on May 18, 2017, 09:05 pm
@Wawa Thanks for the explanation.
I found my mistake when simulating the circuit. I chose the wrong value for the base resistor.
Here my simulation (http://www.falstad.com/circuit/circuitjs.html?cct=$+1+0.000005+10.20027730826997+50+1+50%0A172+336+176+336+128+0+6+6+6+2+0+0.5+Voltage%0Ag+336+448+336+464+0%0Aw+336+176+288+176+0%0Ar+288+176+288+240+0+220%0At+288+288+336+288+0+1+-4.642560194813379+0.7077354536414522+100%0At+336+336+288+336+0+1+-0.7077354536414522+0.6497043515451681+100%0Aw+288+240+288+288+0%0Aw+336+304+336+336+0%0Aw+288+320+288+288+0%0Aw+288+352+288+416+0%0Aw+288+416+336+416+0%0Ar+336+336+336+416+0+3.3%0Aw+336+448+336+416+1%0Aw+336+272+336+176+0%0A).

The current sink is 204.5mA @ 4.2V and 178.9mA @ 2V. Nice and simple solution. :)
Btw I saw no relevant difference using one, two or no diode. Any reason to add one?


@Smajdalf Thanks for your idea. ATM i prefer a solution without µC.

Best
Title: Re: Adjustable current load with µC
Post by: Wawa on May 18, 2017, 11:18 pm
Btw I saw no relevant difference using one, two or no diode. Any reason to add one?
The whole idea is to create a constant voltage across the current sense resistor.
Constant voltage across a resistor is a constant current through it.

That double transistor circuit uses the BE diode drop of the lower transistor.

The single transistor circuit "lifts" the base with two diode drops.
Needed, because the BE diode of the transistor lowers it with one diode drop.
One diode drop across the resistor again.
Leo..
Title: Re: Adjustable current load with µC
Post by: terraduino on May 19, 2017, 12:40 am
Thank you again for the explanation. But I don't get it. :(
I'm still confused why I see no difference in current sink and/or voltage drop.
Maybe I've the wrong kind of diode used in the simulation?

Thanks & best