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.
CONNECT ENCODER TO ESP32
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.
TESTING LIB ON MULTIPLE ENCODERS AND HUZZAH32
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.
TRANSMIT AND DISPLAY DATA
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.