DIY Adjustable Constant Load (Current & Power)

65,910

239

74

Introduction: DIY Adjustable Constant Load (Current & Power)

About: Awesome Electronics Tutorials, Projects and How To´s

In this project I will show you how I combined an Arduino Nano, a current sensor, an LCD, a rotary encoder and a couple of other complementary components in order to create an adjustable constant load. It features a constant current and power mode and can handle a maximum of 30V and 20A if your heatsink design can handle it. Let's get started!

Step 1: Watch the Video!

The video gives you all the information you need to make your own adjustable constant load. During the next steps though, I will present you some additional information.

Step 2: Order the Components!

Here you can find a parts list with example seller (affiliate links):

Aliexpress:

1x Arduino Nano: https://s.click.aliexpress.com/e/_dULoNXh

1x 16x2 I2C LCD: https://s.click.aliexpress.com/e/_dSjOzdW

1x Rotary Encoder: https://s.click.aliexpress.com/e/_dZs9jUb

1x TC4420 MOSFET Driver: https://s.click.aliexpress.com/e/_d9epnMB

1x IRFZ44N MOSFET: https://s.click.aliexpress.com/e/_dUJRtAg

1x ACS712 Current Sensor: https://s.click.aliexpress.com/e/_dSKBwNK

1x Fuse Holder: https://s.click.aliexpress.com/e/_dU3K3jS

1x 20A Fuse: https://s.click.aliexpress.com/e/_dTjqvC4

2x Binding Post: https://s.click.aliexpress.com/e/_d9ke5na

Ebay:

1x Arduino Nano: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x 16x2 I2C LCD: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x Rotary Encoder: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x TC4420 MOSFET Driver: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x IRFZ44N MOSFET: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x ACS712 Current Sensor: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x Fuse Holder: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x 20A Fuse: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

2x Binding Post: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

Amazon.de:

1x Arduino Nano: https://amzn.to/2BLw2Ml

1x 16x2 I2C LCD: https://amzn.to/2BJ8tnx

1x Rotary Encoder: https://amzn.to/2Lmt5S0

1x TC4420 MOSFET Driver: https://amzn.to/2PBVQ0g

1x IRFZ44N MOSFET: https://amzn.to/2PxQd38

1x ACS712 Current Sensor: https://amzn.to/2NijkGn

1x Fuse Holder: https://amzn.to/2NkffkK

1x 20A Fuse: https://amzn.to/2PCLm0A

2x Binding Post: https://amzn.to/2BP0eGq

Step 3: Create the Circuit!

Here you can find the schematic as well as pictures of my finished circuit. Feel free to use it as a reference for your own circuit.

Step 4: Upload the Code!

Here you can download the code for the project. Upload it to the Arduino Nano through the Arduino IDE

Also make sure to download/include this library:

https://github.com/fdebrabander/Arduino-LiquidCrys...

Step 5: Finish the Project!

All that is left to do is mounting all the components inside your enclosure.

Step 6: Success!

You did it! You just created your own adjustable constant load!

Feel free to check out my YouTube channel for more awesome projects: http://www.youtube.com/user/greatscottlab

You can also follow me on Facebook, Twitter and Google+ for news about upcoming projects and behind the scenes information:

https://twitter.com/GreatScottLab

https://www.facebook.com/greatscottlab

4 People Made This Project!

Recommendations

  • Paint Challenge

    Paint Challenge
  • Hide It Challenge

    Hide It Challenge
  • 3D Printed Student Design Challenge

    3D Printed Student Design Challenge

74 Comments

0
waileun
waileun

Question 2 years ago

Queston:
Hi, I notice that there are two electrolytic capacitors and one under the TC4420. may I know what are the values of the two electrolytic capacitors and the SMD? from the diagram I only saw, 22u and 470u

0
bobby.mazey
bobby.mazey

Answer 9 months ago

i believe he just has two 220uf caps in parallel. That would make sense to me... The desired capacitance is 470uf, maybe he only had 220uf caps so paralleled them to get a similar result.

0
maliŽ1
maliŽ1

