I am designing a circuit to control an electromagnet (coil with iron core) through a N-channel MOSFET driven by a PWM signal.
I can't figure out how to derive the relationship between the PWM duty cycle and the current I will get in the coil, and I need to know this as the magnetic field generated is a function of i.
These are the system specs:
- DC voltage source: 7.5V
- Coil L = 15 mH
Thanks for the help!
Thanks for the feedback so far: of course the resistance is missing, I forgot about that! At this point, I have the coil with L = 15mH and R = 2.4 Ohm. And no, it's not coursework, just a personal project.
So, the current in the circuit should be i = V/R (1 - e^(-Rt/L)). The steady-state value is therefore i = V/R.
With this in mind, I thought of adjusting this to PWM as follows:
V = Vcc * %pwm (%pwm: duty cycle), therefore I finally have a relationship that links the duty cycle to the current through the coil.
This, however, turns out to be off compared to experimental data I just took: for example, for duty cycle of 20%, I would expect V = 1.5 V and i = 0.625 A. In reality, however, I measure a voltage around 1.1 V.
What is this due to? I thought it might be linked to the PWM frequency, but it's 3.9kHz, which sounds like more than enough!
Finally, I also made a model in Simulink to try and understand the issue, and these are the plots I'm getting:
Funny thing is, I am getting average current and voltage values much higher than they should be! Besides, why does the voltage plot vary as a "sawtooth" rather than the square PWM signal?
Right, so I think I managed to get my model right now, thank you again for the help everybody!
At this point, I think I have a fairly good model of the relationship between PWM duty cycle and current through coil.
This is my updated Simulink output for a 50% duty cycle:
Thank you again