Pages: [1]   Go Down
Author Topic: Newbie thinking about using ARDUINO: Need 5 rotary encoders - possible?  (Read 1653 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
I'm totally new to Arduino, but quite interestet und have read A LOT. Now I'm testing a software based version of Arduino before starting the real thing. But before to do so I have a general question. For a later bigger project I need to read the input from 5 rotary encoders. I tried a test with 1encoder connected directly to the Arduino board - worked, ok. But 5? Can I use a multiplexer like the 4051? I read about problems with bouncing and interupts?

The whole project will look like this:
5 rotory encoder will set the values of 5 digital potiometers. The movement of the encoders should be sent via MIDI and recorded by a external Midi Sequencer (logic pro). Aditionally the values (0-99 or 0-127) of each encoder (or the digital pot values, that doesn't matters) should be displayed on a serial oled (128*64). If the movement is recorded by the sequencer and the sequncer plays back, the recorded values should be sent to the Arduino via MIDI and set the digital potentiometer values and at the same time the values should be displayed on the oled.
OK - a big project, I know.
Therefore I start with single task and question:
Again, is it possible to "read" the rotary encoders, so that enough pins of the Arduino stay free for the rest of my project? It is not necessary to get every step of the encoder. Movement will be slower.

I hope it is not to confusing. My English should be better - sorry.

Thanks in advance!
Logged

Brunsbüttel, SH, F.Rep.GERM
Offline Offline
God Member
*****
Karma: 4
Posts: 596
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

1.
if u use one 4051 u need 4 arduino pins to get 8 input pins...
if u use two 4051 and an inverter u need 5 arduino pins to get 16 input pins...

2.
what kind of rotary encoder do u use?
how many output pins do they have?
if they had 1 analog output pin (like a potentiometer) u could connect 6 of them to an arduino uno:
http://arduino.cc/en/Main/Hardware
Logged

-Arne

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1.
if u use one 4051 u need 4 arduino pins to get 8 input pins...
if u use two 4051 and an inverter u need 5 arduino pins to get 16 input pins...

2.
what kind of rotary encoder do u use?
how many output pins do they have?
if they had 1 analog output pin (like a potentiometer) u could connect 6 of them to an arduino uno:
http://arduino.cc/en/Main/Hardware

Hi Arne,
thank you for your reply.

to 1) If thought of this solution: http://www.google.de/imgres?imgurl=http://tomekness.files.wordpress.com/2007/05/4051_examples_72dpi.jpg&imgrefurl=http://www.arduino.cc/playground/learning/4051&h=363&w=567&sz=86&tbnid=O72s5y68CcOxJM:&tbnh=90&tbnw=141&prev=/search%3Fq%3Darduino%2Bmultiplexer%2B4051%26tbm%3Disch%26tbo%3Du&zoom=1&q=arduino+multiplexer+4051&usg=__58W3-nFakpfAou3N2GGVLAU49xQ=&docid=CbdPBN3I2ylBUM&hl=de&sa=X&ei=KNtqUNnGOsXHswbp-YGICA&ved=0CD0Q9QEwAg&dur=750

to 2) It up to the solution that would work. Shouldn't be too expensive (< 5,- Eur). I found the ready built Mathew Rotary Encoders with LED Ring and some examples on Youtube, using two Arduinos.

So here comes the point, if is too expensive or in my opinion too "difficult to realize" I will stop going any further.

cheers!
Logged

Brunsbüttel, SH, F.Rep.GERM
Offline Offline
God Member
*****
Karma: 4
Posts: 596
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

here
http://arduino.cc/playground/Main/RotaryEncoders
they say that one rotary encoder costs at least 2EUR...

do u really need to b able to turn the wheel infinitely in the same direction?
or would a simple potentiometer suffice (no 360°... and u need to turn it in the other direction to get where u came from...)?
Logged

-Arne

Norfolk UK
Offline Offline
Faraday Member
**
Karma: 67
Posts: 2512
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I wonder if using the simple 3 pin encoders https://www.sparkfun.com/products/9117 you could connect all the A & B pins in parallel and then drive/sink each C pin to a arduino pin instead of 5V or Gnd. You could then poll each encoder by pulling relevant C pin high/low. This would only need 7 pins for 5x encoders instead of the normal 10 pins. Probably not worth the effort for the sake of three pins  smiley-red
Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

Nice, France
Offline Offline
Full Member
***
Karma: 11
Posts: 237
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

do u really need to b able to turn the wheel infinitely in the same direction?
or would a simple potentiometer suffice (no 360°... and u need to turn it in the other direction to get where u came from...)?

That would not suffice, because

If the movement is recorded by the sequencer and the sequncer plays back, the recorded values should be sent to the Arduino via MIDI and set the digital potentiometer values and at the same time the values should be displayed on the oled.

So endless encoders seem to be the correct choice here.
Logged

Brunsbüttel, SH, F.Rep.GERM
Offline Offline
God Member
*****
Karma: 4
Posts: 596
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

do u really need to b able to turn the wheel infinitely in the same direction?
or would a simple potentiometer suffice (no 360°... and u need to turn it in the other direction to get where u came from...)?

That would not suffice, because

If the movement is recorded by the sequencer and the sequncer plays back, the recorded values should be sent to the Arduino via MIDI and set the digital potentiometer values and at the same time the values should be displayed on the oled.

So endless encoders seem to be the correct choice here.

oh ok... ic... it is necessary to set the value independent from the physical knob...

these seem to b a little less expensive:
http://www.digikey.com/product-search/en?x=0&y=0&lang=en&site=us&KeyWords=102-1785-ND
and it seems like u just need 10 digital pins, which can b handled by any arduino...
that OLED thing needs no more than 3 pins... right?
Logged

-Arne

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26951
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Take a look at LS7184
http://www.omnipro.net/lsi-csi/LS7184
Connect rotary encoder to it, chip outputs pulses and a direction line.
Bring the pulses in as PCINTs so you know a knob was turned and read its direction line.
Use 10 lines.
Or, use 5 lines for pulses, and 3 more to select 1 of 8 inputs on a mux and then 1 pin more for the actual signal - heck, just go with the 10 lines.
I've done 4 that way, adding a 5th would be straightforward.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26951
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

OEM for the LS7184
http://www.lsicsi.com/encoders.htm

another source
http://usdigital.com/products/interfaces/ics/LFLS7184
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6613
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You can multiplex rotary encoders very easily using diodes (I'm looking at a unit with 3 muiltiplexed rotary encoders as I write this):

- connect the common terminals of the encoders to Arduino output pins (1 output pin each, so 5 pins)
- connect the left encoder terminals to a single input pin, each through its own 1N4148 or similar diode (cathode to encoder, anode to input)
- ditto for the right encoder terminals, using a different input pin
- ditto for the pushbutton terminals, if you are using encoders with built-in pushbuttons (connect the other side of the pushbutton to the common terminal).

You can share the 5 output pins with other multiplexed devices such as 7-segment LEDs. You pull one of the output pins low at a time, then read the 2 input pins to determine the state of the selected encoder. Enable the pullup resistors on the input pins.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1]   Go Up
Jump to: