EEVblog Electronics Community Forum
Electronics => Projects, Designs, and Technical Stuff => Topic started by: tomislav.babich on November 21, 2015, 01:21:23 pm
-
I am doing a project which involves controlling current going through electromagnet and measuring the currents value. This is what I came up with so far: There will be L298 connected to Arduino and driving the electromagnet. For current regulation I will use PWM and for current measurement current I will use sense pin from L298+shunt resistor+op-amp. I have a few questions about this circuit:
- Is PWM adequate method for controlling current going through coil? Some places on the web suggest it but I am not sure.
- If PWM is adequate can L298 current sense pin+shunt+op-amp be used for measuring current? How would I do it in the code, maybe measure peak voltage?
- Do I need RC low-pass filter?
I am looking forward to your answers.
-
...
- Is PWM adequate method for controlling current going through coil? Some places on the web suggest it but I am not sure.
- If PWM is adequate can L298 current sense pin+shunt+op-amp be used for measuring current? How would I do it in the code, maybe measure peak voltage?
- Do I need RC low-pass filter?
1. Yes, an inductor will integrate the PWM'ed current pulses drawn from the input capacitor (said capacitor is required) into DC + a sawtooth ripple component, depending on PWM frequency and inductance of the electromagnet (also whether ferrous metal is in close proximity to the electromagnet).
2. Sure. Use a single op-amp difference amplifier and a non-inductive metal foil resistor specifically for current sensing applications. Whether you should work with the peak voltage (current) or the average depends on what you are trying to do, but most of the time you want to measure/regulate the average current.
3. Yes, always use an RC filter to integrate away any voltage noise/spikes caused by stray inductance in the sense resistor and the wiring between it and the switch and ground. Note that if you use a single op-amp differential amplifier you can put the noise-filtering capacitor from the (+) input of the op-amp to ground (see attached picture). The value of this shunt capacitor is set so that the time constant formed between it and the resistor in series with the (+) input is the same as that of the inductive time constant of the shunt. For example, a 0.1R shunt with 10nH of inductance has a time constant (t) of 10nH/0.1R = 100ns; if the series resistance to the (+) terminal of the diff. amp is 1k then C = 100ns / 1000R = 100pF. All that said, it is usually impractical to measure the inductance of a shunt, so plan on tweaking the value of the capacitor once the circuit is built.
-
Don't forget the freewheeling diode. Without it, the principle will not work at all and the thing will self-destruct.
-
Thank you for your replies!