Pages: [1]   Go Down
Author Topic: how can I multiple switch sense on one pin?  (Read 303 times)
0 Members and 1 Guest are viewing this topic.
Melbourne, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Is there anything Arduino can’t do?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a project that I am working on that has three on/off switches and I would like to read them all on one pin. (basically I have about 4 pins left so I am trying to be conservative.

I was wondering if there was a way to use a resistor on each switch, and then be able to measure that to see what combination they are either on or off...  note that I need to read them in a way that multiple switches might be on at the same time.

I would like to do it without chips, Ic's etc..,  (keep it simple)

I am having some trouble getting my head around the schmatics.  Any ideas?  

Marty
Logged

Have a look at some cool Sci-fi art and Science Fiction Sculpture by Martin Dolan here...
http://www.marty.com.au Made from scrap meta

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could have your switches connect various resistors to an analog input port and use analogRead to determine which was pressed. By carefully selecting the resistor values, each switch could produce a different voltage on the input.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 634
Posts: 34547
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Look up the R/2R type of D/A converter and use that replacing the digital inputs with your switches. It's much better that the R, 2R, 4R, 8R type as it is difficult to get resistor values that go up in that sequence.
Logged

Pages: [1]   Go Up
Jump to: