Help finding a rotary encoder with interupt capabilities

In summary, the author explains how to connect a rotary encoder to pins 4 and 5 on a Teensy 2.0++, and how to wire together a voltage divider circuit.
  • #1
shushi_boi
45
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
  • #3
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?
 
  • #4
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
  • #5
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
 
  • #6
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
  • #7
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 !
 
  • #8
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.
 
  • #9
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
 

FAQ: Help finding a rotary encoder with interupt capabilities

What is a rotary encoder with interupt capabilities?

A rotary encoder is an electromechanical device that converts the angular position or motion of a shaft into an analog or digital signal. Interupt capabilities refer to the ability of the encoder to send an immediate signal to the microcontroller or processor when there is a change in the encoder's position.

Why is it important to have interupt capabilities in a rotary encoder?

Interupt capabilities allow for faster and more accurate detection of changes in the encoder's position, as compared to continuously polling the encoder. This is especially useful in applications where real-time responses are required.

How do I choose the right rotary encoder with interupt capabilities for my project?

There are several factors to consider when choosing a rotary encoder with interupt capabilities, including resolution, accuracy, durability, and compatibility with your microcontroller or processor. It is important to research and compare different models to find the one that best fits your project's requirements.

Can a rotary encoder with interupt capabilities be used in both clockwise and counterclockwise rotations?

Yes, most rotary encoders with interupt capabilities can detect changes in both clockwise and counterclockwise rotations. However, it is important to check the specifications of the encoder to ensure that it meets your project's specific needs.

Are there any limitations to using a rotary encoder with interupt capabilities?

One limitation of using a rotary encoder with interupt capabilities is that it may consume more power compared to a standard encoder without interupt capabilities. Additionally, the speed of rotation may also affect the accuracy of the interupt signal. It is important to carefully consider these factors when choosing an encoder for your project.

Similar threads

Replies
5
Views
4K
Back
Top