Wednesday, January 18, 2017

NEOs & PIC 12F1840 Proof of Concept

I was looking to add some NEOs to another project and wanted to see if a PIC could be programmed to drive them. Thus the birth of this POC. I took some inspiration from an Adafruit tutorial on writing your own driver for a PIC. This tutorial focused on the RGB version of the NEO (no separate white LED) The PIC used was a PIC 18F4550 clocked at 48Mhz in order to be fast enough for the timing. It's not quite fast enough to technically keep within the specs for the NEOs but it was learned in this tutorial that only the positive pulse width is relevant (within reason) and the author was able to keep that within the variance spec.
This experiment is to see if I can do the same for a much smaller PIC: 12F1840 driven at it's max clock rate of 32Mhz and using the RGBW version of the NEO: An Adafruit NEOPixel stick (8 NEOs with RGBW LEDs). I was able to do it as can be seen in the video:

The PIC is configured to use internal PLL for generating an internal 32 Mhz clock which, with a few coding optimizations is just fast enough to get within specs of the NEOs for that critical positive pulse width. In addition I coded this to use 32 bit format for the RGBW version of the NEO.

So now I can use this same technique to incorporate NEOs into a much smaller (8 pin device) PIC.
The schematic for this POC:

The entire project was coded in XC8 (free version) with one function using in-line assembler to get the speed needed to meet timing requirements for the NEOs.

The zipped MPLABX project package is here.

1 comment: