Skip to main content
added 6 characters in body
Source Link
hacktastical
  • 58.4k
  • 2
  • 54
  • 166

A long time ago for a product, I worked out this issue by using a current mirror. Basically, anI used a matched NPN pair wired up to sendas a mirror and sent a very small (tens of microamps) current to the LED, not enough to light it. The mirror output would swingswung enough voltage that it could be sensedread it with a GPIO. Once my diags were done I turned off the current mirror so even the phantom sense wasn’t present. IWhy did it this way as I didn’t have an ADC available andgo to so much trouble? I was very short on GPIOs and needed to resort to some tricks to reuse them.

If you have anThe ADC, you can measure the FET drain voltage with the FET ‘off’, with a bit of work. ToggleFirst, toggle the FET on'on' then off'off' to discharge the drain and trace capacitance, then quickly sense the drain voltage afterward. ItThe voltage will stay at 0 if the LED is unconnected, or drift up towards Vcc with the LED present as the LED leakage bleeds off charge.

TheThat said, the ADC sensing method poses a couple of difficulties however: ADC input range (which needs to include Vcc), and ADC input impedance loading the circuit when the driver FET is 'off'. Either one will prevent proper sensing of the FET drain charge.

What to do then? Forget the ADC. There's an easier way.

Finally: the easy way. Use a low-thresholdan nFET like a BSS138 to watch the driver drain voltage. HammerJust like with the ADC method: pulse the driver, 'on' then check the FET state immediatelyshortly afterward. If the sense FET stays off, no LED; if it turns on, LED is connected. Try it, here:

schematic

simulate this circuit – Schematic created using CircuitLab

This circuit takes advantage of the fact that there's a bit of capacitance present on the driver FET drain and the board trace. The sensing FETnFET doesn't load this, and so can detect the driver drain off-state charge with the LED present or absent.

I worked out this issue by using a current mirror. Basically, an NPN pair wired up to send a very small current to the LED, not enough to light it. The mirror output would swing enough voltage that it could be sensed with a GPIO. Once my diags were done I turned off the current mirror so even the phantom sense wasn’t present. I did it this way as I didn’t have an ADC available and I was very short on GPIOs.

If you have an ADC, you can measure the FET drain voltage with the FET ‘off’. Toggle the FET on then off to discharge the drain, then quickly sense the drain voltage afterward. It will stay at 0 if the LED is unconnected, or drift up towards Vcc with the LED present as the LED leakage bleeds off charge.

The ADC sensing method poses a couple of difficulties however: ADC input range, and input impedance loading the circuit when the driver FET is 'off'.

What to do then? Forget the ADC.

Finally: the easy way. Use a low-threshold nFET like a BSS138 to watch the driver drain. Hammer the driver, check the FET state immediately afterward. If the sense FET stays off, no LED; if it turns on, LED is connected. Try it, here:

schematic

simulate this circuit – Schematic created using CircuitLab

This circuit takes advantage of the fact that there's a bit of capacitance present on the driver FET and the trace. The sensing FET doesn't load this, and so can detect the driver drain off-state charge with the LED present or absent.

A long time ago for a product, I worked out this issue by using a current mirror. Basically, I used a matched NPN pair wired up as a mirror and sent a very small (tens of microamps) current to the LED, not enough to light it. The mirror output swung enough voltage that it could read it with a GPIO. Once my diags were done I turned off the current mirror so even the phantom sense wasn’t present. Why did I go to so much trouble? I was very short on GPIOs and needed to resort to some tricks to reuse them.

The ADC can measure the FET drain voltage with the FET ‘off’, with a bit of work. First, toggle the FET 'on' then 'off' to discharge the drain and trace capacitance, then quickly sense the drain voltage afterward. The voltage will stay at 0 if the LED is unconnected, or drift up towards Vcc with the LED present as the LED leakage bleeds off charge.

That said, the ADC sensing method poses a couple of difficulties: ADC input range (which needs to include Vcc), and ADC input impedance loading the circuit when the driver FET is 'off'. Either one will prevent proper sensing of the FET drain charge.

What to do then? Forget the ADC. There's an easier way.

Use an nFET to watch the driver drain voltage. Just like with the ADC method: pulse the driver 'on' then check the FET state shortly afterward. If the sense FET stays off, no LED; if it turns on, LED is connected. Try it, here:

