A tad out of focus, but this little dude can read four PWM outputs from a wireless DMX LED dimmer and turn those values into animation and brightness controls for a costume element that uses APA102C LEDs.
The good news is that the DMX device uses open-drain outputs so I just chucked pull-ups on four pins and used counters to read the inputs. I've attached my Spin-only (no PASM required) code for reading PWM. The only requirement is that the sample window is at least 1x the PWM period, and should probably be a multiple of the period. In my case the PWM frequency is 20kHz so I used a 5ms sample window. This also works well in that DMX updates outputs every 23ms, so I'm sampling 4x times between DMX updates -- it's plenty responsive.
The costume element has strips of LEDs, the longest being eight pixels. The original device simply divided the 0..255 range into eight zones -- the output looked a little chunky, and sometimes fluttered around pixel-to-pixel threshold values. Rick (yes, Galinson, the paintball mini-gun guy) asked if I could fade in/out LEDs to create a smoother look. It took a little work, but it looks great (excellent call on his part). The controllers and new LED PCBs have been installed and everything looks great. Rick did a fantastic job with new mechanical pieces. Everything looks better, works better, and is serviceable.
Since ObEx wouldn't seem to let me post new objects, I've attached my PWM reader and APA102C objects here. Funny, I wrote the APA102C object for another movie project.
The reason the carrier PCB looks a little funky is that I etched it in my kitchen. For simple boards -- especially when there is an emergency -- I use the system from PCB Fab-In-A-Box (https://pcbfx.com/
). Thus far I've only done single-sided boards, but I'm going to attempt a double-sided soon. It's great for emergency projects like this.