Go Down

Topic: Multiple Resistor Ladders with one arduino? (Read 1 time) previous topic - next topic

tisbeme

Is it possible to have multiple resistor ladders with one arduino UNO to control ~25 buttons that may have to be pressed simultaneously? I would like a resistor ladder to be in parallel with different resistors for each button, but to provide each set of ladders its' own 5v source. Would they all have to connect to the same ground if it is possible? Thank you for your time.

larryd

#1
Jun 28, 2018, 03:20 am Last Edit: Jun 28, 2018, 03:24 am by larryd
What are the switches connect to?

If you just want data entry, use an IR remote.




No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

MarkT

Quote
Is it possible to have multiple resistor ladders with one arduino UNO to control ~25 buttons that may have to be pressed simultaneously?
6 analog pins each with a 4 or 5 way ladder would work.  Its much easier if only one button at a time
is pressed, as such ladders of push buttons are non-linear so button combinations are complex to
figure out.

There are ways to make a linear ladder with power-of-two scaling, using a constant-current source and
each button shorting across one resistor in the 1:2:4:16 ladder - then the voltage is a scaled binary code
for the set of buttons pushed.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

tisbeme

6 analog pins each with a 4 or 5 way ladder would work.  Its much easier if only one button at a time
is pressed, as such ladders of push buttons are non-linear so button combinations are complex to
figure out.

Thats the thing, it has to be pressed simultaneously. So how would I power the 4 buttons a row, for 6 rows (Or 5 buttons for 5 rows). I'm picturing the 5v to power 6 ladders in parallel then it all goes to the same ground, if that makes sense. But I am wondering if I should be worried about damaging the arduino by doing that? And I think I'd rather do the ladder in parallel just so the resistor math is easier. And I don't the IR remote is the direction I want to go with this

polymorph

I took far too long to wire up an R2R resistor ladder on a DIP header for 6 buttons.

I also ordered some SIP 8 button R2R resistor ladders from Digikey for $20 for 25 of them. Much simpler. And you can have multiple button presses.

https://www.digikey.com/product-detail/en/bourns-inc/4610X-R2R-103LF/4610X-R2R-103LF-ND/3787967
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

tisbeme

I took far too long to wire up an R2R resistor ladder on a DIP header for 6 buttons.

I also ordered some SIP 8 button R2R resistor ladders from Digikey for $20 for 25 of them. Much simpler. And you can have multiple button presses.

Thank you for the help. I'm looking at the data sheet for these and it is going over my head. I understand where to put the buttons and all, but where do I input power to them? These look helpful, I just don't quite understand them. Also how accurate can these be since you can have 10-16 buttons on one pin?

polymorph

A complication is that an R2R ladder cannot just use pullups, it must be driven with symmetrical sink/source. So either use SPDT buttons/switches, or use a 4049 or 4050 CMOS inverter or buffer. Then you can put a pullup on a SPST button/switch.



In the datasheet for that SIP, look at the "10 Pin 8 Bit SIP".

https://www.bourns.com/docs/Product-Datasheets/R2R.pdf

Pin 1 is the output that goes to the Arduino analog input. Pin 10 is grounded. All of the other pins are either connected to ground or 5V (or 3.3V if your Arduino is running on 3.3V) by the switches or a buffer driven by the switch.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

tisbeme

That all got super complicated super fast. I honestly at this point would rather build my own resistor ladder just because I don't have control over what type of buttons I use. I would just like to know, if I build my own resistor ladder. I can power it from the same 5v source as 4 other resistor ladders without frying my arduino. If i have my resistors relatively high the current should not exceed what the arduino ground can handle?

larryd

"That all got super complicated super fast. I honestly at this point would rather build my own resistor ladder just because I don't have control over what type of buttons I use. I would just like to know, if I build my own resistor ladder. I can power it from the same 5v source as 4 other resistor ladders without frying my arduino. If i have my resistors relatively high the current should not exceed what the arduino ground can handle?"

A DIY ladder network is not the way to go as manually selecting resistors is arduous.
The resistors are one problem the required amplifiers is a whole other story.

Suggest you use a switch matrix as it would be reliable.



No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

larryd

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

tisbeme

A complication is that an R2R ladder cannot just use pullups, it must be driven with symmetrical sink/source. So either use SPDT buttons/switches, or use a 4049 or 4050 CMOS inverter or buffer. Then you can put a pullup on a SPST button/switch.


Pin 1 is the output that goes to the Arduino analog input. Pin 10 is grounded. All of the other pins are either connected to ground or 5V (or 3.3V if your Arduino is running on 3.3V) by the switches or a buffer driven by the switch.
Ok i understand why you were pointing me towards R/2R networks. I need it if I'm doing multiple buttons at a time. And I am starting to slowly understand it all. That does seem like a good solution, but I can have multiple wired up right? I still dont quite understand spdt buttons but thats ok.

A DIY ladder network is not the way to go as manually selecting resistors is arduous.
The resistors are one problem the required amplifiers is a whole other story.

Suggest you use a switch matrix as it would be reliable.

And i appreciate this input Larry. That whole page you linked was super helpful, I'm going to study it a bit more, but it looks like a great solution.

larryd

#11
Jun 29, 2018, 12:07 am Last Edit: Jun 29, 2018, 12:55 am by larryd
For multiple switch press to be detected, you will need the anti ghosting diodes that the discussion mentions.

cct. with ghosting diodes




Here is a one switch at a time cct. I worked on.
It contains no ghosting diodes so you would have to add them.



No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

polymorph

SPDT is Single Pole Double Throw. So the center contact is always in contact with one of two other contacts.

SPST is Single Pole Single Throw. So there are only two contacts. A switch labeled NO is Normally Open, closed only when pressed, this is the most common type of pushbutton. Labeled NC means Normally Closed, pushing it opens. Interlock switches that remove power when a cabinet or door is opened are made this way.



DPDT is Double Pole Double Throw, the Double Pole just means it has two SPDT switches in it. Similarly, 4PDT means four SPDT.

It is quite simple once you understand the acronyms.

A SP6T switch would have one main contact that switches between 6 other contacts, for instance a 6 position rotary switch.

Here is a page on Sparkfun about it:
https://learn.sparkfun.com/tutorials/switch-basics/poles-and-throws-open-and-closed

I have a Teslapunk prop I'm building that has several toggle and pushbutton switches. I don't want to use up all of my inputs on the buttons and switches, and they may be left in many combinations. So I'm using an R2R network, the SIP that I linked to. I could use a buffer IC on the pushbuttons so I can use momentary SPST, but instead I'll just choose SPDT pushbuttons. The toggles are all at least SPDT anyway.

You do have to take the normal precautions against noise when using analogRead(). If using Vcc as the reference voltage, make sure it is well bypassed, avoid ground loops, that sort of thing. You should be learning those skills if you don't have them already.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

Go Up