Help finding a rotary encoder with interupt capabilities

  • Thread starter Thread starter shushi_boi
  • Start date Start date
  • Tags Tags
    Encoder Rotary
AI Thread Summary
The discussion focuses on selecting a rotary encoder with interrupt capabilities for a project involving a Teensy 2.0++ and Raspberry Pi 2. It emphasizes the need for encoders that also function as push buttons to facilitate user interaction, particularly for controlling cursor movement. Participants clarify the wiring of encoder pins, suggesting that two pins should be used for interrupts while the switch function can be wired either as an interrupt or polled. There is also confusion regarding the specific pin connections and the use of resistors and capacitors for proper functionality. Overall, the conversation highlights the technical details necessary for integrating rotary encoders into the project effectively.
shushi_boi
Messages
44
Reaction score
0
In this project,
https://bitbucket.org/selectnone/ra...ls.ino?at=master&fileviewer=file-view-default

14 // Change these pin numbers to the pins connected to your encoder.
15 // Best Performance: both pins have interrupt capability1Q
16 // Good Performance: only the first pin has interrupt capability
17 // Low Performance: neither pin has interrupt capability
18 Encoder knobEnc(0, 1);
19 Encoder scrollEnc(2, 3);
20 int encoderPins[] = {2,3,4,5,};
21 // (avoid using pins with LEDs attached)​

It states that a rotary encoder with "interrupt capabilities" is recommended for this project (which connects to the Teensy 2.0++ pins, which the Teensy connects to the Raspberry Pi 2 via usb)

pinout4b.png


I'm guessing that interrupt capabilities are knobs that also act like pushbuttons, in the same way that car radio volume control knobs are (which you can push like buttons) "...the knob also acts as a pushbutton which sends an interrupt to your target board\'s MCU."

in

https://bitbucket.org/selectnone/raspipboy/wiki/Controls.md

He states that the rotary encoder's knob should also act like a push button, so that it's a mouse that alternates between diagnal and horizontal movements.

•Move Map Cursor
○Mouse Move
(Knob on back of hand: rotational encoder with switch - alternates between X/Y movement when pushed down)​
 
Engineering news on Phys.org
billy_joule said:
An interrupt occurs within the software.

https://en.m.wikipedia.org/wiki/Interrupt
They can be triggered by many different ways, including a simple switch.
You want a rotary encoder with a push button, something like this;
https://www.adafruit.com/product/377

I appreciate your insightful response and for your clarification, thank you Billy! I've got one more question, since this switch encoder has 6 pins and the Teensy needs to connect to it through these 6 pins (0, 1, 2, 3, 4, 5),

is

Encoder knobEnc(0, 1);​

just the pins for the knob when the switch is not pressed on the encoder,

Encoder scrollEnc(2, 3);​

pins where the knob is pressed down, and

int encoderPins[] = {2,3,4,5,};​

are the the remaining pins which would be used for the interrupt features?
 
One side of the switch and the common pin of the encoder are usually connected to ground. Also one of the pins is clipped short and has no documented function. If I had to guess it is connected to the encoder common. It might also not be connected at all. It is removed during manufacture to add polarization to the part. Just ignore it.

So now you have three signals. At minimum you will want an interrupt on the two encoder signals. The switch function would be wired up however is most convenient. Either interrupt or polled should be adequate.

BoB
 
  • Like
Likes shushi_boi
rbelli1 said:
One side of the switch and the common pin of the encoder are usually connected to ground. Also one of the pins is clipped short and has no documented function. If I had to guess it is connected to the encoder common. It might also not be connected at all. It is removed during manufacture to add polarization to the part. Just ignore it.

So now you have three signals. At minimum you will want an interrupt on the two encoder signals. The switch function would be wired up however is most convenient. Either interrupt or polled should be adequate.

BoB

I appreciate your Help rbelli1!

After building this circuit based off of Neal Corbett's [the guy who created the Raspberry Pip Boy project alongside Grieve] posts and videos
http://blog.obliviongizmo.com/



TZwIrHZ.jpg


j7SCpPF.png


I've got confused with pins 4 and 5 found here

UMbfynM.png

*Highlighted in red are the pins and circuit that I don't understand, which are 4, 5 (or rotary encoder) and how to wire the voltage divider battery pins 44, & 38

My personal setup is a little different from his and I won't include the temperature sensor nor the radiation-gauge running off of a stepper motor (I will add a real one, similar to some of the ideas from this NASA Pip Boy xD :DD)
https://2014.spaceappschallenge.org/project/pip-boy-3000/

Pictures of my personal setup are down bellow, but they are subject to change.

So primarily, how would I wire pins 4 and 5 to the rotary encoders? Are they pins or are they just numbers? :confused:

If possible too, how do I wire together the voltage divider circuit?

Thank you for your guy's time and I hope that these schematics may help others too if they are interested in this project! :biggrin:

gylUaeL.jpg

*my own set-up which is not the traditional Pip Boy 3000, it's my own modern and functional version, I plan on adding wearable technology in the glove and inside the Pip Boy to add more information about the environment, your own vitals and tools to help you out

j8Fnw3n.jpg

*An old visual representation of how I plan to put together my own set-up
 
shushi_boi said:
So primarily, how would I wire pins 4 and 5 to the rotary encoders? Are they pins or are they just numbers?

The pin numbers are all port designations per the CPU datasheet. D4 and D5 are port D bits 4 and 5. To connect them to the encoder you put a resistor of the appropriate value from each pin to VCC and usually a capacitor from the pin to ground. The resistor by convention is 10K and you need to select a capacitor to make the rise time slow enough so as to filter out switch bounce but also fast enough to allow the encoder to work fast enough. Connect these inputs to the two encoder output pins and the common to ground.

The battery voltage divider appears to be measuring an approximation of VCC through a port pin. If you are using some other battery power source you will want to connect to that voltage. Use higher values of resistor to minimize current draw.BoB
 
  • Like
Likes shushi_boi
Thank you rbelli1 for your help again!

rbelli1 said:
To connect them to the encoder you put a resistor of the appropriate value from each pin to VCC and usually a capacitor from the pin to ground... Connect these inputs to the two encoder output pins and the common to ground.

So to make sure I understand you correctly, is this correct the way I have it wired up, or when you say "encoder output pins" do you mean all the pins except the common ground pins?

7QCHdzc.png

*the diodes I used have a voltage drop of 0.6 volts and are called 1N4001*

And for the capacitor ratings, which one would you suggest I use? In terms of voltage, frequency etc.?

Thank you again for your help valuable help !
 
I apologize for the bad drawing, I fixed it a little better.
12CZ6hM.png


I'm not sure if just the B is the output pin of both encoders or its both A and B.
 
Here, I drew out other ways I think it could be wired.

w6SgUxD.png

(I feel like its most likely this one, because Pin D4 would correspond to both outputs (A & B) Pins of one encoder, and Pin D5 the other output of the other encoder)

atOMbhJ.png

(The thought behind this one is that D4 focuses on the output of one of the Pins from both encoders whereas D5 focuses on one of the output pins from both of the other encoders)
Pip%20Boy%20Preview.png

(Where I connect D4 and D5 to all of the output pins)

I apologize for all of the confusion, I still consider myself new to electronics :P
 

Similar threads

Replies
5
Views
4K
Back
Top