Using software while PWMing a coil with feedback going to an A/D input,
1) how can you detect a state where the coil is an open circuit?
2) how can you detect a state where the coil is a short circuit?
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
I'm guessing that your sensing is based on measuring the voltage drop across a series resistor.
With an open circuit, you would not have any voltage drop across the sense resistor.
With a short circuit that shorts a large portion of the coil, you would notice a difference in the current when the PWM is at the "off" portion of the cycle. The series current should remain at a near constant level when the PWM is off. A short circuit would result in the series current dropping to 0 quickly after the PWM shuts off. Alternatively, you could look for a gradual increase in current after switching on the PWM.
If you don't change the PWM modulation rapidly (so the circuit has time to reach equilibrium), you could build a table of currents corresponding to each PWM code. If you're not getting the current you're expecting, you may have an issue.
A different approach using a magnetic field strength sensor, such as a Hall Effect device, would actually verify that coil is generating a magnetic field, but it may be more difficult to set up.