Initially, I will connect three resistors to four rotary encoder switch in serial way. So it requires just one pin to programming.
But how do I give the correct watt and voltage to the rotary encoder? The pin can receive up to 40 milliamper.
I see that I missed some informations.
The pin on arduino receives up to 40 mA. This Arduino MEGA2560 operates at 5 Volt. I shall use 1/4 Watt resistor or more if necessary.
In final edition, it shall has 39 resistors in serial connection.
How much Ohm in each resistor does it need ?
Qwseyvnd:
I see that I missed some informations.
The pin on arduino receives up to 40 mA. This Arduino MEGA2560 operates at 5 Volt. I shall use 1/4 Watt resistor or more if necessary.
In final edition, it shall has 39 resistors in serial connection.
How much Ohm in each resistor does it need ?
Still confusing. An arduino digital or analog pin is in in input mode it 'receives' (or requires, or demands, or draws) almost no current, they are very high impedance inputs.
When an arduino digital pin is in output pin mode one can draw a maximum current from the pin at 40ma, and if more current is attempted to be drawn from the output pin, pin damage can result.
If I understand correctly, you want to discriminate up to 39 values in a chain resistor. Can you present a diagram of how you intend to connect these via a switch system to the single arduino input. Also where is the calculation that you want verified. Might I suggest you google R/2R resistor chain.
How many inputs to the Mega do you want?
There are 16 analog inputs - you can have 16 of those chips with 2 buttons each.
After that, you need to multiplex the inputs.
You can use an analog multiplexer, or analog switch, such as 74HC4051
Or you can use an ADC converter with 8 inputs, such as MCP3208
It seems that you do not understood the picture that I have attached. If you see, I will just use one rotary encoder each time when I will turn. Here's the explanation: This is a part of navigation panel in a old airplane that I will make a copy home cockpit. The airplane is made in between 1963 and 1994, and a few after 1994.
I don't think we understand what YOU mean by a "rotary encoder switch".
Most rotary encoder switches have quadrature A and B outputs.
Post a link to the data sheet or to the product page describing the exact switch you plan to use.
Why CAN'T I use the serial connector from rotary encoder #1 to #20 ? It is simpler and easier to understanding.
Is it possible with external power supply ? Or whatever ?