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 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 (client) and the device (server) is established through websockets protocol. 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.

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

  • 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. Login to network with stored creds if available and exit on success.

    3. Scan for networks if no creds in memory or login fails

    4. Scroll through found SSIDs list by rotating encoder shaft

    5. Select SSID by pressing encoder switch

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

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

    8. If login successful store creds in EEPROM and reboot

    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 6 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