1 year ago

Code adapted for Nokia 5110 LCD.
Note: If a strong power source is connected (eg a UPS battery), the regulation of the current is too slow and there is a possibility of MOSFET burnout (even 55A IRFZ44, I burned two until I realized the problem). Use a quick fuse

pcb.pngschema.pngIMG_20191114_231716.jpgmosfet.png
0
DoctorEdo
DoctorEdo

Reply 11 months ago

can you help me with this? your code is broken.

vf.JPG
0
janecekpavel9
janecekpavel9

Reply 1 year ago

The 150k resistor in IRFZ gate control is for the MOSFET protection during the startup?

0
maliŽ1
maliŽ1

Reply 1 year ago

yep

0
JMI83
JMI83

1 year ago

Well, this is a good instructable, nevertheless:
1) dissipate 20A over 30V means you need to dissipate 600W, as the junction to case resistance for IRFZ44 is ~1.5°/W, this means you have to dissipate 400°, as temperature junction is maximum 175°C, this mean you have to cool down case to -225° ...
On another hand it's also what datasheet said: with an infinity head sink, maximum power allowed for IRFZ44 is less than 150W. (in fact (175-25)/(1+case to to sink))
2) if you have a look on IRFZ44 datasheet, you'll see it isn't really made for "linear" usage, DC isn't indicated on SOA graph, but should be for VDS ~12V in the range of 1A.
Yes, it's a good instructable, but not using this Mofset.
Regards JMI

0
brendanoldham
brendanoldham

Reply 12 months ago

JMI, would you be willing to suggest some alternatives to the suggested Mosfet? Thank you

0
TonyF12
TonyF12

Reply 1 year ago

I'm looking all over the web for something like this, but I need exact schema and parts... Can you make an a Instructable with everything we need to follow, but redesigned so it is a better unit? It would be nice to have something that is simple but accurate.... Thank you very much! Tony

0
YasienD
YasienD

1 year ago

Hi, I'm nearly finished building this project and the output voltage (measured with a multimeter) of my setup doesn't change when I set an output via the interface. I'm using Scott's code and the same components that were recommended. The only difference is that I'm using an Arduino pro mini.

I'm using a 20V 6A power supply to supply any load and a buck converter to supply power to the equipment. I lost my 5 volt regulators and I had a spare buck converter.

Regardless of the value I change the either the current or load values to, I always get a 2.4V output. The voltage drops to 0 when I 'stop' the output but it seems as though the duty cycle of the PWM signal doesn't change. I tied pin 9 directly the gate of the mosfet and the my output voltage was 2.1V and didn't change when I varied any values in settings.

My mosfet is fine, I tried 2 of them, and bot were adjustable with a 50k pot.

Can anyone help me here?

Puh-leeese
0
lziot
lziot

1 year ago

Hello.

The TC4420MJA driver is not available on any shops and it is quite expensive. Is there any replacement ?

0
hoj_dk
hoj_dk

1 year ago

Hi
Cool project. I'm deffinately going to build this. Did anyone make a PCB for this? and are willing to share the gerber files for it?
Best regards,
Christian

0
bencapobianco1
bencapobianco1

Reply 1 year ago

Hi, I’m also interested in a pcb Gerber file if anyone has one?
Thanks, Ben

0
kiwidave72
kiwidave72

Question 2 years ago

When looking at the code, i can’t see how you are setting the PWM out? You set it to an output on pin 9 and set it to low, but I can see anything else.

0
maliŽ1
maliŽ1

Reply 2 years ago

Think the code for PWM iz wrong. On my Arduino Nano V3 I've tryed the code (modiffied for Nokia 5110 LCD) for now without load and MOSFET, just the code and Current sensor, and OCR1A register goes Skyhigh (to 65534) and counts in a loop. I.e. when register reaches 65534, it starts from beginning (0). I simulated Current flow with a small magnet near current sensor.

For 100% DutyCycle the Value of register is 2047.
I modified the Code for current- and power mode ,

if (curcurrent < current) {
OCR1A++; // increase value of register OCR1A
} else {
if(OCR1A>0){ // If value of register greater than 1
OCR1A = OCR1A - 1; // decrease it
} else { // and if value is smaller than 1
OCR1A=0; // hold it on 0, or it will go around to the max
} // value and count down
}
OCR1A=constrain(OCR1A,0,2047);// hold value of register between 0 and 2047
counter++;
IMG_20191011_002008.jpgIMG_20191011_002025.jpg
0
bridystone
bridystone

Reply 1 year ago

Hi Maliz!

I hope you still read this.
Can you explain the magic number 2047 (2048 counts)?
I currently try to implement it for the Nano Every (which has a different IRQ Handling)

As i understand this is the number that defines the frequence of the pwm.
The OCR1 value than defines how long the duty cycle is.
As you wrote 2047 = 100% duty cycle.

But WHY 2047?!?!
so every 125 ns there is a pwn signal of OCR1 length.
Is this connected to the mosfet driver or the mosfet?

Any idea would be appreciated!

0
maliŽ1
maliŽ1

Reply 1 year ago

Hi, bridystone.
i'm new to the MCU and Arduino, perhaps i may not explain correctly.
ICR1 defines the PWM frequency
(timer speed (Hz)) = (Arduino clock speed (16MHz)) / prescaler
I this case, ICR1 = 2047, ie 16MHz / 2047 = 7816 Hz and that is PWM frequency, which was also measured with an oscilloscope.
OCR1 defines PWM Duty Cycle, and can be set to any value between 0-65534. In my case, PWM Duty 0-100% are the OCR1 values 0-2047. How Current on Sensor drops, OCR1 rises and and increases Duty Cycle, but does not stop at 100%. OCR1 goes higher, and PWM Duty Cycle stays on 100%, which means that the MOSFET no longer regulates current.
If, for example, OCR1 reaches, we say, 20000 (Current through the sensor
has started to rise), OCR1 starts to decrease, but the Duty cycle
remains at 100% until OCR1 falls below 2047. All this time, which takes
two -three seconds, the MOSFET does not regulate the current, and it is possible to burn out.
That's why I added the OCR1 registry value limit to the code, and then the PWM works properly. I measured all this with an oscilloscope, and monitored the values on the Arduino IDE serial monitor, and so I realized that OCR1 should be stopped at 2047
Why 2047? I'm not sure (as I said, I'm new to Arduino and I'm not very familiar with its registers), but I think it's related to the ICR1 value (2047 - PWM frequency 7816 Hz)
PWM Pin (D9) is connected to mosfet driver (as in the Great Scott's diagram)



0
bridystone
bridystone

Reply 1 year ago

Hi Maliz,

Thanks for your fast reply!
I think i figured out why the number 2047 was chosen by GreatScott:

you are right: the 2047 defines the PWM frequency. it defines the maximum value for 10 bits.
in the ATMega documentation the following is stated:

"The PWM resolution for fast PWM can be fixed to 8-, 9-, or 10-bit, or defined by either ICR1 or OCR1A. The
minimum resolution allowed is 2-bit (ICR1 or OCR1A set to 0x0003), and the maximum resolution is 16-bit
(ICR1 or OCR1A set to MAX). " (p. 133)

So i guess GreatScott assumed somehow (wrongly(?!)) that 10bit is the maximum level of the frequency. Which is not correct - as far as i read it. you can even set the number to 65535 (16bit) to get a higher resolution. This way the dutycycle could be adjusted more smoothly. I have no MegaAVR Chip available to test it, but it should work, since WG Mode 14 is used and not the predefined 5(8bit),6 (9bit), 7(10bit). (according to the data sheet)

I have no Nano lying around - only Nano Every's with MegaAVR Chip.
I guess I now at least understood the programming of the Timers and their usage with PWM.

Maybe you can adjust the TOP value to 1st 4095(11bit) and check if it still works - now with higher duty cycle steps (4095 as well).

Thanks again for your additional work and your reply.
It's a great project for me to understand the PWM usage and with your addition help (of code and clarifications) i understood quite a lot! :)