using a spdt switch as input

jondvy

New Member
Hullo, I wonder if someone could answer a question which seems simple but which I have struggled to find the answer to?

Can I use a single pole double throw switch as a digital input device to a picaxe chip without the resistors usually shown in diagrams which use a simple momentary on switch. In other words if the common part of the switch is connected to the picaxe pin and the other two are connected to the +ve and 0v rails respectively will I encounter any problems. I suspect not because unlike any open switch in which one state will be floating unless it is tied to one of the rails a spdt switch arranged like above will either be fully +ve or fully grounded. Am I being naive?

Thanks in advance
 

nick12ab

Senior Member
Depends whether the switch is make before break or break before make. If it is make before break then a brief short will be caused on the power rails causing the PICAXE and everything else to reset but if it is break before make then unless there could be a problem with the PICAXE input briefly floating for the short time it takes for the switch to be toggled then it will be fine.
 

srnet

Senior Member
I would work, although be aware that if the switch goes faulty, it could short out the +Ve and 0V rails and melt.

As for the resistors, PICAXEs do have internal pullup resistors on some pins that you can enable. Then a simple push button is enough, no additional resistors required.
 

techElder

Well-known member
Now, think about what you are trying to accomplish and decide if it's worth doing that way.

Are you just trying to save a resistor?

If you tied one of your inputs to "+ve" it would always read as logical HIGH unless your switch was wired to pull it down to logical LOW. Or vice versa. Your switch would only have 2 wires to it, because NOT CONNECTED or FLOATING would already be determined by tying a PICAXE pin HIGH or LOW. You could tie it that way with an external resistor or use the internal pullup as stated by srnet above.
 
Top