# Sparkfun RGB rotary encoder (with breakout)

**URL:** <https://forums.pimoroni.com/t/sparkfun-rgb-rotary-encoder-with-breakout/22762>\
**Category:** Support\
**Created:** [August 20, 2023, 8:58am UTC](https://forums.pimoroni.com/t/sparkfun-rgb-rotary-encoder-with-breakout/22762 "2023-08-20T08:58:45Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![GomiSensei](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@GomiSensei](https://forums.pimoroni.com/u/GomiSensei)\
**Post date:** [August 20, 2023, 8:58am UTC](https://forums.pimoroni.com/t/sparkfun-rgb-rotary-encoder-with-breakout/22762/1 "2023-08-20T08:58:45Z")

</div>

HAve this hooked up to a pi4.

so what values would i plug into this for pullup/activelow for the switch on a pi…  
I have

`dtoverlay=gpio-key,gpio=6,keycode=38,gpio_pull=down,active_low=0,label="rotary-switch"`

but i get nothing from ~~evtest~~ , tho it does show up as

`/dev/input/event0: button@6`

I have the rotary encoder part working, but can’t get the button to work, and am confused probably due to the common anode setup…

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [August 21, 2023, 7:30am UTC](https://forums.pimoroni.com/t/sparkfun-rgb-rotary-encoder-with-breakout/22762/2 "2023-08-21T07:30:42Z")

</div>

What do you want the button to do when pressed?  
And what guide are you following?  
I think it should be `gpio_pull=up`, that would make it a high by default.  
It would then go low “when” the button is pressed.

---

<div class="post-metadata">

**Author:** ![GomiSensei](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@GomiSensei](https://forums.pimoroni.com/u/GomiSensei)\
**Post date:** [August 21, 2023, 10:49pm UTC](https://forums.pimoroni.com/t/sparkfun-rgb-rotary-encoder-with-breakout/22762/3 "2023-08-21T22:49:34Z")

</div>

the sparkfun encoder has a common anode rather than cathode, so the switch supposedly is low while released, and high when pressed (which is the opposite of what i’d wish for, but no rgb encoders have a switch to ground), but I can’t get it to register thru gpio6. Right now i just need evtest to see when i press/release the button. I’m going to try switch pins, and maybe using a multimeter to troubleshoot, but i was hoping someone here would be familiar with the issue before i do.

I got the sparkfun cuz the io expander i2c one was a huge hassle to get working for my arcade spinner button, but the

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [August 22, 2023, 7:31am UTC](https://forums.pimoroni.com/t/sparkfun-rgb-rotary-encoder-with-breakout/22762/4 "2023-08-22T07:31:21Z")

</div>

Have a look at this, might help.  
[Rotary\_Encoder\_Breakout-Illuminated/Firmware/RGB\_Rotary\_Encoder/RGB\_Rotary\_Encoder.ino at main · sparkfun/Rotary\_Encoder\_Breakout-Illuminated (github.com)](https://github.com/sparkfun/Rotary_Encoder_Breakout-Illuminated/blob/main/Firmware/RGB_Rotary_Encoder/RGB_Rotary_Encoder.ino)

// Note that because this is a common anode device,  
// the pushbutton requires an external 1K-10K pullDOWN resistor  
// to operate.

---

<div class="post-metadata">

**Author:** ![GomiSensei](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@GomiSensei](https://forums.pimoroni.com/u/GomiSensei)\
**Post date:** [August 24, 2023, 11:21pm UTC](https://forums.pimoroni.com/t/sparkfun-rgb-rotary-encoder-with-breakout/22762/5 "2023-08-24T23:21:30Z")

</div>

yeah, that’s what i was afraid of, seems like a stupid design decision when you could just connect the button to the ground on the rotary encoder. Thanks for the search, i swear i’d been to that repository before.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [August 25, 2023, 7:25am UTC](https://forums.pimoroni.com/t/sparkfun-rgb-rotary-encoder-with-breakout/22762/6 "2023-08-25T07:25:21Z")

</div>

> [@GomiSensei](#):
>
> seems like a stupid design decision when you could just connect the button to the ground on the rotary encoder.

Exactly what I was thinking.

---

<div class="post-metadata">

**Author:** ![GomiSensei](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@GomiSensei](https://forums.pimoroni.com/u/GomiSensei)\
**Post date:** [August 26, 2023, 10:07pm UTC](https://forums.pimoroni.com/t/sparkfun-rgb-rotary-encoder-with-breakout/22762/7 "2023-08-26T22:07:32Z")

</div>

I attached an external 10K pulldown resistor, didn’t work. Should i get a continuity reading across + and sw pins when unpowered? I would think i would when the switch was closed, but I don’t… faulty unit (again) maybe…

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [August 27, 2023, 9:26am UTC](https://forums.pimoroni.com/t/sparkfun-rgb-rotary-encoder-with-breakout/22762/8 "2023-08-27T09:26:52Z")

</div>

Yeah, you should get continuity when its pressed. Provided you are measuring the correct pins. I’m not saying you have the wrong pins. Just that it would be easy to mix them up.

---

<div class="post-metadata">

**Author:** ![GomiSensei](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@GomiSensei](https://forums.pimoroni.com/u/GomiSensei)\
**Post date:** [August 27, 2023, 4:52pm UTC](https://forums.pimoroni.com/t/sparkfun-rgb-rotary-encoder-with-breakout/22762/9 "2023-08-27T16:52:52Z")

</div>

nah, it’s middle and end on the 5 in a row, plus i have the breakout, so they’re labeled, and definitely don’t get continuity. I connected it directly without pulldown and didn’t get any float… I have such bad luck with encoders, the i2c one i got was defective when shipped as well.

At least i learned some stuff…

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [August 27, 2023, 5:43pm UTC](https://forums.pimoroni.com/t/sparkfun-rgb-rotary-encoder-with-breakout/22762/10 "2023-08-27T17:43:06Z")

</div>

I have an i2c one, that glitches. A replacement is on the way. I’ll do dome thorough testing on this one **before** I solder it in place.
