Adjustable current load with µC

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


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…


batload.pdf (21.1 KB)

Thanks for your feedback.
Unfortunately, I don't have an LM358 or any other op-amp. :frowning:

They're very cheap..


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. :frowning: Order online needs time to deliver ...

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.

Try this:


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?


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.

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.

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.

I found a schematic 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


I found a schematic 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.

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)

Connect R1 to PWM pin instead of Vs and battery (connected to GND) instead of load.

@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.

The current sink is 204.5mA @ 4.2V and 178.9mA @ 2V. Nice and simple solution. :slight_smile:
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.


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.

Thank you again for the explanation. But I don’t get it. :frowning:
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