Searching \ for '[PIC] Multiple momentary button in 1 single pin' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Multiple momentary button in 1 single pin'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Multiple momentary button in 1 single pin'
2007\06\28@202000 by Ariel Rocholl

flavicon
face
Hi all,

I have only 1 pin available in a PIC16F micro but need to read 5-10
momentary buttons, and do not want to use any other additional external IC.
I figured out a way to work this out using 1 single A/D pin to differentiate
each button from the rest, provided I have different R-R bridge for each
button, therefore if no button is pressed the A/D should read 5V, but as
soon as a button is pressed, a R would move that to, say, 2.8V. If all the
resistor combination are different and I can work with at least
0.25Vdistance between them (
e.g. 0.25V, 0.50V, 0.75V, 1V, etc), looks like a robust and solid solution
to me.

Only drawback I can see is no multiple buttons can be pressed at a time and
give a valid value, but this is not a requirement.

Do you see any problem with this approach? Anybody used something like this
before? Any other option you can suggest for multiple buttons, 1 pin and no
additional circuitry?

Thanks in advance.

--
Ariel Rocholl
Madrid, Spain

2007\06\28@204314 by Marcel Birthelmer

picon face
Hi Ariel,
Our very own Russell McMahon posted a schematic and code to that
effect a while ago on this list. The subject line was "[PIC] Reading 7
Pushbutton Switches With ONE PIC pin". You can find it in the
archives.
Regards,
- Marcel

2007\06\28@205026 by David Novak

picon face
I've seen this method used. The issue that presented itself at the time was
that multiple button presses could be detected as a single button press. I'm
not sure how the issue was resolved.

David


> {Original Message removed}

2007\06\28@205609 by Jinx

face picon face
> Only drawback I can see is no multiple buttons can be pressed
> at a time and give a valid value, but this is not a requirement.

Hi Ariel, two buttons together would give you "a" value, because
of the Rs in parallel. For 10 buttons I think the number of button
pairs would be (10 * 9)/2. The parallel result of some pairs might
be very close to single buttons though. Two low Rs in parallel
would be rejectable because the effective R gives an ADC result
below that of the lowest single R. And two high Rs in parallel for
example might be somewhere between two lower buttons

It would help if you use good quality buttons and fairly tight ADC
ranges. As buttons get dirty over time that might cause problems

I know you said no external chips, but perhaps you can do a little
multiplexing and free up just one more pin ?

http://home.clear.net.nz/pages/joecolquitt/0pots.html

In that top circuit, using an RC you can drive the 4017 with just
1 pin. A C on Reset and an R between Reset and Clock. Short
pulses will clock the 4017, a long pulse will reset it

Substitute pushbuttons or switches for the pots and detect a "1"
on a PIC input, noting the clock position to tell you the switch
number

A similar multiplexing technique here, which I used before the
do-everything PICs came along

http://home.clear.net.nz/pages/joecolquitt/mixer.html

> Do you see any problem with this approach? Anybody used
>something like this before ?

I believe Bob Axtell uses ADC this way

2007\06\28@211946 by Marcel Duchamp

picon face
Ariel Rocholl wrote:
{Quote hidden}

I used this technique to read a 12 position rotary switch; it worked
very well.  Of course, this is a bit different from reading separate
pushbuttons.

2007\06\28@213510 by Tamas Rudnai

face picon face
Hi,

Also Microchip has the tips&tricks doc which describes such possibilities
(tips 5, 6 and 7):

http://ww1.microchip.com/downloads/en/DeviceDoc/40040C.pdf

Regards,
Tamas


On 6/29/07, Marcel Duchamp <spam_OUTmarcel.duchampTakeThisOuTspamsbcglobal.net> wrote:
{Quote hidden}

> -

2007\06\28@225828 by Harold Hallikainen

face
flavicon
face
I've used this approach a couple times. In one case with 15 buttons. I did
a single string of identical resistors (resistor network) between ground
and +5V. The NO contact of each switch picked a point off the series
string. The NC contact of one switch drove the common of the next switch.
This gave a priority order to the switches and prevented invalid voltages
when more than one switch was pressed.

Harold


{Quote hidden}

> -

2007\06\29@020446 by wouter van ooijen

face picon face
> Do you see any problem with this approach?

-sensitive to all kinds of interference.
-pressing a button can take the input voltage "through" the region of
other buttons
-did you calculate the required accuracy of the resistors?

> Anybody used something like this before?

yes, I used nc-busbutton so I need only 2 wires and can detect a broken
wire

> Any other option you can suggest
> for multiple buttons, 1 pin and no additional circuitry?

no

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: http://www.voti.nl/hvu



2007\06\29@044831 by Ariel Rocholl

flavicon
face
Marcel, thanks for the input, you either has a nice memory or a very well
organized archive.
After little search I found the thread, but it was actually from Bob Axtel,
he made this page available for public access, so thanks Bob:
http://www.piclist.com/techref/microchip/sw7_on_1pin.htm

