Go Down

Topic: Help selecting resistor values (Read 367 times) previous topic - next topic

450nick

Hello Arduino forum people! I want to plug a rotary switch into my Arduino to change menu functions, and I have picked out a rotary switch with 8 positions. The circuit needs to work off a 5v supply voltage, so at my arduino pin end I'm going to have a voltage divider of 10k R1 and 20k R1, which should scale the signal down so that my Teensy 3.2 can read it correctly.

So the next question I have is what resistance to add on the rotary outputs to give me enough of a difference in voltage to be read by the arduino while being strong enough to actually be read.

Presently I'm thinking of the following to add to the input (R1), so R1 will become one of the values below +10k, with 20k R2.


Position   |   Resistance
1   |   Not connected / no signal
2   |   3.33v (no additional resistance)
3   |   2.85v (5k additional resistance)
4   |   2.38v (12k additional resistance)
5   |   1.90v (22k additional resistance)
6   |   1.42v (40k additional resistance)
7   |   0.95v (75k additional resistance)
8   |   0.48v (180k additional resistance)


This gives me about 0.475v between read voltages which hopefully is enough of a difference for the arduino to read clearly, but is the signal voltage on position 7 & 8 too low? If so then perhaps I need to tighten up the gaps, but what would be a reasonable minimum voltage. Also, is position 1 ok not being connected or is this not the best way to approach things?

Thanks all!

AJLElectronics

What's wrong with a rotary encoder?

DVDdoug

I hate to see people using analog when they really what zero, but -

A string of 8 resistors in series can give you 9 voltages, including zero (and including 5V which you don't want).   They can all be the same value for equal-voltage steps, except for the 1st "top" resistor that gives you 3.3V.

450nick

Thanks guys, the reason I'm using analogue is that I'm building a test circuit for a gear selector for my car. I dont have the sensor with me right now but it detects reverse, neutral then 6 forward gears and apparently produces voltages between 0 and 5 volts.

I'm building a little simulator to develop my display unit so I'm looking to make something that performs the same way but that I can adjust the voltage limit settings when I plug in the real unit.

So just looking for some reasonable resistance values to give me some nicely spaced figures to feed my voltage divider and then develop my display code with the rest of the dash unit I'm making. So what should I go for do you reckon?

450nick

I hate to see people using analog when they really what zero, but -

A string of 8 resistors in series can give you 9 voltages, including zero (and including 5V which you don't want).   They can all be the same value for equal-voltage steps, except for the 1st "top" resistor that gives you 3.3V.
Thanks Doug, what sort of size would you recommend? I'm wondering what a decent size step would be to give a solid reading on the arduino? Also, if I'm running it through a 10k 20k voltage divider, will this affect the choice at all?

Thank you for your help!

Paul__B

If you divide the input voltage range of the ADC into 8 equal steps (using equal resistors, say 2k2 each), then this will give an extremely "solid" reading to the ADC.  32 or 64 steps would be just as practical.


Go Up