Driving the WS2812 RGB LED Array

  The WS2812, sometimes known as a NeoPixel is an RGB LED with a built in controler IC. They can be purchased individually, or connected together into various shapes, such as the 60 LED, 1 metre strip shown above. Each LED has pins for +5Volt Power, Ground, Serial Data In and Serial Data Out.  By connecting the data output pin of one LED to the data input of the next, it is possible to daisy chain them to almost any length. Earlier PIC chips, such as the PIC16F627, could not drive the WS2812 due to their slower speed and limited memory, but – as you will see below – its easy with the LPLC.   Serial Interface A single pin is all that is needed to send data to the entire LED array. 3 bytes of data (0ne byte for Green, Red and Blue) must be output serially for each LED, so a chain of 60 LEDs needs a total of 180 bytes of data (1440 bits).   A zero bit is output by setting the pin high for 350 nano seconds and low for 900. A one bit is output by setting the pin high for approximately 900 nano seconds and low for 350. The time which the pin is high is critical and must be accurate to +/- 150 ns. The low time does not appear to matter quite so much, but should be less than a few micro seconds, or the controller chips will treat it as a reset signal.   Electrical Connections The LED strip has three wires: +5 Volt Power Ground Data Each LED may...

LPLC Oscilloscope Demo

The page for this is coming shortly – if you are interested, the LCD module I am using can be found here: goo.gl/kM4om4 It’s not only a 160 x 128 colour LCD, it’s also an SDMedia card interface – and that’s a great little addition as the SDMedia card interfaces have difficult software mount connections, and this gives you a nice compact interface that fits easily to a breadboard. You can see the interface on the back of the LCD...

LED Matrix “Pong” Clock

    Click HERE to see a video of it in action on Youtube.   LED Module You can buy some nice LED display modules on Ebay for very reasonable prices. One typical example are the DE-DP14112 and DE-DP14211 3216 LED dot matrix display boards, manufactured by Sure electronics. They are sold by a number of Chinese  and Hong Kong retailers for around £20 for the version with 3mm LEDs, and £25 for the larger version with 5mm LEDs. The price does include P&P, but be aware that if you are unlucky and customs check the package, you may need to pay VAT and import duty, plus a £8 handling charge to Royal Mail. The board contains 512 Red/Green LEDs arranged in a 32 x 16 matrix, plus four HT1632C LED driver ICs and some CMOS buffers and shift-registers to drive and select the relevant LED driver.     It’s pretty simple to connect one of these boards to an LPLC – the CS and CLK lines drive a shift-register to select one of the four HT1632C LED driver ICs, and the WR and DATA lines load data serially into the selected HT1632C. The display module needs a +5volt supply. When all the LEDs are lit, it will draw two or three amps, but in this application, only a small fraction of the LEDs are lit at any one time, and average current consumption is around 300mA, so a 5 volt, 500mA USB phone charger supply should be sufficient. Circuit A voltage regulator reduces the 5 Volt supply down to 3.3 Volts for the LPLC. I used an MCP1702-3302,...

LPLC – Driving a MAX7219 7-segment LED display

  Click here for Youtube video  demonstrating the features of the display. Whist it is possible to connect a multi-digit 7-segment LED display directly to an LPLC module, it can very quickly get messy and complicated. If the display has more than 2 digits, it will need to be multiplexed, which means high-current digit drivers and a software interrupt routine. By far the simplest and cheapest method is to use a ready made LED module which contains the display and a MAX7219 driver IC all on a small PCB. These are available on EBay for around £2.50, including Postage and Packaging from Hong Kong or China. These have a serial SPI interface which can easily be driven from a microprocessor. The only complication is that the LED module needs a 5 volt power supply, but the LPLC requires 3.3 volts, so a simple voltage regulator may be needed. The LPLC seems to drive the three MAX7219 data lines OK from its 3.3 volts, without the need for buffer amplifiers. The source code of the demo program can be downloaded from here : MAX7219.X The pin connections are defined in file MAX7219.h as follows, but can be changed to anything convenient: Display DIN  = PORT B0 (LPLC Pin 21) Display LOAD/CS  = PORT B1 (LPLC Pin 22) Display CLK  = PORT B2 (LPLC Pin 23) All the code to control the display module is contained in the template file MAX7219.c .  Have a look at Main.c for sample code showing how to use it, and see the Youtube video to see it running. Have fun! Gary G0HJQ        ...