I think I will use pretty much the same approach, I can see clear advantages
in putting resistors in serie rather than paralel as it was my initial
thought. As my application has plenty of free EEPROM, what I would do is to
have a simple routine calibration that will overcome the resistor low
precision, so after activating the routine, pressing the buttons one by one
in order will store a calibration number on the EEPROM. I am using momentary
pushbuttons that have metal contacts, so I do not face the same problem as
carbon membrane keyboard, the initial calibration will probably remain valid
for a long time.

Thanks all for all the posts with info, it really helped a lot.

2007/6/29, Marcel Birthelmer <.....marcelb.listsKILLspamspam@spam@gmail.com>:
>
> Hi Ariel,
> Our very own Russell McMahon posted a schematic and code to that
> effect a while ago on this list. The subject line was "[PIC] Reading 7
> Pushbutton Switches With ONE PIC pin". You can find it in the
> archives.
> Regards,
> - Marcel
> -

2007\06\29@065803 by Ariel Rocholl

picon face
Excellent reference, I didn't know this document, useful for a few things.
Thanks

2007/6/29, Tamas Rudnai <tamas.rudnaispamKILLspamgmail.com>:
{Quote hidden}

2007\06\29@070242 by Ariel Rocholl

flavicon
face
Wouter, do you have a link for nc-busbutton info? Googling didn't help to
find out valid info on this approach.
I'm not thinking on a 2-wires bus for this particular project, will use the
Bob / Harold resistor string approach, but knowing more about busbutton will
not hurt and may be useful for other future project.

Thanks

2007/6/29, wouter van ooijen <EraseMEwouterspam_OUTspamTakeThisOuTvoti.nl>:
{Quote hidden}

> -

2007\06\29@072705 by wouter van ooijen

face picon face
> Wouter, do you have a link for nc-busbutton info? Googling
> didn't help to find out valid info on this approach.

Its very simple: put a number of resistors in series. The top resistor
is connected to +5, and is in the device. The bottom one is connected to
ground. The PIC reads the voltage on the lower pin of the top resistor.
All resistors except the top one are in the user interface, with a
normall-closed pushbutton over the resistor.

No HID connector or broken cable: A/D reads 5V. HID connected but no
button pressed: 0V. One button pressed: inbetween. Arrange the resistors
to get 'evenly spaced' readings.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: http://www.voti.nl/hvu



2007\06\29@075111 by Pablo Ginhson

picon face

Search on this link, is a very usefull book.

ww1.microchip.com/downloads/en/DeviceDoc/40040b.pdf


enjoy it



Pablo Ginhson










> Date: Thu, 28 Jun 2007 18:19:39 -0700> From: marcel.duchampspamspam_OUTsbcglobal.net> To: @spam@piclistKILLspamspammit.edu> Subject: Re: [PIC] Multiple momentary button in 1 single pin> > Ariel Rocholl wrote:> > Hi all,> > > > I have only 1 pin available in a PIC16F micro but need to read 5-10> > momentary buttons, and do not want to use any other additional external IC.> > I figured out a way to work this out using 1 single A/D pin to differentiate> > each button from the rest, provided I have different R-R bridge for each> > button, therefore if no button is pressed the A/D should read 5V, but as> > soon as a button is pressed, a R would move that to, say, 2.8V. If all the> > resistor combination are different and I can work with at least> > 0.25Vdistance between them (> > e.g. 0.25V, 0.50V, 0.75V, 1V, etc), looks like a robust and solid solution> > to me.> > > > Only drawback I can see is no multiple buttons can be pressed at a time and> > give a valid value, but this is not a requirement.> > > > Do you see any problem with this approach? Anybody used something like this> > before? Any other option you can suggest for multiple buttons, 1 pin and no> > additional circuitry?> > > > Thanks in advance.> > > > I used this technique to read a 12 position rotary switch; it worked > very well. Of course, this is a bit different from reading separate > pushbuttons.>

2007\06\29@082429 by Bob Axtell

face picon face
wouter van ooijen wrote:
{Quote hidden}

Yes, this works extremely well. I have 3 different commercial
applications that use 6 to 7 buttons.
The advantages of using the A/D setup are:

1. Only ONE PIC pin used.

2. Easy to stop static discharge problems... Only ONE suppressor diode
is needed!

3. Can handle higher resistance switch contacts, which happens when
rubber membrane conductive
rubber contacts age. No problems later.

If anyone wants to see actual schematic and code snippets, email me offline.

--Bob

2007\06\29@084011 by Jinx

face picon face

> Excellent reference, I didn't know this document, useful for a
> few things

Tips And Tricks is an occassional series that's been going for
quite a while. I'm sure I subscribed to it way back, but never
did get updates. You can try your luck searching Microchip
but Google is often quicker

microchip tips tricks

More... (looser matching)
- Last day of these posts
- In 2007 , 2008 only
- Today
- New search...