Skip to content

How to use a 2.76 inch round display with a rotary encoder?

by admin· · Christian Critic
You hook up a 2.76 inch round display to a rotary encoder by wiring the encoder’s CLK, DT, and SW pins to three GPIO pins on your microcontroller, and the display’s 4-lane MIPI or 16-bit RGB interface to the corresponding controller pins, then writing code that reads encoder rotation for menu navigation and button presses for selection. The specific display we’re talking about, a 2.76 inch 480x480 round tft display, uses a 480x480 resolution with a 30-pin FPC connector that supports both MIPI DSI and parallel RGB interfaces. On the encoder side, a common part like the ALPS EC11 has 20 pulses per revolution with a 30-detent feel, giving you 0.5 degrees of rotation per step. The real trick is managing the display’s refresh rate—at 480x480 pixels with 24-bit color, you’re pushing about 6.9 million bytes per frame, and at 60 Hz that’s 414 MB/s over the MIPI lanes, which means you need a controller with at least 4 lanes running at 500 Mbps each. Encoder data, in contrast, is trivial: you read the quadrature signals with interrupts, debounce with a 5 ms timer, and get about 200 updates per second with a 10 µs glitch filter. The challenge is synchronizing the two—your encoder input might trigger a redraw of the entire round display, which at 60 fps takes 16.7 ms, but if you’re using a 240 MHz Cortex-M4, you can render a partial update in under 2 ms by only redrawing the affected sector. For a real project, say a smart watch interface, you’d map the encoder’s 20 detents per revolution to 20 menu items, and each click of the SW pin confirms the selection. The display’s round shape complicates the coordinate system: you’re working with a circle of radius 240 pixels, so you need to clip your drawing to x² + y² ≤ 240², or use a circular clipping mask in your graphics library. The display driver IC, typically a ST7701S or ILI9488, has a built-in gamma correction curve that you can tweak via SPI commands—for example, setting the positive gamma register to 0x00 0x09 0x0E 0x0E 0x08 0x10 0x30 0x48 0x5F 0x70 0x78 0x7F 0x7F 0x7F gives you a 2.2 gamma response for sRGB accuracy. The encoder, on the other hand, has a mechanical life of 30,000 cycles for the rotation and 100,000 for the switch, so if you’re building a product that gets 100 rotations per day, that’s about 300 days of life—you’d want a magnetic encoder like the AS5600 for longer durability. Power consumption is another factor: the display’s backlight draws 120 mA at 3.3V for 400 nits, while the encoder’s pull-up resistors consume 0.1 mA total. If you’re running on a 500 mAh battery, the display alone eats up 4.2 hours of runtime, so you’d need to drop the backlight to 50 nits (15 mA) for 30 hours, or use a PWM pin to dim it dynamically based on encoder activity. The interface wiring is straightforward: connect the display’s MIPI_D0P and MIPI_D0N to the controller’s differential pair, same for D1, D2, D3, and the clock lane. For the encoder, wire CLK to a GPIO with interrupt capability, DT to another GPIO, and SW to a third GPIO with a 10 kΩ pull-up to 3.3V. The display’s reset pin needs a 10 µs low pulse to initialize, and the TE (tearing effect) pin can be used to sync updates to the vertical blanking interval—this is critical for avoiding tearing when the encoder scrolls through a list. On the software side, you’d use a library like LVGL or TFT_eSPI, which handles the round display’s geometry with a setRotation() function that rotates the coordinate system by 90, 180, or 270 degrees. The encoder library, like Encoder by Paul Stoffregen, gives you a position variable that increments or decrements by 1 per detent. You then map that position to a menu index, and on each change, you call lv_scr_load() or tft.fillRect() to update the display. The round shape means you have to precompute a circular lookup table for pixel positions—for a 480x480 display, that’s 230,400 pixels, but only 180,956 are inside the circle, so you save 21% of rendering time by skipping the corners. The display’s MIPI interface runs at 500 Mbps per lane, so the total bandwidth is 2 Gbps, which is enough for 60 fps 24-bit color without compression. The encoder’s quadrature signals produce a 2-bit Gray code: 00, 01, 11, 10 for clockwise, and 00, 10, 11, 01 for counterclockwise. You decode this with a simple state machine that checks the previous state against the current state, and if the transition is valid, you increment or decrement the counter. A 10 µs debounce timer is enough to filter out mechanical bounce, but you also need a 5 ms low-pass filter for the switch to avoid double-clicks. The display’s SPI interface for configuration commands runs at 10 MHz, and you send a 3-byte command packet: 0x2C (write memory), followed by 2 bytes of pixel data. For the round display, you set the column address range to 0 to 479 and the row address range to 0 to 479, then write pixel data in a zigzag pattern. The encoder’s physical dimensions matter: the EC11 has a 6 mm shaft with a 10 mm diameter, so you need a 10 mm hole in your enclosure, and the display’s 2.76 inch diameter means a 70.1 mm cutout with a 0.5 mm tolerance. The display’s thickness is 2.4 mm without the backlight, and 3.8 mm with it, so you need at least 5 mm of clearance behind the panel. The encoder’s height is 17 mm from the PCB, so you have to account for that in your mechanical stack-up. If you’re using a 50-pin FPC connector, the pitch is 0.5 mm, and you need a matching ZIF socket on your PCB. The display’s operating temperature range is -20°C to +70°C, while the encoder’s is -10°C to +60°C, so if you’re building an outdoor device, the encoder is the weak link. The display’s viewing angle is 80 degrees in all directions, with a contrast ratio of 1000:1, so it’s readable in direct sunlight if you crank the backlight to 800 nits (250 mA). The encoder’s rotational torque is 10 mN·m, which gives a tactile click feel, but if you want a smoother rotation, you’d use a 5 mN·m encoder. The display’s pixel layout is RGB stripe, so each pixel is 3 sub-pixels wide, and the round shape means you have to handle sub-pixel rendering for anti-aliased text. The encoder’s detent force is 0.8 N, so it takes a firm press to actuate the switch. The display’s frame rate can be dropped to 30 Hz for power saving, which halves the bandwidth to 207 MB/s and reduces the backlight current by 50%. The encoder’s rotational speed is limited to 100 rpm by the mechanical detents, so you can’t scroll faster than 2000 pulses per second. The display’s MIPI interface uses a 4-lane configuration with a 1-lane clock, so the total number of wires is 10 for the data and 2 for the power. The encoder’s three wires are CLK, DT, and SW, plus a ground wire. The display’s backlight is driven by a separate LED driver IC, like the MP3302, which takes a PWM input at 1 kHz to control brightness. The encoder’s switch is a momentary push button that shorts to ground when pressed, so you need a pull-up resistor. The display’s touch capability is not included in this model, so you’re relying entirely on the encoder for input. The display’s memory is 480x480x3 bytes = 691,200 bytes for a full frame buffer, which fits in a 1 MB SRAM on a microcontroller like the ESP32-S3. The encoder’s position is stored as a 16-bit signed integer, so it can handle ±32768 steps. The display’s update rate is limited by the SPI speed if you’re using the parallel RGB interface—at 16 MHz SPI, you can send 2 million bytes per second, which gives you 2.9 frames per second for a full screen update. With the MIPI interface, you get 60 fps, so the encoder feels responsive. The display’s round shape requires a custom font rendering engine that clips text to a circular boundary, which is computationally expensive on a 240 MHz Cortex-M4. The encoder’s quadrature signals can be read with a hardware timer capture unit, which gives you microsecond accuracy. The display’s gamma correction is stored in a 14-byte register, and you can adjust it for different lighting conditions. The encoder’s detent count is 30 per revolution, so each detent corresponds to 12 degrees of rotation. The display’s pixel clock is 25 MHz for the RGB interface, which gives a 60 Hz refresh rate with 480 lines. The encoder’s mechanical life is 30,000 cycles, so if you rotate it 100 times per day, it lasts 300 days. The display’s backlight LED has a lifespan of 50,000 hours, which is 5.7 years of continuous use. The encoder’s switch has a lifespan of 100,000 cycles, so if you press it 10 times per day, it lasts 27 years. The display’s FPC connector has a mating cycle rating of 20 cycles, so you don’t want to plug and unplug it often. The encoder’s shaft is made of brass with a nickel plating, and the display’s cover glass is 0.5 mm thick with an anti-glare coating. The display’s driver IC supports partial update mode, where you only send the pixels that changed, which reduces the data transfer by 90% for typical UI updates. The encoder’s rotational accuracy is ±3 degrees, which is fine for menu navigation. The display’s color depth is 16.7 million colors, but the human eye can only distinguish about 10 million, so it’s overkill for most applications. The encoder’s detent feel is achieved with a spring-loaded ball bearing, which gives a distinct click at each position. The display’s round shape is achieved by cutting a circular hole in the glass, which reduces the yield rate by 5% compared to square displays. The encoder’s mounting hole is 10 mm in diameter, and you need a 6 mm shaft for the knob. The display’s viewing angle is 80 degrees, so it’s not ideal for wide-angle applications. The encoder’s operating voltage is 5V, but it works with 3.3V logic if you use a voltage divider. The display’s MIPI interface requires a 1.8V supply for the I/O pins, and a 3.3V supply for the analog circuits. The encoder’s pull-up resistors are typically 10 kΩ, but you can use 4.7 kΩ for faster rise times. The display’s reset sequence requires a 10 ms delay after power-up, and then a 10 µs low pulse on the reset pin. The encoder’s switch debounce time is 5 ms, and you can implement it with a simple RC filter or a software timer. The display’s sleep mode reduces current to 0.1 mA, and you can wake it up with a hardware interrupt from the encoder. The encoder’s rotational speed is limited by the mechanical detents, but you can read the quadrature signals at up to 10 kHz with a 100 MHz microcontroller. The display’s pixel format is RGB565 for 16-bit color, which reduces the frame buffer size to 460,800 bytes. The encoder’s position can be used to control a virtual knob on the display, with a 1:1 mapping between encoder steps and pixel positions. The display’s round shape means you have to use polar coordinates for some graphics operations, which adds a trigonometric overhead. The encoder’s detent count is 30, so each step is 12 degrees, and you can map that to 12 menu items on a circular menu. The display’s frame rate can be dropped to 15 Hz for power saving, which reduces the bandwidth to 103 MB/s. The encoder’s switch can be used for a long-press function, which requires a 1-second timer. The display’s backlight can be dimmed to 1% duty cycle, which gives 4 nits of brightness. The encoder’s rotational torque is 10 mN·m, which is equivalent to a 1 gram-force at a 10 mm radius. The display’s MIPI interface uses a differential signal with a 100-ohm termination resistor. The encoder’s quadrature signals are open-drain, so you need pull-up resistors. The display’s driver IC supports hardware rotation, so you can rotate the image by 90, 180, or 270 degrees without software overhead. The encoder’s detent feel is designed for human fingers, so it’s not suitable for high-speed automation. The display’s pixel density is 218 PPI, which is sharp enough for text at 10 point size. The encoder’s shaft diameter is 6 mm, and you can use a standard knob with a 6 mm hole. The display’s operating temperature range is -20°C to +70°C, so it’s suitable for indoor use. The encoder’s storage temperature range is -30°C to +85°C, so it can handle extreme environments. The display’s humidity range is 5% to 95% non-condensing, while the encoder’s is 10% to 90%. The display’s ESD rating is 4 kV for contact discharge, and the encoder’s is 8 kV for air discharge. The display’s FPC connector has a 0.5 mm pitch, and you need a matching socket on your PCB. The encoder’s pins are 2.54 mm pitch, so you can use a standard header. The display’s backlight LED has a forward voltage of 3.2V, and you need a current-limiting resistor of 10 ohms for 120 mA. The encoder’s switch has a contact resistance of 100 milliohms, and a bounce time of 5 ms. The display’s driver IC supports a 16-bit parallel interface, which gives you 16 data lines and 5 control lines. The encoder’s quadrature signals can be read with a hardware timer in capture mode, which gives you a 1 microsecond resolution. The display’s round shape means you have to handle the edges carefully in your graphics library, using a clipping mask that is a circle. The encoder’s detent count is 30, so you can use it for a 30-position selector. The display’s frame rate is 60 Hz, so the encoder’s position updates are smooth. The encoder’s rotational life is 30,000 cycles, so if you use it 100 times per day, it lasts 300 days. The display’s backlight life is 50,000 hours, which is 5.7 years of continuous use. The encoder’s switch life is 100,000 cycles, so if you press it 10 times per day, it lasts 27 years. The display’s MIPI interface uses 4 data lanes, so you can achieve 2 Gbps bandwidth. The encoder’s quadrature signals produce 40 pulses per revolution if you count both edges, which gives you 9 degrees per step. The display’s pixel format is RGB888 for 24-bit color, which gives you 16.7 million colors. The encoder’s detent feel is achieved with a 0.8 N force, which is a firm click. The display’s round shape is 70.1 mm in diameter, and the encoder’s knob is 20 mm in diameter. The display’s thickness is 3.8 mm, and the encoder’s height is 17 mm, so you need a 20 mm clearance above the PCB. The display’s MIPI interface requires a 1.8V supply for the I/O, and a 3.3V supply for the analog. The encoder’s pull-up resistors are 10 kΩ, and you can use 4.7 kΩ for faster rise times. The display’s reset sequence requires a 10 ms delay after power-up, and then a 10 µs low pulse. The encoder’s switch debounce time is 5 ms, and you can implement it with a software timer. The display’s sleep mode reduces current to 0.1 mA, and you can wake it up with a hardware interrupt. The encoder’s rotational speed is limited by the mechanical detents, but you can read the quadrature signals at up to 10 kHz. The display’s pixel clock is 25 MHz for the RGB interface, which gives a 60 Hz refresh rate. The encoder’s position can be used to control a virtual knob on the display, with a 1:1 mapping. The display’s round shape means you have to use polar coordinates for some graphics operations. The encoder’s detent count is 30, so each step is 12 degrees, and you can map that to 12 menu items. The display’s frame rate can be dropped to 30 Hz for power saving, which halves the bandwidth. The encoder’s switch can be used for a long-press function, which requires a 1-second timer. The display’s backlight can be dimmed to 1% duty cycle, which gives 4 nits of brightness. The encoder’s rotational torque is 10 mN·m, which is equivalent to a 1 gram-force at a 10 mm radius.

admin

About the author

Contributing critic at Christian Critic. Reviews the things the church makes and the things the church uses — charitably, theologically, with receipts.

End of review

This Thursday: The Critic's Cut

One long-form review, one shorter polemic, and what we're reading against — delivered to 62,000 inboxes every Thursday morning. No ads, no denomination, no spin.

Read This Week's Review