Rotary FX CTRL

Controller with 10 rotary encoders connected to internet

Similar projects worth following
Rotary FX CTRL device is a wireless controller for visual effects in real time online. It is made of ESP32 wifi module and 10 rotary encoders. Controller is connected to network and available online at a given IP address. There is a web interface for it which is a single page application with graphics and some feedback info for encoders: angle and rotation direction.


The major part of the device consists of incremental rotary encoders. They convert the angular position or motion of a shaft to output signals. Simple and powerful electro-mechanical devices may be used to control and manipulate CGI x VFX x DIMs wireless, real time and online.


When encoder shaft is rotated or button is pressed internal mechanism generates bounces for a short period of time. MC (microcontroller) should not interpret this noise as a valid signal change and must ignore it. While the valid signal should not be missed and each shaft tick is counted.

These are examples of CLK (yellow) and DT (blue) signals obtained from KY-040 encoder. 

Bounces are about 250 μs and 75 μs.

Here is another example of a signal from ALPS encoder. The bounce appears when shaft slowly rotated CCW.

Searching for the most efficient and proper way to program encoders I found beautiful working solution by buxtronix. It uses state machines to read encoder and has inherent !debounce built in. 


I started with connecting two ALPS encoders to HUZZAH32 board. It turns out this type of encoder uses half-step state table from the Rotary library. I modified the initial library code by adding few helper functions for interrupt handling procedure. Code is here.


Communication between browser and the device is established through websockets. ESP32 is set to broadcast data in JSON format every 100 μs. 


WiFi credentials can be updated directly from the device by using just 1 encoder. If login was successful creds are stored in EEPROM. Device always performs check for creds in EEPROM on boot. If creds are not there user is suggested to select AP and enter new password.


Real time collaboration between multiple users in one web application can be achieved with websocket protocol. ESP32 sends rotary encoders info with 10Hz frequency to server through websockets and server broadcasts received info through websockets to all web clients connected to it. Both esp32 and web clients and server can exchange data bidirectionally though the VFX controller doesn't need it. Also sending additional info could be time consuming so I avoid unnecessary data transmission to minimize latency.

  • 1 × Wemos TTGO ESP32 / HUZZAH32 ESP32 wifi module
  • 10 × ALPS 525C incremental quadrature rotary encoders /w switches
  • 1 × SSD1306 Display

  • Multiplex

    qubit08/28/2019 at 18:41 0 comments

    Websocket protocol allows bi-directional communication between multiple ESP32 clients (VFX controllers), multiple web browser clients (PC/ laptop/ smartphone) and NodeJs server. 

    Thus for example several people can collaborate in real time drawing VFX on the same canvas. The idea is the mix of midi controller and online video game. Web app that VFX controller is connected to could actually be a game. VFX controllers just have rotary encoders and maybe some other sensors instead of buttons and analog sticks.

  • login with encoders

    qubit07/12/2019 at 19:13 0 comments

    Implement WIFI login procedure that can be performed on the device w/o a phone or pc.


    1. Boot and check for creds in EEPROM

    2.A If creds are there attempt login with creds and exit on success.

    2.B If no creds are in memory or login fails scan for networks 

    3. Scroll through scanned SSIDs rotating encoder shaft (1 tick = 1 SSID)

    4. Select SSID by pressing encoder switch

    5. Enter password by scrolling through and selecting ASCII symbols with encoder

    7. Hold for 1000 μs to login with just entered creds

    8.A If login successful update creds in EEPROM and exit

    8.B If login fails within 15 seconds reset procedure (null all) and go to step 2.B

    Algorithm issues solved:

    ALPS switch is bouncing on button release, i.e. when signal RISING. Generally bounce may occur on any signal CHANGE.

    SSD1306 symbol erase = draw black rectangle at the same place with function fillRect(upperLeftX, upperLeftY,  width, height, color)

  • Connect to WiFi AP

    qubit06/10/2019 at 01:54 0 comments

    Connect ESP32 module to WiFi without hardcoding access point info.

    Smart config technology.

    Android app ESP8266 SmartConfig. It's ESP32 compatible.

    After app is installed the phone should be connected to any available access point and then using app pass credentials to ESP32.

  • Buttons

    qubit06/04/2019 at 23:47 0 comments

    One more thing is lot of rotary encoders are come with buttons and ability to use it should be included into Rotary class constructor along with some related to button functionality methods are added to class. 

  • 3D sketches

    qubit06/04/2019 at 23:45 0 comments

    Encoders can manipulate various parameters of visual effects in web browser via wifi. 

    I've changed code of a p5.js example so that parameters of a trigonometric curve and rotation along Y and Z axes are controlled by encoders. 

    Having fun controlling dimensions

  • Encoders Data

    qubit05/28/2019 at 05:19 0 comments

    Encoders data is sent to browser as a JSON file via websockets and available at a local URL

  • Adding web server functionality and client web interface.

    qubit05/27/2019 at 03:51 0 comments

    In order to transmit data from encoders to client web page I am using websockets. This protocol allows to update data without page reloading.

    For the code readability html document is stored as a string in a separate header file within the project.

View all 7 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates