1
\$\begingroup\$

I have an equipment that includes a circuit made of a bunch of NO switches arranged in serial. This circuit includes a LED that turns on when all the switches are closed. When one or more switches are open I need to identify which ones are open. The following image depicts the existing circuit:

schematic

simulate this circuit – Schematic created using CircuitLab

My first approach was to put resistors in parallel with each one of the switches and measure the voltage with an ADC input. This kinda works but I feel it will not be very reliable so I'm looking for a different way to do it.

Can anyone suggest a better way?

\$\endgroup\$
  • \$\begingroup\$ Do you absolutely need to detect when one or more is open? With one only it should be quite easyer. Can you use dpst switches? \$\endgroup\$ – Vladimir Cravero Aug 8 '14 at 14:58
  • 3
    \$\begingroup\$ Using a resistor ladder is a common thing, often done in things like car steering wheel buttons to reduce the number of wires needed. The key is using resistor values that are in binary order (1,2,4,8,16) so the ADC measurement is unambiguous. I'm assuming that you don't have the spare IO or can't read each switch individually for some other good reason. If you have 2 IO lines you could read the switches with a shift register chip, or I2C/SPI IO expander IC such as MCP23017. \$\endgroup\$ – John U Aug 8 '14 at 15:03
  • \$\begingroup\$ Does it have to be electronically detected? If not you could wire in resistor/led pairs in parallel with each open switch. Whenever the switch closes, the led across it will shut off. You would have to make sure the resistance/voltage drop of your main led won't turn on unless all of the switches are closed. \$\endgroup\$ – horta Aug 8 '14 at 15:08
  • \$\begingroup\$ The micro I'm using has limited IO but I can expand it with an I2C expander. @ \$\endgroup\$ – jassuncao Aug 8 '14 at 15:12
  • \$\begingroup\$ @horta It doesn't need to be electronically detected. In fact, I would prefer a galvanically isolated solution. \$\endgroup\$ – jassuncao Aug 8 '14 at 15:27
1
\$\begingroup\$

If you're using a uC that has enough IO, you can go ahead and wire in a small capacitor to each junction you're interested in connecting to one I/O pin. Then set one pin to Input, the other to Output. Send a short pulse by raising the output from 0 to 1 and back to 0 quickly. Have the Input pin detect whether it received that pulse. If the switch is closed the pulse will be seen through the two capacitors. If it's an open switch, no pulse will be seen. Then just sequentially run through each of the switches performing the same operation described using the two I/O pins on each side of it.

This doesn't give galvanic isolation, but it does eliminate any issue of messing with your original signal.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ I think you almost have it. Wouldn't you need to move your R3 (the end that connects to SW1) and connect it to the other end of SW3? This subcircuit would be repeated for every switch, that way each switch could be closed in isolation and still be detected. \$\endgroup\$ – placeholder Aug 8 '14 at 23:34
  • \$\begingroup\$ @placeholder After fully enumerating the circuit, I realized that that idea wouldn't work because the secondary voltage supply would cause a powered short across all of the switches. I've removed that part of the answer. \$\endgroup\$ – horta Aug 10 '14 at 18:31
1
\$\begingroup\$

Resistors across the open switches is probably the easiest method for you. MANY consumer wired remote controls work this way. Eg: Sony Walkman CD players with remote control on the headphones. Older cellphones used the same technique for their earbuds.

You need to pick the resistor values so that your a/d readings are spread apart, preferably spread apart equally.

\$\endgroup\$
0
\$\begingroup\$

One way is a chain of one or more input shift registers, such as CD4021B.

Three IO lines would be required for a CD4021B (or similar chip) to read the inputs, but you would be able to read the state of an unlimited number of switches if you chain the shift registers together. The chips are about 50 cents in single chip quantities.

Depending on your implementation, it may be possible to share two of those three lines (clock and data) with other components.

\$\endgroup\$

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.