Poles of on-off switch get shorted if switch gets forced in the "middle". Ideas?

Hi,

I am using an on/off switch (this one if anyone cares) which has two states and three pins. The pin in the middle gets shorted with one of the poles at a time, depending on which position the knob of the switch is on. Pretty standard stuff.

My problem is that if someone forces the switch to remain in the middle, then all the pins get shorted, reaching an unintended state. In my case, the two poles that are shorted to each other are vcc and ground, therefore someone can create a short circuit on purpose or by mistake. Here is the simplified schematic.

So, how can I [u]prevent[/u] misuse? I have thought of placing a resistor on the ground signal, so even if someone forces the switch in the "middle" and therefore short circuiting the two different states, they will not be able to damage something. Any other more elegant (cheaper/safer/requiring less space) solutions?

You say the switch connects all pins when switching. Choose a switch that doesn't short_circuit or add resistors in such a way that your software can detect the faulty setting.

knut_ny: Choose a switch that doesn't short_circuit

This is an option I would like to avoid, as it would set my time-plan behind a lot.

or add resistors in such a way that your software can detect the faulty setting.

Hmm, this is not really about software (there is no software directly involved in what i am making at this stage), but more for protecting the hardware. The current limiting resistor is also what I have thought. :)

Hi, You have a [u]make before break[/u] slide switch. You need a [u]break before make[/u] slide switch.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png? There may be a way around you problem with what you have.

Thanks.. Tom... :)

Toggle switches are usually break-before-make, slide/rotary switches often are not. Its one of the specifications of a multi-position switch that ought to always be given in the data-sheet.

Yes, break-before-make versus make-before-break.

OK, you have a design problem here.

This is a sort of "XY problem". What you should have done, is to explain why you want your switch to switch between Vcc and ground. It is clearly an unsafe and thus, bad design from the get-go.

If for example, you wish to use this as a control input to a microcontroller - such as an Arduino - then you either use a pull-up to Vcc and wire one set of switch contacts between the input and ground, or you use the built-in "INPUT_PULLUP" function of the microcontroller. If this is the case, we can discuss the various design factors involved.

While there are situations in which the switch should switch between Vcc and ground, I fancy it is pretty safe to guess that yours is not one of them.

Feed VCC to common pin and have pull-down resistors to ground on C1 and C2. With a forced centre position VCC isn't affected and C1 and C2 sit at VCC. Now arrange your logic so that it looks for a grounded input rather than a VCC input.

jackrae:
Feed VCC to common pin and have pull-down resistors to ground on C1 and C2. With a forced centre position VCC isn’t affected and C1 and C2 sit at VCC. Now arrange your logic so that it looks for a grounded input rather than a VCC input.

Or more correctly, ground the common pin and use pull-up resistors on the A and B poles to two microcontroller inputs.

Presuming only that you wish to flag the “middle” position as an error.

The very problem in the first place points out that it is a bad idea to reticulate Vcc to control switches unless there is absolutely no other way.

Thank you all for the wonderful input! I was not even aware of the “make before break” and the “break before make” concepts. Now I am! :slight_smile:

So, a more “holistic” view of the related part of the circuit is this:

Briefly, the switch is connected to an NPN transistor and is also used as the triggering signal of an 74HC4066.

I saw that some of you mentioned of a pull up/down. Is this not essentially the same as doing something like this:

By putting a resistor on the ground pin, even if the two poles are shorted, the circuit is protected.

Using the switch circuit like you intend, you appear to be transferring the base input between VCC and ground. You could achieve the same effect with an spst switch and a single permanent resistor from base to ground

jackrae:
Using the switch circuit like you intend, you appear to be transferring the base input between VCC and ground. You could achieve the same effect with an spst switch and a single permanent resistor from base to ground

absolutely, but i could not find one readily available and more specifically an angled one (i.e. it “sits” on the PCB sideways). Any suggestions?

Hi,

Thats not a slide switch symbol.

This is a slide switch symbol..

Its shows a switch, where is the switch Eagle symbol? ? ? ?

It looks like an IC with one inverting and non inverting I/O.

[soapbox] Hmmm.... I know I'm being picky, or is it a socket, even more confusing (SK- ????) How do I know its Eagle, lousy default text layout and bad colors. [/soapbox]

Tom... :)

Hi,

kuruki: absolutely, but i could not find one readily available and more specifically an angled one (i.e. it "sits" on the PCB sideways). Any suggestions?

You don't need to find another switch to do the job jackrae suggested, just rewire the one you have. Tom... :)

PS, did you breadboard this before going to PCB?

The switch you have is absolutely fine. You just needed to explain (the "XY problem",) what you wanted it for.

OK, your diagram is not well drawn, but insofar as you need to provide a positive voltage to turn on the transistor Q2, you can wire the common to the 1k resistor feeding the transistor base and HC4066, contact "A" to Vcc and leave contact "B" unconnected (which makes the wring easier).

Just wire a 10k resistor between the common and ground - this will draw negligible current when the switch is on and will definitively pull the HC4066 input to ground when the switch is off.

I remain uncomfortable with running Vcc wiring to external switches for any distance and there are ways of doing this with the switch connected only to ground, but if the switch is on the PCB it is probably safe.

lol, the symbols etc, are part of the seeed opl library :)

TomGeorge: Hi,You don't need to find another switch to do the job jackrae suggested, just rewire the one you have. Tom... :)

Brilliant! Why didn't I think of this before replying? :P So a pull down resistor on the signal pin like this:

|404x500

PS, did you breadboard this before going to PCB?

Yeah, well... kinda. Did not use the particular switch. The reason of not using a pull down like in the above schematic, is that I thought it'd be possible to skip using a resistor. But I wasn't aware of the "make before break" concept.

Paul__B: The switch you have is absolutely fine. You just needed to explain (the "XY problem",) what you wanted it for.

OK, your diagram is not well drawn, but insofar as you need to provide a positive voltage to turn on the transistor Q2, you can wire the common to the 1k resistor feeding the transistor base and HC4066, contact "A" to Vcc and leave contact "B" unconnected (which makes the wring easier).

Just wire a 10k resistor between the common and ground - this will draw negligible current when the switch is on and will definitively pull the HC4066 input to ground when the switch is off.

Sorry, didn't see your response before replying. I believe I have you covered in the schematic above, right?

I remain uncomfortable with running Vcc wiring to external switches for any distance and there are ways of doing this with the switch connected only to ground, but if the switch is on the PCB it is probably safe.

This is a little off topic, as the switch will be on a PCB, but can you elaborate on why if you wish?

kuruki: This is a little off topic, as the switch will be on a PCB, but can you elaborate on why if you wish?

It's basic.

Running power wires to different parts of equipment and particularly on flexible cables out of the enclosure invites interesting fault modes.

Paul__B: It's basic.

Running power wires to different parts of equipment and particularly on flexible cables out of the enclosure invites interesting fault modes.

Never really paid attention to this. Will keep it under consideration for the future. Thanks!