Go Down

Topic: programmable variable current pwm generator. (Read 445 times) previous topic - next topic


how to generate a high current(0-15A) pwm of constant value using arduino?


Dec 06, 2017, 04:54 pm Last Edit: Dec 06, 2017, 04:59 pm by Mikeb1970
You could use a power MOSFET, like NTD20N06, NTDV20N06, but this thing will need a large cooling element. It also depends at what frequencies you want to work to see if this is suited, and its limited to 60 Volt.
Here is the link to the datasheet:


If you need to work with more then 60 Volt you will need to search for another power MOSFET, or find a different solution.


If you goal is to create a constant current in the range of 0 to 15 amps you will need to sample current and likely store some energy (aka filter) in an inductor and capacitor.

This would be searched as "constant current switching regulator"

Please do not PM me with thread based messages.  If your thoughts are worth responding,  the group should benefit from your insight.


how to generate a high current(0-15A) pwm of constant value using arduino?
Since Voltage, Current and load resistance are related, you could be asking one of two things:

1. With a known, fixed load, can you get your Arduino to PWM output a given current ?
2. With any load, can you get your Arduino to tell some power supply to deliver a fixed current.

If it's "1", then you just need some beefy power MOSFET to pulse width modulate your power supply output and some calculation which knows the Voltage and Resistance of the load so it can set the PWM output based on V=I*R (the PWM regulates the voltage from the power supply by pulsing it)

If it's "2", then the PWM can only output a voltage. If you add a filter on the PWM output from the Arduino you can get a voltage level from 0v to 5v  - or whatever voltage supply you have if you switch it with a MOSFET or something. You then need something which takes this voltage and uses it to control the current supplied.

If you want to do all this yourself in the Arduino, you could use a beefy MOSFET as in "1" to PWM power into the load, but then you'll need to measure the current. To do that you can add a small resistance from the power supply to the load and measure the voltage across it with an analog input.

For example, If you added a 0.1 ohm resistor, the voltage across it would be (using V=IR) 15A * 0.1ohm = 1.5V

However, controlling the PWM from the measured voltage (current) under varying conditions can be tricky.



Dec 07, 2017, 03:31 am Last Edit: Dec 07, 2017, 03:31 am by Wawa
From OP's previous thread, so we don't get silly answers.

I want to control the current input of a 36v bldc motor using arduino mega through a motor controller. Is it possible to build such a thing? can you also suggest how to build?
I want to controll current so I can control torque supplied by the motor.
I'm working on a pedal assist cycle.


From OP's previous thread, so we don't get silly answers.
Ah, so if you have a brushless motor controller ( like this? https://www.ebay.co.uk/itm/12-36V-DC-500W-Brushless-Motor-Controller-Hall-Balanced-Car-BLDC-Driver-Board-im/182624245115 ) then you have to supply some voltage to set the speed the motor will run at.

A reasonable step would be to use the PWM output, filtered, to control the motor speed.

A next step would be to isolate the Arduino PWM from the motor controller with an opto-isolator. Again, just to control the speed.

Then it would be possible to add a current sense resistor (e.g. 0.1ohm) in the ground line to the controller and measure that voltage with the Arduino (you will need to filter this voltage to protect the Arduino from motor noise).

You would then be in the position to reduce requested speed if the measured voltage (i.e. the current) is above whatever value you set.

This is not a simple thing to get working properly so, whatever you try, take it in small steps.

Hope that wasn't too silly.



 Controllers from the far east are so cheap it's hardly worth building one yourself....


Go Up