Go Down

Topic: Modified R-2R ladder for input buttons (Read 3708 times) previous topic - next topic

DrDiettrich

Now I've tested my R-2R ladder with 8 bit and ADC, and I admit that the resistors should have much less tolerance.

Thanks for encouraging me to adjust my mind by a real-life test :-)

arduino_314

Well, I have deliberately chose three values in the row, it is much better economy - not to waste money if build one or two DAC.

Simply:

R = 991, 2R = (R-1) + (R+1) = 990 + 992

Error is then in theory 0 and negligible in practice.

Wawa

There is also a "binary weighted resistor ladder".
Only one resistor per switch (plus one pull up resistor).

I think all of this is a silly exercise.
As said in post#4, you can't use cheap switches either.
Bad switch contact will make it unreliable over time.
Had to replace lots of tact switches in consumer electronics that used this principle in the eighties.

As asked before, can't you use I2C port expanders for this.
And what else is using all the pins of this Arduino.
Leo..

arduino_314

#18
Dec 09, 2016, 12:40 am Last Edit: Dec 09, 2016, 12:45 am by arduino_314
I think all of this is a silly exercise.
I think you missing several important facts:

1. This is an exercise.
2. I'm a hobbyist. I do not make and sell medical equipment, but make devices for my own personal enjoyment.
3. I'm as well retro nostalgic, I would rather make retro computer than buy and use modern tablet (which I refuse to buy, anyway).
4. I do not use switches, but plain push buttons.
5. As wrote in the first post, using the dedicated I/O expander is out of question. It cost for me almost as new ATmega328p - I would rather buy another ATmega328p.


Wawa

4. I do not use switches, but plain push buttons.

5. As wrote in the first post, using the dedicated I/O expander is out of question. It cost for me almost as new ATmega328p - I would rather buy another ATmega328p.
Plain push buttons ARE (momentary) switches.

A 16-channel MCP23017 expander is ~US$1.20 including free shipping on ebay.

So what else have you connected that use all the pins of the 328.
Many devices/sensors/LCD displays also come in I2C, and can all be connected to the same two I2C pins.
Leo..

Wawa

Things get a lot easier if you only push one button at the time.

http://www.technoblogy.com/show?NGM

Leo..

arduino_314

#21
Dec 09, 2016, 08:40 am Last Edit: Dec 09, 2016, 08:44 am by arduino_314
@Wawa

Why you impose your opinion? All that is already suggested.

About prices: You can buy it for $1.2, for me min price is almost 3 Euro.  The ATmega328p costs 3.3 Euro.

As well, we also have sparkfun distributers here.

For instance, you can buy this for $8.96:
https://www.sparkfun.com/products/10168
For me the price is 13.5 Euro

https://www.sparkfun.com/products/12085
For you that cost $59.36, for me around 70 Euro.

Etc, import taxes, VAT, distributors income, imported quantities... Some prices goes insane.

To order by mail, minimum fixes shipping, custom taxes and VAT exceed your price 50 times + filling paper for custom... Much more expensive and too many  complications...

Again, why you impose your opinion if  you lack many important facts I'm facing with?

I'm quite satisfied with Daniel's suggestion and that is enough for me.

Thank you for your understanding.

Wawa

Sorry for doing that. I just wanted you to think more outside the box.
There might have been other solutions if you had told us why you only had one pin left.

I still doubt that eight buttons with more than one button at the same time can be done that way.
Please post a diagram of the R2R ladder with resistor values, and your experiences.
Leo..

dlloyd

I also have doubts that the pushbutton 8-bit R2R approach can be decoded reliably, for reasons previously stated and for the fact that there's no examples for this being done on the web.

One last suggestion: Use a 74HC165 input shift register to get 8 additional inputs . Daisy-chain for additional inputs.

$0.37 each qty 1
$0.20 each qty 100


Consider your costs for your time, cost and assembly of multiple surface mount resistors, extended BOM list, PCB footprint size, etc. Drastically reduce the components to place and get high reliability results.  (don't forget using a decoupling capacitor per IC).

Here's an example and code from a very reliable source: Using a 74HC165 input shift register

You could mark this thread (SOLVED) if your not interested in further input, but it would be beneficial for everyone if you could provide followup to your project.

arduino_314

Sorry for doing that. I just wanted you to think more outside the box.
What are you talking about? You constantly repeat the same over and over again I said I would not use and  additionally insulting!?

If that is nice practice and manners here, thank you but I do not need any help from here.

If moderators do not react or behaves the same, that is more reason to delete account and forgot about all thing.

sforsandeep

If you only need to operate one button at a time ...


Button Volts
B1     1.0
B2     1.5
B3     2.0
B4     2.5
B5     3.0
B6     3.5
B7     4.0
B8     4.5

Sorry Just a question there... am a very beginner.. So why did you put that capacitor over there? Is that mandatory?

DrDiettrich

The capacitor helps to debounce the switches. It quickly loads from the low resistors (on top), and discharges slowly through the high (100k) resistor. It also reduces stray pick-up on long lines to the keyboard.

lastchancename

#27
Sep 28, 2017, 11:54 pm Last Edit: Sep 28, 2017, 11:54 pm by lastchancename
Now we're heading in the right direction.
OP Asks for advice, gets several meaningful and optional ideas to make a solution.
Move forward.
Experienced responders have a nose for laziness, (they were beginners once)... Sure, there are trolls, chest-beaters, and pretenders - but the help you'll get here is about as good as it gets - if you try to help youself!.

Go Up