EDIT*** I have a "STEC11B03 ALPS" rotary encoder and I want a python script to output the same signal to the circuit as the rotary encoder does when turning. I want the script to do the same thing as the rotary encoder by increasing or decreasing a value.

big noob here. I'm doing a project with my RPI where the goal is to control some buttons and dials from Tkinter. I need some help to control some rotary encoders. I want to "turn" the dials without touching the dials.

(*Slightly irrelevant information) I have made a code made of 8 momentary buttons that activates 8 different relays in Tkinter. The relays NC and COM are connected to the two terminals of the buttons and when the relay is activated the circuit is connected by "by passing" the button which works great.

(Relevant information) Now I am trying to control the dials in Tkinter which are made of rotary encoders. I am wondering if i should just let them be and use my hands and turn them like an animal but it would be cool if I could press a button on a screen and the rotary encoder gets "turned". Another similar project would be controlling the volume dial that is connected directly to a speaker through an RPI, to set the volume through a Tkinter interface instead of turning the dial that is fitted onto the speaker.

I have thought about fitting a servo motor to the dial and turning it that way but i wonder if there's a more elegant way to do it without any moving parts.

Does anyone now of someone who made a similar project or if it is possible to control a rotary encoder through a Tkinter interface at all?

I understand if it's alot to ask but figured I might as well. All the best.

Ps. I can post my code that is made of the momentary buttons but I don't know how relevant it is to this. Let me know if it would help to see the current code.

Pss. articel number of the rotary encoder "STEC11B03 ALPS"

  • how do you know that the volume control hardware is a rotary encoder? ... anyway, you are asking at a totally wrong place ... this site is for Raspberry Pi related problems, not for general electronics design problems
    – jsotola
    Oct 21, 2021 at 19:38
  • Sorry, do you know a place where I could ask this kind of questions? Oct 21, 2021 at 20:06
  • please add pictures of the inside of the device that you are trying to control ... specifically hoth sides of the circuit board that holds the switches and the volume control
    – jsotola
    Oct 21, 2021 at 20:24
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Oct 21, 2021 at 20:33

1 Answer 1


Off topic but it as quick to answer as not.

The answer is no, you can not use software to set the position of a rotary encoder. A rotary encoder is purely an input device.

  • Did you mean an "output" device?
    – Seamus
    Oct 24, 2021 at 15:34
  • I suppose there is ambiguity. A switch, a button, a rotary encoder.
    – joan
    Oct 24, 2021 at 15:47
  • Yeah, ambiguity there is, but as I understand the context of your answer, you're making the point that the encoder accepts no (control) inputs.
    – Seamus
    Oct 24, 2021 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.