We are going to build an electronic load with constant current MOSFET, easy and with few components, to do experiments.
An electronic load with a MOSFET is a tremendously useful instrument, allowing us to apply a "controlled" load on an energy source such as a battery, a solar panel, a power supply, etc. and observe what happens.
The range of uses is enormous. We can check the correct operation of a power supply, check batteries and their capacity, characterise solar panels and much more...
This electronic load is not only super easy to build, but it is also super cheap. I reckon you can build it for less than 5€, depending on the materials you already have.
I don't want to get ahead of myself, but I'm working on a project with ESP32 that will allow me to take a lot of data about the solar panels in an automated way, transmitting the data to me from the outside via WiFi.
Electronic charging is a very important part of the project, but... This is only the first step.
- 1 Motivation of the electronic load with MOSFETs
- 2 Electronic load requirements with MOSFETs
- 3 Electronic load safety with MOSFETs
- 4 The circuit chosen for electronic charging
- 5 The MOSFET IRLZ44N
- 6 Simulation of electronic charging
- 7 How does electronic charging work?
- 8 First tests of electronic charging
- 9 Electronic load with MOSFET on perfboard
- 10 Temperature tests
- 11 1Ω or 0.1Ω resistor
- 12 Video explaining electronic charging with MOSFETs
- 13 Laboratory equipment that I have used and that I recommend
- 14 What next?
Motivation of the electronic load with MOSFETs
I've been meaning to do some experiments with microprocessors, such as Arduino, ESP8266 and ESP32, powered by solar panels, but every time I start to do it, I get terribly lazy because I can't do it:
- Every time I do an experiment I have to connect a bunch of separate instruments to analyse what is going on. I have found myself with four multimeters, an electronic load, an oscilloscope plus the device I am testing (the DUT or "Device Under Test").
- The experiments are carried out in the sun (of course, they are panels sunares) by which I excuse the discomfort, the heat, not being able to see the screen of the instruments in full sunlight, not having a suitable place to work.
- You can't even put on a sad umbrella (you cover the solar panel with an umbrella?).
- You can't even move a little bit away with a few long cables because it's a lot of cables, from a lot of instruments.
To analyse how a solar panel works you need:
- Apply a load that is very stable (panels change a lot depending on the load you apply, even with small changes).
- It is always the same, regardless of the voltage that the panel is providing (and it changes a lot, every second, following the whims of the sun, the clouds and the atmosphere itself).
- The load should be easy and quick to adjust. We will see almost nothing (at least of interest) if we simply put as a load a light bulb or an electronic circuit that consumes in jumps and that changes with the outputs in the voltage of the panel).
I'm sure you will find a lot of applications for it, depending on the type of projects you do, regardless of the fact that I am particularly using it for solar panel analysis.
Electronic load requirements with MOSFETs
As always, the best thing to do before embarking on the design and/or construction of any circuit is to clearly define the requirements of what you want to achieve.
This is my basic list of desires:
- Very easy to build
- Have easy-to-find components
- Operate over a wide range of currents, powers and voltages with few changes
- Easily integrated into larger projects
I think all the requirements are self-explanatory, although there are some points that need a little more detail.
The first two requirements are a wish with a compromise: It will be a basic MOSFET electronic load for fast experiments. It is not intended to be very precise, high-power or to work in absolutely all cases.
To meet the third requirement (to operate over a wide range of currents, powers and voltages with little change), we will make a basic design but use a capable MOSFET, which allows us to handle relatively high power by simply improving the heat dissipation system (going from air transistor to transistor with a small cooler, adding a fan if necessary, etc.).
Finally, to make the MOSFET electronic load easy to integrate into larger projects, we are going to make it voltage-controllable: We will simply apply a voltage to its input and the load will adjust to a current proportional to the control voltage.
That control voltage can be provided by a simple adjustable resistor (as in this basic design), by an Arduino, an ESP8266, ESP32, or any other controller or microcontroller, such as a Raspberry Pi.
I hope that you will soon be able to see some news on this, with this electronic load integrated into a project with an ESP32.
Electronic load safety with MOSFETs
In order to make an electronic charge with a minimum of complexity and components, it is necessary to accept a commitment to security.
We will have to use our heads and think about what we are doing because, in order to minimise complexity, we will not have any protective measures (it would be good to put a fuseHowever, it is).
It should be borne in mind that, basically, what an electronic load does, with or without MOSFETs, is to consume energy by transforming it into heat. This means that we must always bear in mind the temperature of each component and think about how whatever we do will affect it, before doing so.
If we tell the load to consume a lot, and that is more than the device to which we connect it is capable of withstanding, we can damage the device.
Remember that if the device is a battery, and we do the wrong thing, the battery may catch fire.
We can also spoil the load itself if we ask of it what it cannot bear.
I can't stop repeating it:
USE YOUR HEAD. AN ELECTRONIC CHARGE, WITH OR WITHOUT MOSFET, CAN BE DANGEROUS IF NOT USED CORRECTLY!
This cargo does not have no active limitation (beyond the limitations arising from their own design and construction and the components used).
In short: use your head and act responsibly and at your own risk.
Having made the warning, if I tell you that the electronic load withstands a relative abuse without spoiling. For example, I have put 3A of reversed polarity (positive and negative of the DUT swapped) for a few seconds without any major problem (the IRLZ44N MOSFET can withstand up to -16V between Gate and Source).
The circuit chosen for electronic charging
Let's get down to business, looking at the electronic circuitry of our cargo:
As you can see, the electronic load is built with very few components.
- An IRLZ44N N-Channel MOSFET transistor. This MOSFET is theoretically capable, under ideal conditions and with ideal cooling (infinite radiator), of supporting up to 47A and 55V.
- An LM358 operational amplifier which will be in charge of comparing the power consumption of the electronic load (the voltage at the point between the MOSFET and the resistor R1) with the voltage that enters through the "+" leg and which depends on the setting of the potentiometer R2.
- A resistor R1 of 1Ω (or 0.1Ω as you will see later)
- A 200kΩ adjustable potentiometer or resistor
It is perfectly possible to use other components, if you have them on hand. I have used them simply because I had them on hand and didn't need to order anything and wait for it to arrive.
One of the usual problems with this type of simple electronic loads is that they are prone to self-oscillation. In my case, in all the tests I have done with different components and in many situations, I have not found any problem of self-oscillation.
The MOSFET IRLZ44N
Although it is not essential, and you can skip it, I want to tell you a little about the MOSFET transistor I have chosen for the electronic load.
First of all, why did I choose him - is he the best?
I chose it for a good reason: because I had it. And no, it is not the best.
Still, it is a very good choice for such a project and if I hadn't had it, it would have been very high on the list of MOSFETs to use.
It's a very hard, high-power MOSFET, cheap and fairly easy to find, even on cheap maker sites like AliExpress.
This data says it all: a theoretical maximum withstand current of 47A (Id), with a maximum voltage of 55V (Vdss) and a power dissipation of 110W (note that these figures are the '...').ideals', e.g. with a heatsink '...'.infinite‘).
And above all: It is a Logic-level MOSFETs which works well with tensions in its Gate of 2.5V (Vgs) and has a RDS(on) of only 0.022ΩThis is very important for our application, perhaps the most important thing (together with the low Vgs).
According to the manufacturer's datasheet, the RDS(on) is only 0.035Ω with Vgs of 4V and Id of 21A, which is well within our operating zone.
As I don't want to leave you here a lot of information that will be useless for most people, I'll leave you the datasheet, that's what it's there for:
Simulation of electronic charging
Have you noticed, by any chance, that the schematic has an integrated ammeter in series with the DUT?
This is very unusual in a scheme... it even has a value in mA!
The reason is that the schematic I have prepared is fully interactive and... you can simulate the operation of the circuit without having to assemble it!!
Go to this CircuitLab pageand you can change values and make measurements at any point in the circuit.
Just press the "Simulate" button and, for example, double click on potentiometer R2. Change the "K" value to any value between 0 and 1 (put for example 0.02 which is as if the potentiometer was turned by 2%) and see how the ammeter changes. Be sure to use several decimal places.
You can see how, for example, almost all of the variation in load occurs in the first 10% of the potentiometer turn.
You will also see that the maximum load is just under 600mA (more than enough as a load for the small solar panels I want to test).
You can see the measurements (voltage, current and more) at any point in the circuit just by placing the mouse pointer on that point.
Mouse over the MOSFET and the resistor and you can even see the power dissipated by these components in real time as you change the values!
Don't miss out on seeing how the behaviour of the electronic load changes when you change the value of resistor R1 from 1Ω to 0.1Ω (more on this and the tests I've done on it later).
As you can see, this practical simulator makes it very easy for you to decide how you want the load to work, based on your needs.
How does electronic charging work?
As you know, I don't like to just giving prescriptions to do something without you knowing what it does and learn along the way.
I like to explain it in a way understandable so that anyone, even if they have very little knowledge, will be able to understand how the circuit works and why things happen.
In this way I hope that my articles provide value and are didactic and allow the amateur to learn in an easy way.
Broadly speaking (and we will go into more detail below), what electronic charging does is as follows:
- It measures the position of the potentiometer, where we indicate the current we want the load to consume, and generates a voltage proportional to the position of the potentiometer (let's call it "load voltage"). reference").
- It measures the current flowing through the MOSFET of the electronic load and converts it into a voltage proportional to that current (let's call it the "voltage of measure").
- It compares both voltages and generates a third voltage, which is the difference of the first voltage minus the first voltage (let's call it "voltage of control"). Enter this voltage at the MOSFET gate.
The electronic load uses two resistive voltage dividers to calculate the reference voltage and the measuring voltage so it is important that, if you are not familiar with what a resistive voltage divider is and how it works and is calculated, you read the following point carefully.
What is a voltage divider, what is it used for, how does it work and how is it calculated?
A voltage divider is a circuit consisting of two resistors connected in series between a voltage source. This type of circuit is used to obtain a fraction of the input voltage at the connection between the two resistors. The general formula for calculating a voltage divider is:
- is the output voltage.
- is the input voltage.
- is the resistance connected to the input voltage.
- is the resistance connected between the output and the common voltage (ground).
If you know three of these values, you can use the formula to calculate the fourth. Here are the variants of the formula for each parameter:
Calculate the Output Voltage ():
Calculate the Input Voltage ():
Calculate Resistance :
Calculate Resistance :
The best way to understand this, as always, is to look at a simple example, with easy numbers:
These calculations are useful when designing circuits where you need to reduce an input voltage to a specific level. It is important to note that the load connected to the output of the voltage divider will affect the actual output voltage. In addition, resistors should be selected that are available and practical for your application.
The reference voltage is taken from the voltage divider formed by the two branches of potentiometer R2.
This potentiometer, which is 200kΩ in our schematic, can be seen as two resistors that add up to 200kΩ between them and that, by changing the potentiometer setting, we change the "intermediate point between the resistors".
I leave you the following modification of the scheme, so that you can follow me:
You could see our potentiometer as two separate resistors (R3 and R4) that can have any value between 0 and 200kΩ, with the particularity that both always add up to 200kΩ (always X+Y=200).
This extends to any potentiometer, of course, and you will often find it useful to imagine them in this way to understand a circuit.
Now that we know what it is, imagine that the potentiometer is just in the middle: The voltage at the "+" terminal will be 2.5V.
Because as we have seen before: so, substituting with our values we would have:
The first thing we have to do is to measure the current through the MOSFET of the electronic load (the current that travels between the "+ Load" point and GND.
Actually, current is never (almost never) measured directly, what is actually done is to measure the voltage drop across a known resistance (and this is how your multimeter measures it, for example).
This is very easy to do with Ohm's law.
Ohm's law tells us that:
We have a resistor to measure the current which is R1 and has a value of 1Ω.
According to the formula, if a current of 1A were to pass through this resistor, a voltage of 1V would be generated between its terminals.
If we were to measure a voltage of 0.53V (530mV), the current flowing through it would be 0.53A (530mA).
In this case it is very easy because what we are going to use is the voltage directly, we don't even need to apply the formula and calculate the current.
With the two previous voltages, which we have already calculated and which we have seen that it is very easy, we are going to generate a control voltage, which will be applied to the MOSFET Gate, directly and without modifications...
This control signal has a voltage that is: the reference voltage – the measuring voltage.
The LM358 operational amplifier
Generating this voltage is very easy because it is done by the LM358 integrated circuit we are using, an Operational Amplifier.
The Operational Amplifiers, do just what their name implies: they amplify signals and operate with them (addition, subtraction, etc.).
They have two inputs and one output: we put one voltage at the "+" input, another at the "-" input and the output will give us the first minus the second.
The magic is that with this we get the voltages to equalise just at the point where the current is what we want it to be.
The LM358 integrated circuit has two operational amplifiers inside, although in this case we would only use one:
Example of operation in electronic charging
Here is a practical example that illustrates a fairly simple idea:
To achieve a current of 1A, we apply 1V to the non-inverting input and measure the voltage generated across our resistor at the inverting input.
When the voltage at the non-inverting input (the desired current reference) exceeds the voltage at the inverting input (the current measurement present), the output (the control voltage) becomes positive, the greater the difference, the higher the voltage becomes.
Since the control voltage is connected to the gate of the MOSFET, the MOSFET conducts more, increasing the current and thus the measured voltage.
When the voltage at the non-inverting input is less than the voltage at the inverting input, the output is set to zero. In this case, the MOSFET stops conducting, decreasing the current and raising the measured voltage.
This cycle repeats itself continuously at an astonishing speed. Visualise in your mind this process happening uninterruptedly and at great speed.
Consequently, the operational amplifier generates the necessary control voltage (by increasing or decreasing it) to match the measured voltage to the reference voltage. As a result, the current coincides precisely with that which we have selected by means of the control voltage.
What else does an operational amplifier do?
Of course, an operational amplifier is capable of doing many other things, but I have focused on what it does in our circuit, which is what we are interested in. Perhaps another day, I will write a full article on how these helpful little friends work.
By the way... we have seen the operational amplifier. conducting operationsBut what about amplifying? Yes, in our case by 1 (by -1 actually), although I can tell you that, for other uses, they are capable of amplifying signals hundreds or thousands of times (the gain of the LM358 is more than 100,000).
For the time being, if you want you can learn more about operational amplifiers on Wikipedia.
First tests of electronic charging
The first thing I did was to mount the circuit on a breadboard to check that it worked correctly, make the first measurements and validate it.
Here you can see the setup I set up for the first tests:
Basically the bare circuit with a lot of test leads to measure several operating parameters simultaneously...
It is connected to...
Three channels of the oscilloscope, where I can see at the same time:
- The voltage at the point between the MOSFET and the resistor R1 (current of the electronic load)
- Input voltage to the "+" terminal of the operational amplifier
- The voltage at the output of the operational amplifier.
The power supply
A laboratory power supply set at 5V and current limited to 10mA, which powers the circuit.
Limiting the power supply of the circuit to only 10mA during the first tests allows to detect if there is a problem (e.g. in the wiring), without anything being burnt or damaged.
10mA is much more than the circuit needs to operate (it actually consumes considerably less than 1mA).
The DUT (Device Under Test)
A second laboratory power supply set at 5V and limited to 100mA, which acts as the DUT (Device Under Test). In other words, it is the "device under test".testing") and which can be replaced by a battery, a solar panel, etc...
Being able to limit it, at this early stage of testing, to 100mA is very interesting because I don't have any cooling on the MOSFET and so I don't have to worry about it heating up or there being a problem and the load shorting out (running a lot of amps through it uncontrollably).
Once the first tests were done, I raised the limitation of the source acting as device under test (DUT) to 2A to test the electronic load for short periods of time.
I have used the multimeter to make various measurements at different points in the circuit.
At the time I took this picture I was measuring the voltage at the MOSFET Gate.
Once the first tests are done and everything is satisfactory, it's time to create a slightly cleaner and more permanent circuit that will allow me to continue advancing...
Electronic load with MOSFET on perfboard
I'm not going to create a custom PCB for the electronic load, but it's interesting to get a little more apparent assembly, so I'm going to install everything on a perfboard, trying to make it as compact as possible.
Assembly diagram on perfboard
This time I've worked on it a bit more than I usually do (to make it easier for you to assemble it, if you want to do it), and I've documented its construction better, apart from creating some nice diagrams 😉. Please let me know what you think in the comments.
To make it easier for you to assemble it, I leave you also the views with only components:
and with only the wiring:
I believe that, with these images and the photographs below, the assembly could not be simpler.
Assembly on perfboard
In the first picture you can see the components already welded in place.
As you will see, I have made some modifications, based on my needs:
- I have left a free line between the operational amplifier and the components of the first line (potentiometer and components). This will make it easier for me to do some tests.
- I have used a three-pin connector for the connector of the device to be tested (the DUT), instead of a two-pin connector, for a modification I am planning.
- As I didn't have a vertically mounted potentiometer available, I used a horizontally mounted potentiometer and placed it vertically by bending its pins and extending the control unit.
- I have left a part of the board unused on the left so that I can mount more components in the future.
When it comes to "cabling". the perfboard, I have done it in two steps to reduce the possibility of making a mistake or forgetting something:
First I have "wiring" only the positive and negative lines (and the centre leg of the potentiometer, as it was there).
Then I wired the rest (only the three coloured wires were left).
By separating each step in this way, each step is very simple and it is more difficult to get confused or lost.
This is the result of the finished electronic load:
As you will see, I have included a 2-pin female connector for resistor R1 (left area, not connected at the moment), which will allow me to change it quickly for testing purposes.
The power supply for the electronic load is on the front two-pin connector (purple wire for "+" and blue for "-").
The front three-pin connector/terminal corresponds to the DUT connection (brown wire for "-" and red for "+").
I leave you the following comments on the construction:
- Modify the layout according to your components, needs and preferences - don't be afraid to experiment!
- In general you can use any thin wire to make the connections, but remember that there are some that can withstand a certain current and you will have to use a wire suitable for that current (Source, Drain, both sides of resistor R1 and the connections to the device you are testing, the DUT).
- One detail: the potentiometer works backwards from what it should intuitively work (turned fully clockwise the load is at minimum current). If you are concerned about this, simply reverse the wiring at the ends (the end that goes to "+" and the end that goes to GND).
An electronic load design would not be complete without some temperature testing of the components, especially the MOSFET and the 1Ω resistor.
Many tests may be missing, but not temperature tests.
You should at least put your finger on the components (also when the electronic load has been running for some time at the maximum power at which it is to be operated), and check how things are.
These components can run very hot without anything happening, but there is a limit to everything. If you are able to put your finger and hold it for five secondsThe temperature of the oven, everything is fine (they can easily reach much higher temperatures than Carlos Arguiñano's finger could withstand for a moment).
In this case, instead of using my finger, I have used my mobile phone with a thermal camera VICTOR VC328B (one of the best acquisitions I've made lately, to be honest) to watch really how things stand.
Temperature tests without heatsink
In this test, with a load of just under 2W (350mA and 5V), and R1 of 0.1Ω, after a few minutes the temperature of the MOSFET stabilised at around 110ºC.
Temperature tests with small heatsink
With a small heatsink, only 15x10x22mm, things have improved a lot.
It is possible to set the load to 5W (5V and 1A) for several minutes (I have had it for about 10 minutes) and the temperature of the MOSFET is around 120ºC.
I have tested it with 2A and 3A currents for short periods without any problems, which means that for the tests that are usually done with normal mobile chargers, which last a few seconds or a minute at most, this small heatsink is sufficient.
These tests have been done with a 0.1Ω 5W resistor. The resistance during the 5V and 1A test reached approximately 40ºC.
Temperature tests with medium heatsink
I have put this medium size heatsink because it is the one I had. It is salvaged from an old Corsair GS700 PC power supply so I have no technical data.
With this fan, the load has been set to 2A 5V (about 10W) for at least 10 minutes, and the temperature has stabilised at about 110ºC.
I have been able to verify by testing with 3A 5W that charging works perfectly, although the temperature reaches 120ºC in about two or three minutes.
This test has been done with the 0.1Ω 5W resistor and the temperature during the 5V and 2A test has reached 55ºC, approximately.
Effect of gate feeding on temperature
It is curious (although not surprising, because we have already commented it many times in the blog) to see how the temperature of the MOSFET was much lower when the gate was powered directly by a PWM signal, than when the MOSFET is powered by a pure DC current (or almost pure PWM signal with low-pass filter).
Here it can be seen that the MOSFET, when fed by the pure PWM signal, operates in the saturation zone and its RDS(on) is much lower, and hence its heat dissipation.
We talked about the temperature of the MOSFET with the load set to 5V 1A (5W) being 60ºC when using a pure PWM signal and about 100ºC when introducing the low-pass filter.
Conclusions after temperature tests
As you can see, for any "serious" use you will have to put a heatsink on the MOSFET.
In my case, I don't think I need a heatsink for the time being (or at least a small one), because the mini solar panels I want to test are between 1 and 2W, and I'm not going to use a heatsink, especially as the tests will not be continuous, but only for a few seconds at a time (this is sampling).
This is just an appetizer without much rigour or usefulness, just to advance a couple of ideas.
I will leave you more measurements shortly, with more data that I hope will be useful.
My idea is to make a video about it, I don't know whether for this article or for the one on ESP32-controlled electronic charging.
1Ω or 0.1Ω resistor
The choice of resistor determines the behaviour of the electronic load.
There is no one better than the other. Each has its advantages and disadvantages.
I myself am finding that depending on what I want to do I am using either the 1Ω resistor or the 0.1Ω resistor, substituting one for the other.
A 0.1Ω resistor allows us to increase the current at which the load is able to operate. With a 1Ω resistor it is difficult to go from 1A to 5V, with a 0.1Ω resistor we can reach several amps without any problem.
Another difference is that with the 0.1Ω resistor the voltage we have to apply to the MOSFET gate is 10 times smaller and this means that, regardless of the method we use to generate it (PWM, DAC or MCP4725), it has 10 times less resolution, so the current we adjust with each "step" of control voltage will be 10 times lower.
With the 1Ω resistor and using a 12-bit MCP4725, each step can be 1mA of variation, whereas with the 0.1Ω resistor it will be approximately 10mA.
In short, you want precision, but less than 1A? Use the 1Ω. Want more intensity, but less precision? Use the 0.1Ω.
Note also that these results are dependent on the MOSFET used. If you use a different MOSFET than the IRLZ44N this will vary.
Video explaining electronic charging with MOSFETs
As a complement to this article, here is a video in which you can see a general explanation of electronic charging.
Making these videos takes a lot of work. If you like the video don't forget to "Like" and subscribe to the channel. That's will motivate me to keep making more videos like this one.
Laboratory equipment that I have used and that I recommend
There is still a lot of testing and modifications to be done, so I hope this article will continue to grow with new information.
Increase maximum intensity
With the electronic load powered at 5V (which is very convenient), the IRLZ44N MOSFET used and the 1Ω resistor, the maximum current of the electronic load does not reach 600mA.
There are several possibilities to increase the intensity:
- Turning up the power supply, which is not very convenient for my intended use. Powering the electronic load at 5V is very convenient.
- Select another MOSFET that allows me to have a higher current with the load powered at 5V and the 1Ω resistor.
- Reduce the value of resistor R1. Just by replacing the 1Ω resistor with a 0.1Ω resistor, we multiply the maximum current by 10.
I did a quick test by replacing the resistor with a 0.1Ω resistor and everything works perfectly and, as expected, the current is much higher (I tested it up to 3A for short periods of time and it worked perfectly).
If I had done more testing with the 0.1Ω resistor I might have put it in the design as the default resistor. I haven't done it yet because 600mA is more than enough for my current needs and I'm not in a hurry.
Making the voltage divider of the reference voltage asymmetrical
Right now the voltage divider consists of a simple 200K potentiometer, but the full range of motion is not being used. Almost all of the variation in the reference voltage useful is in the first 10% or so.
I want to include a fixed resistor in one of the branches so that the range of variation of the resistor is smaller and at least 80% of the potentiometer travel can be used.
I haven't done it yet because after all I don't plan to use this electronic load with the potentiometer for anything other than initial testing. Then it will be microprocessor controlled. I haven't even tested it in the simulator to see, in theory, what resistor I should put in.
Microprocessor control of the electronic load
I also hope, as I have hinted, to publish a more complete project in which I will use this electronic load, and other elements, together with an ESP32 to analyse the operation of solar panels.
I have already done some tests with the load controlled by an ESP32 and the results have been very good.
If you like the world of MOSFETS and what can be done with them, here are some articles from the blog that may be of interest to you: