WS2812 test

Small Windows application controlling WS2812 LED chain from PC using UART (USB-UART adapter).

WS2812 test

Main settings: COM port number, number of LEDs to control and baudrate.
WS2812 test app - settings

I've bought few cheap WS2812B 8x1 strips after seeing them used in one version of ClonePI metal detector. This LED strip was used as a bargraph display and was driven by a single microcontroller pin. Multiple LED strips could be chained together.

WS2812 8x1 strip
WS2812 8x1 strip
WS2812 + FT232RL

Initially I wanted to add WS2812 support to my CH341 tool, but WS2812 timing requirements cannot be matched with it. CH341A SPI is way too slow to match WS2812 timings and CH341A UART has necessary baudrate, but is just too weird with its minimum STOP time equal to 2 us (https://github.com/nospam2000/ch341-baudrate-calculation).

Required hardware

Waveform required to control WS2812 is generated as inverted UART data signal with 7 bits of data, 1 stop bit and baudrate somewhere in range of 20000000 to 3000000 bps.

I've tested cheap USB-UART module based on FT232RL clone first. Contrary to original, it does not support inverting TX signal in hardware, so external inverter is needed.

UART inverter scheme

I've used 2SC945 transistor (just randomly selected from inventory, virtually any low power npn transistor should work). This inverter must operate with relatively high speed. Depending on transistor type/gain, saturation effect might completely mess up timings or even cause inverter output not going to high state ever. One way to deal with it might be Baker clamp.

I've also tested successfully PL2303 module, though the exact module I own seems to have a design issue: RX pin works like a quite strong pull-up with 4.7 V open circuit voltage and 15 mA short current.
PL2303 module
PL2303 module

Captured pulseview trace, D0 = UART TX, D1 = UART TX after inverting, sampling speed = 16 Msps, UART BR = 2000000, 7 data bits, 1 stop bit:
WS2812 UART trace
Full file: pulseview_trace.zip.

WS2812B LEDs can consume up to 60 mA each (all 3 colors at maximum brightness), so 8 LED strip should work fine powered directly from USB / UART adapter 5V.

I haven't tested original FT232RL in this application. It should work, but one difference is that - if I'm not misinterpreting the datasheet - it is not able to generate 2 MBaud speed used as default setting. It should work after changing baudrate in settings to 3000000.

Github: https://github.com/tomek-o/WS2812-test.