I am looking to drive a mosfet pwm from the arduino directly. Problem is I want to make sure the load doesn’t spike to excessive currents. Say keep it under 20 amps at all times.
If we’re talking resistive loads, then you can use an AMPOP in a well-known current sink configuration (open the datasheet of National’s LM358, the circuit is there) and be prepared to dissipate a huge amount of heat.
If we’re talking inductive load, it all depends on how fast your current goes up, but the already mentioned LM3xx comparator and shunt resistor may be a good and simple option, connected directly to a pin in interrupt mode; still some work needs to be done on the sw side so that it all works ok. Anyways, as I said, it all depends on how fast your current goes up.
Can any body suggest an idea if this can be done with a simple resistor or some other component.
I am looking for something effective and reliable, but not too elaborate.
And cheap too, right? The holy grail of engineering :), unfortunately you can only pick 2, any 2.