Nicolas Electronics

Electronic projects and programming


WS2812 LED driver on a 16F876A @20MHz

Someone on the matrix multimedia forum (French) needed to drive some WS2812 LEDs and wanted to use a 16F876A at 20MHz to do so.
The WS2812 LEDs are RGB LEDs with an integrated controller chip. There’s a data input and data output so you can cascade multiple LEDs by connecting DO to DI of the next LED. Each LED reads 3 bytes, being the value of the color green, red and blue.
Once you’ve sent a color to the LED, it will stay that color until you send another code.

Driving the LEDs would require timings in the 50ns/100ns range, but you can stretch it just a bit.
This is one of those things where timing is pretty much crucial and an AVR would be a better microcontroller for this as it executes one instruction per clock cycle where the PIC needs 4 clock cycles per instruction.

DCF77 Radio Clock

In 2009 I made a DCF77 radio clock for my final years project. I used Flowcode to program the radio clock back then.

Today, I’ve rewritten the code in C and I used the free version of the XC8 compiler to compile it.
I’m using the Winstar yellow 16×2 OLED display and my library to display the time and date.