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?

  • \$\begingroup\$ Can you draw a schematic? \$\endgroup\$
    – endolith
    Apr 9, 2010 at 17:30

1 Answer 1


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.

  • \$\begingroup\$ I have done this, and it works nicely. I had a series resistor between the power rail and all of my valves. At startup I was able to turn each one on individually to measure its resistance and make sure it was within tollerance. Of course, if the space is available and you have the measurement channels, this can be done for every valve. \$\endgroup\$
    – Fuzz
    Oct 6, 2010 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.