Question about measuring voltage on analog input

Hey,

I want to hook up multiple buttons on a single analog input. I know there are a lot of tutorials about that, and the one I currently checked is this one: Multiple button inputs using Arduino analog pin « RAYSHOBBY.NET

But there is one thing I do not understand: How can I calculate the ideal resistor for let's say 20 buttons?
For the calculation I would need the current, right?

I know this might sound stupid, but I just checked with a multimeter, a 1.5v battery and some 470k resistors, and the voltage was the same after each resistor (1.598v).

What am I missing here?

If you draw a schematic of your circuit and mark the points where you have the meter connections, the reason should be apparent. Please share the schematic with us.

Paul

Hi,

I attached an image here, which shows my test setup. The capacitor I used was I think a 22uF, I just threw the schematic together real quick.

x0r13:
Hi,

I attached an image here, which shows my test setup. The capacitor I used was I think a 22uF, I just threw the schematic together real quick.

Your “measure B” points need to be connected together so there is a connection between the resistors and ground.

You do not have a complete path for the current to flow.

Paul

7cc5a6c98b107abb958b00ca5cde59a43db05427.png

20 buttons is a LOT. If one button gets a little corroded or clogged with a speck of dust, it is too easy for that resistance to make it appear as a different button to the Arduino.

Consider using your buttons in a 'matrix' and using a specialised chip to read them, possibly communicating to the Arduino over SPI (or I2C if the distance is short.)

well, I'm open for suggestions :slight_smile:

Maybe using a MCP23017-E/SO would be a good idea? I might add that I'm planning on using a ATTiny85, and not a full blown Arduino/ATMega.

And what I still don't understand is, why I always measured the same voltage in my test board.

x0r13:
well, I'm open for suggestions :slight_smile:

Maybe using a MCP23017-E/SO would be a good idea? I might add that I'm planning on using a ATTiny85, and not a full blown Arduino/ATMega.

And what I still don't understand is, why I always measured the same voltage in my test board.

Because you didn't make a complete circuit. You have created a voltage divider and the part where there's no wire connecting is infinite resistance. So no matter how big you make the resistors, all the voltage drops across the resistor that is infinity (the open circuit).

Delta_G:
Because you didn't make a complete circuit. You have created a voltage divider and the part where there's no wire connecting is infinite resistance. So no matter how big you make the resistors, all the voltage drops across the resistor that is infinity (the open circuit).

I guess we need a bigger stick!