Electronic – Detecting presence of a voltage without drawing too much current

comparatormicrocontrolleroperational-amplifiervoltage-detector

I am working on a microcontroller project for a garage door opener. Rather than supply additional magnet+reed switches or other kind of detectors for sensing whether the door is full-open or full-closed, I would prefer to make use of the existing physical limit switches.

In the open state, there is 6.5V across the terminals of the limit switches, and in the closed state, there is about 5mA flowing through. Clearly there is already some current-limiting circuitry in the machine.

In order to provide protection/isolation for my microcontroller, I have been working with an MCT9001 dual opto-isolator chip. With a 1k-ohm resistor in the emitter (input) side of the opto-isolator, I am able to regularly detect the state of the limit switches. However, the garage door opener won't operate when both switches are closed, and with that 1k-ohm resistor, apparently there is sufficient voltage drop that the opener detects that the open switch is closed.

When I increase the resistor to 220k-ohm, the opener operates correctly, but now my opto-isolator isn't operating in saturation mode and so my microcontroller isn't able to reliably determine a clear logic-level signal.

I will continue to try different resistor values, but my question is: Is there a better way to detect whether a voltage is present without drawing any more than a miniscule amount of current?

I see examples of op-amp comparators, but if I power an op-amp with my project power supply, I would have to tie the grounds of the project board and limit switches together and would lose my isolation provided by the opto-isolators. But if I power the op-amp with the switch leads themselves, I (a) will draw too much current to run the op-amp and (b) will not have any power to operate the op-amp when the limit switch is closed.

Is the better solution to find the right resistor value tolerable by the garage door opener, yet which is not so high that the op-amp source emitter is too dim?

Best Answer

Since it appears that the voltage across the optoisolator input is low enough for the controller to interpret it as a low, just put it directly in series with the switch:

schematic

simulate this circuit – Schematic created using CircuitLab

Since the door controller is already limiting the current, you don't need any additional resistors in series with the LED.

If the current sourced by the controller was more than the optoisolator could handle, then a slightly more complicated circuit using a transistor would be required.