Reading 7 buttons state through analog input

Guys,

I've been trying to read 7 buttons state by using a single arduino pin.

Got it working, but i'm using different resistors values, and the problem i'm facing now is in the last 3 or 4 buttons (of 7) voltage readings are pretty similar which makes hard to identify what's the pressed one.

This is the resistors I currently have...

56
120
220
1K
1.2K
10K

My questions is:
How can allocate them in a way I can get readings not so similar each other?
I guess this can be determined through ohms's law but not sure how. :drooling_face:

Thanks.

Well if your unable to get high precision resistors, then you will need to get a wider range of resistors. 1k and 1k2 will not do it. Change the 1k2 to a 4k7 and that should fix the problem. When you measure a resistor value, it does not come up as a normal resistor value. It comes up as a range between 0 - 1023, based on the voltage from a 5 volt reference. (1023 being, 5 volts)

Use the values shown on your schematic. :wink:

I assume you do have the 100k resistor across the input? The resistor on each switch along with the 100k resistor between the input and ground form a [u]voltage divider[/u] where the voltage is proportional to the resistance ratio. Your values are all low compared to the 100K resisistor, which means that most of the voltage is always dropped across the 100K (and the input), no matter what "upper" resistor is used.

I assume you do have the 100k resistor across the input?

What 100k resistor? If its in his picture, I cant see it, I don't have his picture for some reason.

Edit: got it, I had to clear my cookies and reload my browser.

So, Yes with the 100k resistor, it will act as a voltage divider

Thak you guys,

This is the img just in case it doesn't appear

http://www.instructables.com/files/deriv/F8X/QWC3/G1BBBYQT/F8XQWC3G1BBBYQT.LARGE.jpg

But I don't have any 100K resistor, only the values I posted above.

PS: You are probable thinking "then go to the store and buy those resistors", the fact is, there is no electronics stores here (sad but true), I have to order online and that takes few days.

Jay98:
But I don't have any 100K resistor, only the values I posted above.

PS: You are probable thinking "then go to the store and buy those resistors", the fact is, there is no electronics stores here (sad but true), I have to order online and that takes few days.

http://physics.bu.edu/py106/notes/Circuits.html

I know they can be wired in serial untill reach the desired value.
Just looking for a cleaner way so I avoid the soldering work and save physical space over the board.

Jay98:
I know they can be wired in serial untill reach the desired value.
Just looking for a cleaner way so I avoid the soldering work and save physical space over the board.

That's the buy the correct resistors way.

Allright, ty.