schematic

simulate this circuit – Schematic created using CircuitLab

This circuit takes advantage of the fact that there's a bit of capacitance present on the driver FET drain and the board trace. The sensing nFET doesn't load this, and so can detect the driver drain off-state charge with the LED present or absent.

added 6 characters in body
Source Link
hacktastical
  • 58.4k
  • 2
  • 54
  • 166

I worked out this issue by using a current mirror. Basically, an NPN pair wired up to send a very small current to the LED, not enough to light it. The mirror output would swing enough voltage that it could be sensed with a GPIO. Once my diags were done I turned off the current mirror so even the phantom sense wasn’t present. I did it this way as I didn’t have an ADC available and I was very short on GPIOs.

If you have an ADC, you can measure the FET drain voltage with the FET ‘off’. Toggle the FET on then off to discharge the drain, then quickly sense the drain voltage afterward. It will stay at 0 if the LED is unconnected, or drift up towards Vcc with the LED present as the LED leakage bleeds off charge. This

The ADC sensing method poses a couple of difficulties however: ADC input range, and input impedance loading the circuit when the driver FET is 'off'.

What to do then? Forget the ADC.

Finally: the easy way. Use a low-threshold nFET like a BSS138 to watch the driver drain. Hammer the driver, check the FET state immediately afterward. If the sense FET stays off, no LED; if it turns on, LED is connected. Try it, here:

schematic

simulate this circuit – Schematic created using CircuitLab

This circuit takes advantage of the fact that there's a bit of capacitance present on the driver FET and the trace. The sensing FET doesn't load this, and so can detect the driver drain off-state charge with the LED present or absent.

I worked out this issue by using a current mirror. Basically, an NPN pair wired up to send a very small current to the LED, not enough to light it. The mirror output would swing enough voltage that it could be sensed with a GPIO. Once my diags were done I turned off the current mirror so even the phantom sense wasn’t present. I did it this way as I didn’t have an ADC available and I was very short on GPIOs.

If you have an ADC, you can measure the FET drain voltage with the FET ‘off’. Toggle the FET on then off to discharge the drain, then quickly sense the drain voltage afterward. It will stay at 0 if the LED is unconnected, or drift up towards Vcc with the LED present as the LED leakage bleeds off charge. This sensing method poses a couple of difficulties however: ADC input range, and input impedance loading the circuit when the driver FET is 'off'.

What to do then? Forget the ADC.

Finally: the easy way. Use a low-threshold nFET like a BSS138 to watch the driver drain. Hammer the driver, check the FET state immediately afterward. If the sense FET stays off, no LED; if it turns on, LED is connected. Try it, here:

schematic

simulate this circuit – Schematic created using CircuitLab

This circuit takes advantage of the fact that there's a bit of capacitance present on the driver FET and the trace. The sensing FET doesn't load this, and so can detect the driver drain off-state charge with the LED present or absent.

I worked out this issue by using a current mirror. Basically, an NPN pair wired up to send a very small current to the LED, not enough to light it. The mirror output would swing enough voltage that it could be sensed with a GPIO. Once my diags were done I turned off the current mirror so even the phantom sense wasn’t present. I did it this way as I didn’t have an ADC available and I was very short on GPIOs.

If you have an ADC, you can measure the FET drain voltage with the FET ‘off’. Toggle the FET on then off to discharge the drain, then quickly sense the drain voltage afterward. It will stay at 0 if the LED is unconnected, or drift up towards Vcc with the LED present as the LED leakage bleeds off charge.

The ADC sensing method poses a couple of difficulties however: ADC input range, and input impedance loading the circuit when the driver FET is 'off'.

What to do then? Forget the ADC.

Finally: the easy way. Use a low-threshold nFET like a BSS138 to watch the driver drain. Hammer the driver, check the FET state immediately afterward. If the sense FET stays off, no LED; if it turns on, LED is connected. Try it, here:

schematic

simulate this circuit – Schematic created using CircuitLab

This circuit takes advantage of the fact that there's a bit of capacitance present on the driver FET and the trace. The sensing FET doesn't load this, and so can detect the driver drain off-state charge with the LED present or absent.

added 234 characters in body
Source Link
hacktastical
  • 58.4k
  • 2
  • 54
  • 166

I worked out this issue by using a current mirror. Basically, an NPN pair wired up to send a very small current to the LED, not enough to light it. The mirror output would swing enough voltage that it could be sensed with a GPIO. Once my diags were done I turned off the current mirror so even the phantom sense wasn’t present. I did it this way as I didn’t have an ADC available and I was very short on GPIOs.

If you have an ADC, you can measure the FET drain voltage with the FET ‘off’. Toggle the FET on then off to discharge the drain, then quickly sense the drain voltage afterward. It will stay at 0 if the LED is unconnected, or drift up towards Vcc with the LED present as the LED leakage bleeds off charge. This sensing method poses a couple of difficulties however: ADC input range, and input impedance loading the circuit when the driver FET is 'off'.

What to do then? Forget the ADC.

Finally: the easy way. Use a low-threshold nFET like a BSS138 to watch the driver drain. Hammer the driver, check the FET state immediately afterward. If the sense FET stays off, no LED; if it turns on, LED is connected. Try it, here:

schematic

simulate this circuit – Schematic created using CircuitLab

This circuit takes advantage of the fact that there's a bit of capacitance present on the driver FET and the trace. The sensing FET doesn't load this, and so can detect the driver drain off-state charge with the LED present or absent.

I worked out this issue by using a current mirror. Basically, an NPN pair wired up to send a very small current to the LED, not enough to light it. The mirror output would swing enough voltage that it could be sensed with a GPIO. Once my diags were done I turned off the current mirror so even the phantom sense wasn’t present. I did it this way as I didn’t have an ADC available and I was very short on GPIOs.

If you have an ADC, you can measure the FET drain voltage with the FET ‘off’. Toggle the FET on then off to discharge the drain, then quickly sense the drain voltage afterward. It will stay at 0 if the LED is unconnected, or drift up towards Vcc with the LED present as the LED leakage bleeds off charge. This sensing method poses a couple of difficulties however: ADC input range, and input impedance loading the circuit when the driver FET is 'off'.

What to do then? Forget the ADC.

Finally: the easy way. Use a low-threshold nFET like a BSS138 to watch the driver drain. Hammer the driver, check the FET state immediately afterward. If the sense FET stays off, no LED; if it turns on, LED is connected. Try it, here:

schematic

simulate this circuit – Schematic created using CircuitLab

I worked out this issue by using a current mirror. Basically, an NPN pair wired up to send a very small current to the LED, not enough to light it. The mirror output would swing enough voltage that it could be sensed with a GPIO. Once my diags were done I turned off the current mirror so even the phantom sense wasn’t present. I did it this way as I didn’t have an ADC available and I was very short on GPIOs.

If you have an ADC, you can measure the FET drain voltage with the FET ‘off’. Toggle the FET on then off to discharge the drain, then quickly sense the drain voltage afterward. It will stay at 0 if the LED is unconnected, or drift up towards Vcc with the LED present as the LED leakage bleeds off charge. This sensing method poses a couple of difficulties however: ADC input range, and input impedance loading the circuit when the driver FET is 'off'.

What to do then? Forget the ADC.

Finally: the easy way. Use a low-threshold nFET like a BSS138 to watch the driver drain. Hammer the driver, check the FET state immediately afterward. If the sense FET stays off, no LED; if it turns on, LED is connected. Try it, here:

schematic

simulate this circuit – Schematic created using CircuitLab

This circuit takes advantage of the fact that there's a bit of capacitance present on the driver FET and the trace. The sensing FET doesn't load this, and so can detect the driver drain off-state charge with the LED present or absent.

added 291 characters in body
Source Link
hacktastical
  • 58.4k
  • 2
  • 54
  • 166
Loading
added 291 characters in body
Source Link
hacktastical
  • 58.4k
  • 2
  • 54
  • 166
Loading
added 218 characters in body
Source Link
hacktastical
  • 58.4k
  • 2
  • 54
  • 166
Loading
added 263 characters in body
Source Link
hacktastical
  • 58.4k
  • 2
  • 54
  • 166
Loading
added 98 characters in body
Source Link
hacktastical
  • 58.4k
  • 2
  • 54
  • 166
Loading
Source Link
hacktastical
  • 58.4k
  • 2
  • 54
  • 166
Loading