Multiple rotary encoders sharing one common ground pin?

Support for Arduino in combination with Air Manager and Air Player

Moderators: russ, Ralph

Post Reply
Message
Author
Irimi-Ai
Posts: 12
Joined: Sun Sep 13, 2020 12:28 pm

Multiple rotary encoders sharing one common ground pin?

#1 Post by Irimi-Ai »

Another noob question: Can multiple rotary encoders be wired to share the same ground pin? Or, does each rotary encoder require a dedicated unique ground pin?

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Multiple rotary encoders sharing one common ground pin?

#2 Post by Ralph »

Yes that's no problem. Eventually they'll end up with the same ground anyway.

tokirby
Posts: 10
Joined: Sat Jan 23, 2021 3:18 am

Re: Multiple rotary encoders sharing one common ground pin?

#3 Post by tokirby »

Learned today (I think, still new at this) that although 2 rotary encoders can share the same ground, they need separate 5V inputs to avoid errors. The switch function works sharing 5V but the rotary did not. Once I changed to separate 5V inputs it worked fine.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Multiple rotary encoders sharing one common ground pin?

#4 Post by jph »

tokirby wrote: Sun Feb 07, 2021 10:33 pm Learned today (I think, still new at this) that although 2 rotary encoders can share the same ground, they need separate 5V inputs to avoid errors. The switch function works sharing 5V but the rotary did not. Once I changed to separate 5V inputs it worked fine.
Hi
There should be no reason at all why 2 encoders cannot use the same 5V rail. The encoders (the A and B or CLK and DT outputs) must obviously have the pullup resistors (10k is usual) to 5V. - although some Chinese boards use 4.7K often still marked as 10K, but that is of no consequence as it is still only around 1mA.
When you say the same 5V 'input' do you mean a single 5v supply to one encoder and then daisy chain this to the next encoder for example ?
Which encoders are you using ?
Are the encoders connected to the same arduino ?.
Where are you getting you 5v from ? - from the arduino 5V pin for example ?.
If you are using individual 5v rails, where are you getting them from ?.
Also, what else do you have powered from the arduino ? (this should usually be irrelevant really due to the extremely low current the encoder uses)

Joe
Joe. CISSP, MSc.

tokirby
Posts: 10
Joined: Sat Jan 23, 2021 3:18 am

Re: Multiple rotary encoders sharing one common ground pin?

#5 Post by tokirby »

Which encoders are you using ?
- Cylewet 5Pcs KY-040 Rotary Encoder Module with 15×16.5 mm with Knob Cap for Arduino (Pack of 5) CYT1062
Are the encoders connected to the same arduino ?.
Yes
Where are you getting you 5v from ? - from the arduino 5V pin for example ?.
All are daisy chained to the 5V pin on the Arduino board
Nothing else powered by the arduino.

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Multiple rotary encoders sharing one common ground pin?

#6 Post by Sling »

tokirby wrote: Fri Feb 12, 2021 9:58 pm All are daisy chained to the 5V pin on the Arduino board.
Nothing else powered by the arduino.
You previously said a daisy chained 5v connection wouldn’t work. So now I’m a little confused with how you have it connected. Not that it should matter either way. The only thing that may have an effect when daisy chaining is the length and quality of the wire you are using for your power and ground. You could overcome this if it were the issue by using more than one wire for each but just for pull-up resistors I doubt this is the issue. Long and poorly routed wire runs is also not great when it comes to signal noise.

I would check the quality of your connections first.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Multiple rotary encoders sharing one common ground pin?

#7 Post by jph »

I agree with Tony.
Can you tell us how you are connecting the KY40 units ?

Often, the SW pin does not have a pull up on these boards - which shouldn't matter at all as the Arduino has the WPU set (weak pull ups) NOTE - FOR THE KNOBSTER - ONLY !!! - I confirmed this with the guys at SI yesterday.

But note --------------

BUT NOT for the HW_Input_Add. !!!! - so you need to have external pull ups !


The A/B pins on your - the KY40 - board almost always do have pull up resistors to 5V - if the 5V should be present from the Arduino to the ' + ' pin on the KY40 board. - again, this should never be an issue.
The SW pin is often not pulled up on the KY40. - so it needs an external pull up resistor - - value not critical - from SW pin to '+' on the encoder board. anywhere from 2.2K to 10K... 'ish'

Daisy chaining should not be an issue providing you absolutely daisy chain both '+' pins and 'gnd' pins.

NEVER daisy chain A/B (CLK/DT) pins. Each A/B - CLK / DT should go to separate pins on the Arduino.

Post your code please so we can actually see what you are trying to do. - and if possible - a quick diagram of your connections.
Joe
Joe. CISSP, MSc.

tokirby
Posts: 10
Joined: Sat Jan 23, 2021 3:18 am

Re: Multiple rotary encoders sharing one common ground pin?

#8 Post by tokirby »

I ended up getting it working correctly by running a separate 5V wire from each encoder to a 5V slot on the Uno. I have an expansion board piggybacked onto the Uno so I had enough 5V slots for my 4 encoders. I wired the ground wires together with a wire nut then ran that to ground on the Uno. All CLK/DT pins are wired separately. I guess there could have been a bad wire in the 5V connections but I swapped every connection I could think of to troubleshoot until I gave up and went with individual wiring which solved it. Everything works correctly now so I'm not too worried about it as I was only trying the daisy chain method to reduce wiring clutter.

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Multiple rotary encoders sharing one common ground pin?

#9 Post by Sling »

Last time i checked (it was some time ago) all digital input types have internal pullups enabled. In most cases they suffice but I know from when i had a play with the KY-040 that it likes having power to its external board mounted pullups. From memory only the encoder lines have resistors.

Post Reply