How to Design a Custom PCB for a 128x32 COG LCD Display
To design a custom PCB for a 128x32 COG LCD display, you need to start by matching the display’s electrical and mechanical specs to your circuit. The 128x32 COG LCD display typically uses a chip-on-glass controller like the ST7565R or SSD1306, which requires a 3.3V logic supply, a SPI interface (SCLK, MOSI, CS, DC, and RST lines), and a backlight LED driver. For example, the common 128x32 COG module from DisplayModule runs at 3.3V, draws about 2-5mA for the LCD itself, and around 20-40mA for the backlight (depending on resistor value). You’ll need to design a PCB that routes these signals cleanly, keeps power decoupling close to the display connector, and avoids long traces that could introduce noise. Start with a 2-layer board if you’re on a budget, but a 4-layer board gives you a dedicated ground plane and power plane, which is better for noise-sensitive SPI lines. The connector is usually a 12-pin or 14-pin FPC (0.5mm pitch), so your PCB footprint must match that exactly—check the datasheet for pin pitch, width, and stiffener dimensions. Use a 10µF electrolytic and a 0.1µF ceramic capacitor near the display’s VDD pin to filter ripple. For the backlight, add a current-limiting resistor (e.g., 100Ω for 20mA at 3.3V) or a constant-current driver if you need brightness control. The SPI clock speed can go up to 10MHz, so keep the traces under 10cm to reduce reflections. If you use a microcontroller like an ESP32 or STM32, ensure its GPIOs are 3.3V tolerant—5V logic will fry the COG driver. Test the PCB with a simple sketch that initializes the display and draws a test pattern before adding complex features.
Let’s break down the key design steps. First, the power supply: the COG LCD driver needs a clean 3.3V rail. The ST7565R, for instance, has an internal voltage booster that generates up to 15V for the LCD glass, but it draws current spikes during refresh. Place a 1µF ceramic capacitor at the display’s VDD pin, and a 10µF capacitor near the power input to the board. If your system runs on a battery, add a low-dropout regulator (LDO) like the MCP1700-3302E, which has a 2µA quiescent current and can supply 250mA. The backlight is a separate circuit: a typical white LED backlight for this display uses 3.2V forward voltage and 20mA current. A simple resistor from a 3.3V supply gives 5Ω (3.3V - 3.2V / 0.02A = 5Ω), but use a 10Ω resistor to be safe and limit current to 10mA, which still provides decent visibility. For PWM dimming, connect the backlight anode to a MOSFET (e.g., 2N7002) driven by a PWM pin from your MCU. The MOSFET’s gate needs a 10kΩ pull-down resistor to avoid floating.
Second, the SPI interface is the backbone of communication. The display uses 4-wire SPI: SCLK, MOSI (SDIN), CS (chip select), and DC (data/command). Some modules also have a RST pin—tie it to an MCU GPIO for hardware reset, or pull it high with a 10kΩ resistor to 3.3V if you rely on software reset. The SPI clock frequency should be between 1MHz and 10MHz. For a 128x32 display, each frame requires 128 * 32 / 8 = 512 bytes of data. At 10MHz, that’s about 410µs per frame, so you can update the display at 2.4kHz, but the LCD’s response time is around 100ms, so 10Hz updates are fine. Route the SPI traces as short as possible—under 5cm—and avoid crossing them with high-current lines like the backlight. If you’re using a 2-layer board, place a ground plane on the bottom layer and route SPI on the top layer. Add series resistors (22Ω to 33Ω) on the SCLK and MOSI lines near the MCU to dampen ringing. For the CS and DC lines, you can use 10kΩ pull-up resistors to 3.3V to ensure they’re high when the MCU is in reset.
Third, the mechanical design is critical. The COG display has a glass panel with a chip bonded directly to it, so it’s fragile. The PCB must have a cutout or slot for the display’s FPC connector, which is usually a 0.5mm pitch, 12-pin or 14-pin ZIF socket. The display module’s dimensions are typically 30mm x 15mm for the glass, with a 0.5mm thick FPC that extends 10mm. The PCB should have a mounting hole pattern that aligns with the display’s screw holes—usually 2.5mm diameter holes at the corners. If you’re using a 3D-printed enclosure, leave 1mm clearance around the glass to avoid stress. The FPC connector’s footprint must match the datasheet: for a 12-pin connector, the pad width is 0.3mm, pitch 0.5mm, and pad length 1.5mm. Use a 0.3mm stencil for solder paste to avoid bridging. The connector’s locking tab should face away from the glass to prevent damage during insertion.
Fourth, the microcontroller selection matters. Most hobbyists use an ESP32 or STM32F103C8T6. The ESP32 has 3.3V logic, built-in SPI (HSPI or VSPI), and plenty of RAM for buffering. The STM32F103 runs at 72MHz and has a dedicated SPI peripheral with DMA support. For the ESP32, use the VSPI bus: MOSI on GPIO23, SCLK on GPIO18, CS on GPIO5, DC on GPIO19, and RST on GPIO21. The STM32’s SPI1 uses PA7 (MOSI), PA5 (SCLK), PA4 (CS), and you can assign DC and RST to any GPIO. Both MCUs need a 10µF capacitor on the 3.3V rail and a 100nF capacitor near each power pin. If you’re using a USB-to-serial converter for programming, add a 1kΩ resistor on the TX line to avoid overvoltage.
Fifth, the PCB layout guidelines are non-negotiable. Use a 0.5mm trace width for power lines and 0.3mm for signals. The via size should be 0.3mm drill with 0.6mm pad. Keep the display connector at the edge of the board to allow the FPC to bend naturally. The backlight resistor should be placed near the connector to minimize trace length. Add a ground fill on both layers, with stitching vias every 10mm to reduce EMI. For the SPI lines, avoid 90-degree corners—use 45-degree angles or curved traces. The total board size can be as small as 40mm x 20mm if you’re just driving the display, or larger if you add sensors or buttons. Include a 2-pin header for the backlight and a 4-pin header for SPI breakout, so you can test the display before soldering the MCU.
Sixth, testing and debugging is where most designs fail. Before ordering the PCB, simulate the power supply with a multimeter: the 3.3V rail should have less than 50mV ripple. After assembly, measure the backlight current with a DMM—it should be within 10% of your target. For SPI communication, use an oscilloscope to check the SCLK waveform: it should have clean edges with no overshoot above 3.6V. If the display shows garbage, check the CS timing—it must be low during the entire SPI transaction. The DC pin must be low for commands and high for data. Many COG modules require an initialization sequence: send 0xAE (display off), 0xA0 (segment remap), 0xC8 (COM scan direction), 0x40 (start line), 0x81 (contrast), 0x2F (power control), 0xA4 (display normal), 0xAF (display on). If you skip the contrast setting, the display may be too dim or too bright. The typical contrast value is 0x32 for a 3.3V supply, but adjust it based on your resistor values.
Seventh, thermal management is often overlooked. The COG display can operate from -20°C to 70°C, but the backlight LED generates heat. If you run the backlight at 20mA, the LED dissipates about 64mW, which is fine for a 10mm² area. But if you’re using a 100Ω resistor, it dissipates 40mW—ensure it’s a 0603 or 0805 package with a 1/8W rating. The LDO regulator also heats up: at 100mA load, the MCP1700 drops 0.3V, so it dissipates 30mW, which is negligible. If you’re using a linear regulator with a higher dropout voltage, add a heatsink or a thermal pad on the PCB.
Eighth, firmware optimization can reduce power consumption. The display driver can enter sleep mode by sending 0xAE. The backlight can be PWM-controlled at 1kHz to avoid flicker. For the ESP32, use the LEDC library to generate a 1kHz PWM with 8-bit resolution. The display’s RAM is 128x32 bits, so you can update only changed bytes to save SPI bandwidth. For example, if you’re drawing a line, send only the affected rows. The SSD1306 driver supports page addressing mode, where you set the page (row) and column, then send data sequentially. This reduces the number of SPI transactions from 512 to 32 per frame.
Ninth, cost and manufacturability matter for prototypes. A 2-layer PCB from JLCPCB costs about $2 for 5 boards, with 1oz copper and HASL finish. The 128x32 COG module itself costs around $8-$12 from suppliers like 128x32 cog lcd display. The total BOM for a custom board, including the MCU, capacitors, resistors, and connector, is under $15. For production, use a 4-layer board with ENIG finish to improve solderability. The FPC connector is a critical part: use a Hirose FH12-12S-0.5SH or a compatible part from Molex. These connectors have a 0.5mm pitch and a locking mechanism that prevents the FPC from slipping out. The footprint should include a 0.3mm solder mask opening and a 0.1mm stencil step for the fine-pitch pads.
Tenth, real-world examples help you avoid pitfalls. I’ve seen designs where the SPI lines were routed next to a switching regulator, causing noise that corrupted the display data. The fix was to move the regulator to the opposite side of the board and add a ferrite bead on the power line. Another common issue is using a 5V MCU with a 3.3V display—a level shifter like the TXB0104 solves this, but it adds cost and propagation delay. If you’re using an Arduino Uno (5V logic), you need a voltage divider on the SPI lines: a 10kΩ series resistor and a 20kΩ pull-down to ground gives 3.3V from 5V. The CS and DC lines can be driven directly with a 1kΩ resistor in series. The backlight must be driven from a 3.3V source, not 5V, or you’ll burn the LED.
Finally, advanced features like touch input or ambient light sensing can be integrated. The 128x32 display has a 1.3-inch viewing area, which is perfect for a smart badge or a mini oscilloscope. You can add a capacitive touch sensor (e.g., MPR121) on the same PCB, using I2C (SDA and SCL) on separate pins. The I2C lines need 4.7kΩ pull-up resistors to 3.3V. The display’s SPI bus can be shared with other SPI devices, like an SD card module, but you need separate CS lines. The total current draw for the display, MCU, and touch sensor is under 100mA, so a 200mAh LiPo battery lasts about 2 hours of continuous use, or 10 hours with the backlight off. For battery-powered designs, use a 3.3V buck converter like the TPS63060, which has 90% efficiency and a 1.8V to 5.5V input range. The output ripple should be under 30mV to avoid display artifacts.