Need Advice on how to use the switch on illuminated Rotary Encoder

Hi, This my first topic post on this forum and didn't know where to ask this particular question.

I recently obtained a Illuminated Rotary Encoder: http://tenettech.com/product.php?id_product=1559

It has 4 pins which acts as "GND" "GREEN" "RED" "Switch"

I have Pin 1 connected to GND, 2 and 3 to two digital output from Arduino. ( at any one time either of the two Digital output is always on ).

Now I want to use the Pin 4 to drive a Digital Input as a switch for some other function.

I am confused as to what wiring should i do. Can I use the Current coming from the LED on pin 2 and 3 to drive the Digital Input that is driven by Pin 4? or is there a better way of doing that? Or is it possible to do so?

Here is the wiring diagram i am thinking of:

So, is the above setup possible?

Regards,
Sapam

Unfortunately, the tenettech web site will not allow access from my country (UK). Can you post a link to a datasheet that is not on that site?

From the diagram you gave, what I think you need to do is to connect pin 4 of the encoder to an Arduino input pin, and enable the internal pullup resistor on that input pin. See http://arduino.cc/en/Tutorial/DigitalPins if you don't know how to do that.

Here are the data sheet and layout diagram for the Rotary encoder:

DataSheet: Link
Layout: Link

OK, pins A-C-B are standard quadrature encoder contacts, and pins 1 to 4 are as you showed them before. The solution I mentioned in my previous email will work, i.e. encoder pin 4 to Arduino input and internal or external pullup resistor to +5v.

Thats exactly what I needed.. Pull up register should do the needful for me. I think i'll use Arduino's internal pull-up register.

Thanks for the info. This is my first experience with Arduino and digital circuit.

Regards,
Sapam

I've a couple of those illuminated rotary encoders but I haven't found any translucent knobs to go with them, alas. Neat input device.

In my project I have about 4 switches driving 4 pins + 2 for the rotary encoder's A/B, on the arduino uno, including the switch from the rotary encoder also. So, I have a total of 6 Inputs to various pins on the board.

Today morning switches connected to pin 0 and 1 was not functioning as advertized the pins were reading HIGH always no matter I connect the switch or not.
Two, things came into picture after looking around here and there.

  1. Pin 0 and 1, don't work as Digital I/O, if Serial Communication is used.
  2. Pin 0 and 1 don't work as other Input Pin. Cannot use Pull-Down resister technique to read input from this pin.

I finally tried using Pull-Up Resistor technique and it seems to work.

Now, I have a question here. as you can see that I have 6 Inputs on the board. Which method of driving the input is better and more efficient.

  1. Pull-Up Register for all switches including Rotary encoder A/B
  2. Pull-Down Register except Pin 0 and Pin 1.

I have a 16x2 LCD panel taking 6 pins on the Arduino Digital IO, Will it be okay if I move RS and Enable of the LCD from pin 11,12 to pin 1,2 so that I can move my switch inputs to 11 and 12.

Regards,
Sapam

Reading is helping a lot.. I actually ran out of digital pins so I was using pin 0 and 1 for digital input. Came to know that I can use Analog Pins A0-A5 as Digital Pin D14-D19
New it seems i can let go the Pin 0 and Pin 1 issue altogether and also have Serial Output for debugging.

One last question i still have for now is:
Which is best suited for Digital Input Connection like switches?

  1. Internal Pull-Up Register
  2. External Pull-Down Register

Regards,
Sapam

Internal pullup needs fewer component, so in that sense it is best. Technically, it makes no difference whether you use an internal pullup, external pullup or external pulldown; except that the internal pullup has a fixed value (around 20K ohms) and occasionally you need to use a different value, for example if the input is coming from a phototransistor.

Pins 0 and 1 are internally connected to the USB to serial converter chip via 1K resistors. Therefore, any input source driving pin 0 has to be able to overcome the effect of a 1K resistor to ground, and the effect of a 1K resistor to +5v (at different times). That is why normal pullups/pulldowns don't work on this pin unless you use a low value, e.g. 220 ohms.

@dc42, thanks a lot for the insight and information on the Pin 0 and Pin 1. Now, things are making a lot more sense to me.
I was finally able to put up my Arduino based Intervalometer project. Still rough but it was fun working on it.