On/Off Switch?
December 26, 2006 2:19 PM   Subscribe

Electronics for dummies? I need something very simple. There is one switch and two wires. When the switch is open, I want wire A to be grounded and wire B floating, when the switch is closed, Wire B should be grounded and wire A floating. Simple as that. What's the very very easiest way to achieve this (preferably using household equipment)?

By floating I mean of indeterminate state. The 'switch' is just two pieces of copper which are either in contact or not. The wires connect to a 8254 counter (one of these) and will be pulled high by resistors in the module (unless they're grounded). The objective is to count the time of two states of a rotating spindle, during part of the rotation (x) the circuit is open, during the remainder (y) the circuit is closed. Grounding the wires will 'gate' the counters, I can then read the gated counters, average the values, calculate the rpm etc.

Timing is very important for the finished circuit, so the switching should be pretty much instantaneous.

I'm sure there is a simple and elegant solution to this problem, I just can't think what it is.
posted by grahamwell to Technology (6 answers total)
 
DPDT relay, coil wired to your switch, counter wires attached to the blades of each of the relay's switches, and the ground connected to a diagonally opposite pair of the other four terminals.
posted by cillit bang at 2:24 PM on December 26, 2006


Note that relays are slow, considered electronically. In relation to human perception, they're instantaneous. Dig around digikey.com, check out some relay data sheets, and see if they're fast enough for your needs.
posted by TheOnlyCoolTim at 2:29 PM on December 26, 2006


Two problems with using a mechanical switch or relay in such an application:

1) Contact bounce.
2) Inter-circuit timing. If you want guaranteed make-before-break or break-before-make behaviors, you need specifically designed DPDT switches or relays, which usually have a mechanical cam action actuator internally. Otherwise, with age and wear, intercircuit timing changes.

The tool for the job is a Hall effect transducer, many of which are packaged as single-pole devices in a 1/4-20 threaded mechanical package, with 3 or 4 lead integral wires [link to DigiKey catalog page for Honeywell sensors as .pdf file]. A 4 lead package provides a Vcc, Gnd, and 2 opposite polarity switching outputs, logical OR'd internally for consistent switching ramp behavior over time and temperature. Such devices put out a stable, clean signal when measuring RPMs from as low as fractional RPM to several thousand RPM.
posted by paulsc at 3:28 PM on December 26, 2006


Best answer: Connect one wire to VCC and the other wire to A. Then connect the same wire to B through an inverter. You can use a simple 1-transistor inverter" or an "open collector" inverter in a DIP package.
posted by jepler at 3:49 PM on December 26, 2006


It isn't real clear from your description but why is it necessary to measure the two states during a rotation. If the x and y portions are fixed, for example, x = 30% of a rotation and y = 70% of a rotation (using fixed cams) and the speed of rotation doesn't vary during a single rotation, then all you have to do is measure the RPM. The x and y times can be derived by simple math from the RPM. In that case all you need is a pulse counter that counts one pulse per rotation.

It would help if you gave a better description of the application, including speed ranges and desired accuracy.
posted by JackFlash at 12:46 AM on December 27, 2006


Response by poster: OK, to be a little clearer, both the RPM and the fraction of the revolution during which the circuit is open both vary and need to be measured and averaged very accurately. Maximum speed is about 1000 RPM. The clock/counters that I have can do this accurate measurement, but the software driver for the device needs to poll the counters in order to read and reset them and I'm not sure how fast this polling will be - it may be quite slow and it will be PC clock rather than hardware driven.

My thinking therefore is to use two counters, one measuring the open circuit, the other the closed. Add them together and you can calculate the RPM. The attraction of this approach is that each counter will be gated and thus switched off for at least a quarter of a revolution, during which time the software can amble in, figure out what's going on, then read and reset the counters as appropriate. In this way the hardware gated counters can be very accurate and the relative imprecision of the software polling doesn't much matter.

Looks to me as though jepler has it, what I need is an inverter.
posted by grahamwell at 3:45 AM on December 27, 2006


« Older Older Woman? Too old or just right?   |   Help me get off the beaten path in Prague Newer »
This thread is closed to new comments.