| Electronics > Beginners |
| Constant current PWM |
| (1/4) > >> |
| ZeroResistance:
I desire to maintain a constant current through a load. The load could would be inductive or resistive. The simple circuit would be in the form of the attached image. I am sensing current through R2 which would be around 0.1 to 0.3 ohm. What kind of interface would I need in the box named "CIRCUIT" in the image to connect to the microcontroller (Arduino) ADC. 1. I was wondering if the low impedance of the current sense resistor would affect the ADC functioning. 2. Would a simple zener clamp just work out to protect the ADC pin from over voltage. My mosfet drain voltage could be between 12V to 50V. 3. Do I need a Op amp Buffer over there? 4. Some filter possibly to de-noise the current waveform? 5. For the algorithm would it as simple as switching the uC pin on then waiting for the current to rise over the set value and if the current crosses that value switch off the uC pin and wait for the current to drop below a hysteresis value and switch the pin back on again. Then this becomes some kind of psuedo PWM isn't it? Or is there a pure PWM alternative to this, by Pure PWM i mean plain old duty cycle control of a fixed frequency signal? Regards, Zero |
| RoGeorge:
Not enough specifications. Depending of what you need to use it for, it may work, or it may not. What is the destination of that circuit? As shown there, it is a switched on/off circuit, there is no constant current. If the load is OK with that, then go on, but if the load is sensitive and can not stand the max current, than a new design is needed, with the MOSFET working in the linear regime. The box named "Circuit" can be a simple resistor. There are internal protection diodes on the microcontroller pins. About the amplification for ADC, apart from the default 5V Vref for the ADC, most of the Arduino type of boards have 1.1V internal reference, and also is possible to have an external reference voltage smaller than 1.1V, so an amplifier might be avoided. Also, there is the oversampling trick, in order to increase the resolution of the ADC. Again, depends of the precision and the speed specifications (that are missing from the initial description of your circuit) if there is enough time to do that, or not. I did something very similar recently, a constant current discharger for AA batteries, in order to measure how much energy they really store. Didn't used PWM, implemented a PDM instead (Pulse Density Modulation), because I needed adjustable resolution much bigger than an 8 bits PWM. Used this technique for PDM: https://hackaday.io/project/6356-delta-sigma-versus-pwm and implemented it with interrupts on an Arduino nano. Making a digital control loop with a microcontroller (to keep your current constant) is a very complex task. Sometimes it might not even be possible, depending on how good and how fast the control loop needs to stabilize the load current. You didn't say the range of the current, and how fast should the whole loop stabilize. Those are very important for digital control. An analog current control loop will be much simpler to design, and more robust. |
| ZeroResistance:
--- Quote from: RoGeorge on April 23, 2019, 06:42:03 am ---Not enough specifications. Depending of what you need to use it for, it may work, or it may not. What is the destination of that circuit? As shown there, it is a switched on/off circuit, there is no constant current. --- End quote --- Ok I corrected my question. The load is inductive. So the inductance would act like a damping mechanism to prevent fast changes in current. The inductance would be around 100 to 200uH. Max current not more than 10A. I don't mind a minor ripple in the waveform say +/- 0.5A is OK. |
| Zero999:
Current only flows in R2 when the MOSFET is on, so your circuit won't be able to sense the decay in current, when the MOSFET is off. If the resistance and inductance are fixed, then it's possible to calculate the decay from the current when the MOSFET is shut off and wait for that period, before turning it on again. To sense the current in the inductor, the current sense resistor needs to be in series with it, which complicates matters: either move the inductor to the low side or the sense resistor to the high side. One simple but more expensive method is to use a Hall effect sensor to monitor the inductor current. I wouldn't use an MCU for this. A comparator with hysteresis is all that's needed. |
| ZeroResistance:
--- Quote from: Zero999 on April 23, 2019, 09:55:23 am ---Current only flows in R2 when the MOSFET is on, so your circuit won't be able to sense the decay in current, when the MOSFET is off. If the resistance and inductance are fixed, then it's possible to calculate the decay from the current when the MOSFET is shut off and wait for that period, before turning it on again. To sense the current in the inductor, the current sense resistor needs to be in series with it, which complicates matters: either move the inductor to the low side or the sense resistor to the high side. One simple but more expensive method is to use a Hall effect sensor to monitor the inductor current. I wouldn't use an MCU for this. A comparator with hysteresis is all that's needed. --- End quote --- That's superb Zero999 and good catch!!! :-+ I don't know how I missed that!! it was right under my nose and I couldn't see it :palm: I didn't quite get he hall effect sensor part. How would that work out. Would that mean measuring the magnetism in the inductor? Good idea regarding the comparator too gives me some food for thought!! With the comparator too would the current have to be sensed to ground and some kind of PMOS be used? Many thanks! |
| Navigation |
| Message Index |
| Next page |