Not entirely Arduino : An ATTiny with AVR assembler solution
I have written a 250kbps "N,8,2" interface to receive 512 bytes of DMX data and simultaneously convert it over to NRZ (for WS2811/12) and SPI (for WS2801 etc) - to drive strings/tapes of up to 170 RGB Pixels
The code uses NO RAM, only a few registers on the ATTiny13A. It runs at 9.6MHz in 544 bytes of flash
I am using synchronization from the byte stop/start transition, to allow for variance in clock speed error
WSxxxx data is running slow (182Kbps), time-skewed to match DMX data byte-for-byte, but still within spec, with just enough time to stop the WS data latch from occurring (~5500ns) !!
Bit read sampling is also skewed against output requirement as there is effectively 11bits coming in and 8 bits going out.. twas a clock-cycle counting nightmare !!
Also included is a DMX-heartbeat LED indicator that pulses when DMX is being received
The PCB has connectors for DMX/PWR in and NRZ/SPI/PWR out, (the board runs at 5v straight-through), one SN76175 differential transceiver, a few caps and resistors, and an LED. ISP connection for programming on the underside, all in standard mount as my eyesight is like Mr Magooo these days !
Board measures 25mm * 35mm
The cost of the finished part is around £1, in qty