# series resistors for dividing 5volts into even bands

I have made the following circuit in a breadboard. It connects switches in parallel via series resistors to an analogue pin.

I'd like to know how to work out what rating each of the resistors in series would need to be in order to have 30 switches in the circuit. Through simply dividing 1024 by 30 I have worked out that each band would need to be 34 bits wide. SO how do I work out what resistor would give me that?

Thanks

P.S. I can't use more than one Analogue Pin by the way

This is called an R2R Ladder.

It is a form of DAC(digital to analog converter).

An internet search will provide lots of tutorials on how to calculate values and how to properly implement it.

Hutkikz:
This is called an R2R Ladder.

No it is not.

SO how do I work out what resistor would give me that?

All resistors should be the same value. No need to work anything out.

Remove the 4K7 on the analogue input and put the last 1K to ground.

Here is a way to "read" lots of switches all on one Arduino pin. I've used this to effectively identify 32 states using a single analog pin. (I was trying to insert a schematic from my computer, but I don't see a means to do that, so please try to visualize.)

Wire up a three resistors in series say, 4K, 2K, and 1K, in that order. Attach VRef above the 4K resistor, and put a 500 ohm resistor to ground below the 1 K. Attach the point between 1K and 500 ohm to an analog pin.

Now wire a bypass switch around each resistor. When you close the switch, that resistor exits the series arrangement. With three resistors as exemplified here, all eight states of open and closed switches provide 7K through 0 K resistance, in even steps, above the current limiting 500 ohm one. ( Each resistor added to the chain doubles the number of states.)

The analog pin can now read eight evenly spaced voltages, based on the positions of the three switches. This is effectively a binary counting scheme, but you may have to play a bit to get resistors which are multiples of a common lowest value.

To get reasonably close resistor values, I had to shave some carbon types to increase their resistance. Of course, exact values aren't necessary, and you can always use a lookup table associated with the various voltages read on the analog pin.

jrdoner:
Now wire a bypass switch around each resistor. When you close the switch, that resistor exits the series arrangement. With three resistors as exemplified here, all eight states of open and closed switches provide 7K through 0 K resistance, in even steps, above the current limiting 500 ohm one. ( Each resistor added to the chain doubles the number of states.)

The analog pin can now read eight evenly spaced voltages, based on the positions of the three switches.

No, they are not evenly spaced. Do you see why?

(I am channelling Mike again!)