petervf
Posts: 3
Joined: Wed Nov 23, 2016 7:08 pm
Contact: Website

Control RPI with rotary encoder, lcd and/or web user gui

Wed Nov 23, 2016 9:28 pm

All,
I'd like to share with you some ideas how to control our RPIs. My rather simple code provides following features:
  • Rotary encoder class working with interrupts to be more independent from pooling timing (especially important in pygame systems)
  • Local pygame menu system controlled by rotary encoder / switch and small (and cheap :D ) LCD display. Menu can be defined by finite machine states and transitions. This allows easy logic modification without too much coding.
  • Web enabled user interface with bidirectional (html5 server side events) feature. RPI status changes are sent to the clients without necessity to reload the web page. As I cannot write android / iOS apps - this is the easiest way to get remote user interface on any computer or mobile device.

All the above features can be easily reused in your own projects. Initially I developed them to control tvheadend and oscam server, which run on RPI and stream a dvb-s2 video to my clients. I call this is a "headless" dvb-s2 streaming tuner.

If you are interested in, please check my github repositories - the starting point is here:
=> DIY for the hardware and already exiting software
=> local FSM pygame menu with rotary and lcd
=> remote web user interface

For a quick inside you can look at youtube:
=> for the complete system overview
=> for an example of the web user interface

All love screenshots so some pictures:
Image
Image


I'm happy to answer any related questions, you may have. I have to admit, that the code is "quick and dirty" :oops: however if you have any remarks or improvement ideas, let me know.

Regards
Peter

mattv
Posts: 4
Joined: Mon Sep 17, 2018 9:43 pm

Re: Control RPI with rotary encoder, lcd and/or web user gui

Sun Apr 14, 2019 9:21 pm

Hey Peter,
I love this. Great job! I am in the process of trying to figure out how to do this EXACT same thing and am looking for some help. I have a Raspberry Pi running OSMC and I am trying to find a source to learn how to code the rotary encoders I have. I want 1 of the encoders to scroll and select the menu and the other to control the volume. This project is going inside an old 1941 Zenith radio. I would really appreciate any thoughts you may have or if you might be interested in taking a stab yourself. Please let me know either way.

Thanks,
Matt

petervf
Posts: 3
Joined: Wed Nov 23, 2016 7:08 pm
Contact: Website

Re: Control RPI with rotary encoder, lcd and/or web user gui

Mon Apr 29, 2019 9:08 pm

Hi Matt,

a very old project, however still up and running!
What in particular you don't know and how I can help you?
If you are looking into just a rotary encoder, use my ready to reuse python code from here: https://github.com/petervflocke/rotaryencoder_rpi
1) prepare hardwware: https://raw.githubusercontent.com/peter ... switch.png
2) clone the code
3) wire the encoder as described
A_PIN = 17 #wiring=0 A pin on rotary
B_PIN = 27 #wiring=2 B pin on rotary
SW_PIN = 22 #wiring=3 press pin on rotary
4) run the test program RotaryTest.py from the cloned repo
when you managed this you can find out the way how to drive your OSMC

regards
P.
Regards
Peter

Return to “Other projects”