Trying to combine a controller setup with a rotary encoder - what's the best setup?

Hello guys!

So yesterday I tried out this prototype: https://ibb.co/VpLw573 and it worked perfectly fine.

Now I want to build a controller like this: Overview | DIY Bluetooth Gamepad | Adafruit Learning System except that I want to add a rotary encoder (shouldn't be soldered to the breadboard) and use a arduino pro micro.

I came up with the following solution:

  1. Wire the buttons to a perma-proto half-sized breaboard like in the project mentioned above (wiring can be seen on the link posted above) and I will use them as INPUT_PULLUP input.

  2. I will add the rotary encoder not to the half-sized breadboard but connect it simply with the arduino.

Now I am not sure how to connect the voltage to the whole setup. The problem is the buttons and the rotary encoder need to separated since the buttons will face upwards and the rotary encoder sidewards, plus there is not much space within the controller.

How can I solve this problem?

And is my solution alright or is another approach better?

Hi @ph5

I'm not sure i fully understand your problem / question.

Some notes:

  • The side not attached to the Arduino on every button, will be attached to ground if you are using "INPUT_PULLUP".

  • The rotary encoder has a builtin tactile switch.

  • The rotary encoder uses 2 digital pins, unless you decide to use the builtin tactile switch, in which case it will need 3 digital pins.

Here is a helpful site on rotary encoders:

Also, could you post your problem / question a little clearer so it can be answered more easily?

That's not really correct. I think it's more understandable if you take a look at the project.

All I want to do is add an rotary encoder to it and this rotary encoder will be on the side of the controller like this:

But I am not sure how to connect this together, since I need voltage for both components (by both I mean the controller buttons on the half-sized breadboard and the rotary encoder).

Find the 5V and GND pins and attach breadboard jumper wires (Dupont) from them to the rotary encoder.

I don't want to use jumper wires. The project should be soldered.

I'm still not sure I fully understand what you are asking. Just solder any wire then from 5v and gnd to the 5v and gnd pins of the rotary encoder.

You only need a sire for each switch, a wire for each the A and B terminals of the rotary encoder and a wire that connects to ground. No 5V wire needed. One terminal of each switch and the A and B terminals of the rotary encoder connect to a processor pin with its pinMode set to INPUT_PULLUP. The other switch terminals and the rotary encoder common connect to ground.

The rotary encoder doesn't need 5v to work?

How is that possible? And where do I connect the power to then? I mean the rotary encoder needs some sort of power doesn't it?

The ones that you see that have a 5V terminal have pullup resistors on the board. Those are not needed if you use the processor's internal pullup resistors so 5V is not necessary.

1 Like

Oh. Thank you for clarifying @groundFungus. I did not know that.

Yes, but the "power" comes through the internal pullups in the Arduino processor chip so no 5V needed to the encoder or switches.

Just to clarify: I just set the input of the switch of the rotary encoder to INPUT_PULLUP and then it works without the voltage input?

It's basically like this: multiwingspan

But I will simply just not connect my other pins, right?

There are 5 terminals on the rotary encoder.

They are A, B, switch, encoder common and switch common.

Wire A to an external interrupt, B to an external interrupt or any digital pin, and switch to any digital pin. Wire ground to the 2 common pins.
Optionally put a 0.1uf cap across pin A to ground, pin B to ground and switch to ground to help with noise rejection.

Yes, but I would connect at least one of the rotary encoder pins to an external interrupt and use the Encoder library to read the encoder. See the Encoder library docs to see why the external interrupt.

Oh okay I didn't know that yet.

Thank you so much for helping and taking your time to answer, that helps a lot!

Other post/duplicate DELETED
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Continued cross posting could result in a time out from the forum.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.

It will help you get the best out of the forum in the future.

Sorry I was confused by the other user.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.