[UPDATE]: Sarah and Jan emailed me to mention that the 10A@5v power supply is a bit of an overkill. I agree but this is the recommendation from GHI. When I tested my strip on full power it was under 3A@5v . Jan claims his is around 2.6A@5v . This does not account for peak current draw, so you may hit issues, but perhaps the full 10A is a bit much.
Who does not like LED’s? They are fun and amazing, especially if you by a 5m strip of individually addressable multicolour LED’s. I had a whole pile of important work to get done today but for some reason the FEZtive kit I ordered ages ago was just begging to be used. More importantly I found a power supply that will give 10A@5v so I had to have a play.
The first hurdle was finding out how to power the module 160×3 LEDs (RGB) is a lot to power and GHI recommend a good power supply which is attached to the FEZtive module board part A, this way you are not drawing power through the .NET Gadgeteer mainboard. In the picture below you can see my power connector. (Not I have not split the PCB as I only need one connector for now and this way I don’t loose the other half.)
Next I need to connect the connect the LED strip to the PCB, my strip had a connector on each end and as I planed to run this as a single strip, I cut the connector off the end and attached it to the PCB. This way I can disconnect the LED strip. Now I have power, data (Gadgeteer cable) and a connector for the lights.
Connect it all up and we are ready for some software….
There is a great example of how the use the module here : http://wiki.tinyclr.com/index.php?title=FEZtive_Module
At the time of writing the FEZtive module is not part of the main GHI installer (I guess it will be in time) so you need to download the project from the link above. Be sure to add this project to your solution (or new project),
Next add a reference from your project to the FEZtive project you just downloaded. (I am using NetMF 4.2 so add a reference to the _42 project.)
Since you cannot drag and drop the module from the designer (not yet) you need to create the object on the socket that you are using, I have a Spider with SPI on socket 9. Here is the example code from: http://wiki.tinyclr.com/index.php?title=FEZtive_Module
Fantastic this works! (It is hard to take a picture, they look better in real life)
The FEZtive part B
The LED’s are connected by 4 lines (Gnd, CI, DI, +5v) and you don’t need anything on the ‘end’ of the LED strip, as it is just one big long SPI bus. So in theory you can cut the strip (there are marked points to cut after each LED- see the white line) into different sizes. The PCB that my kit came with has 2 parts and A and a B, each with 5 areas to connect an LED strip. Think of these PCBs as U-turns in the LED strip. You can cut it into 5 x 1m strips and then zigzag them between part A and part B, note that this will make the order of the LEDs into a long snake, so if you are writing text or showing a picture you will need to calculate which LED is where. (Yes you can link multiple together – I only have one)
How does it work?
If you look at the GHI driver for this module you can see that there is a large array (one for each LED) which contains a custom ‘colour’ object. There are a series of public methods that let you manipulate this array (change the colour) and then there is a draw method that will ‘write’ the entire array of ‘colour’ objects to the SPI bus.
There are some interesting effects of this. Imaging you have a LONG strip, say 5m and decide to set the colour to blue, you can see the new colour advancing along the strip. It is easier to see if you slow the clock speed down.
This got me thinking, how is it working? Imagine you built a new (very large) HD TV out of this would it work? Well not exactly, you would get rather ugly ‘scan’ lines and the refresh would be poor.
Change the colour
I have a .NET Gadgeteer colour sensor and setup a button that would read the sensor and set all LEDs to that colour. Handy to test and a little more fun as you can point it at an object, press a button and all the LEDs change colour.
Here is a bit of code:
Something is a bit strange here, the colour sensor returns a uint for each of RGB as well as an intensity. The FEZtive LED strip takes a value between 0-127 for each of the RGB. For now I halved the channels, but this is not correct and for extreme lighting conditions it will produce strange results. I plan to normalise these values, but so I can test a bit more this will do for now. I could not find a datasheet for the Colour sensor module and the source code does not give away much. humph! – GHI? The driver reads 2 bytes fore each channel 2^16 colour options per channel, but I noticed that with a bright light the values rarely top 10,000. (e.g RED: 9715, GREEN: 12368, BLUE: 11918) [UPDATE : http://stevenjohnston.co.uk/2013/04/15/colour-sensor-on-net-gadgeteer-tcs3414/]
Each multicolour led on the strip has a processor next to it, yes every one! This is the LDP8806 – anyone got a data sheet?
Something is interesting here, you just tell the Gadgeteer initialiser how many LEDs there are, and then ram data down the SPI bus. If you say there are only 10 LEDs then only the first 10 in your strip will work. This means that the data is fed to the first led in the strip, the colour is set and then all subsequent data is passed down the SPI bus, to the next LED and so on.
There is a series of zeros that are passed into SPI before and after each call, and this depends on the length of the strip. (presumably to set the LED into a state where it can obtain a new colour). I think this explains why each value is limited to a range of 0-127, the high bit is being used to command each LED.
Ok, enough speculation, here is a much better explanation: https://github.com/adafruit/LPD8806/blob/master/LPD8806.cpp
Can it go faster?
For a bit of fun I decided to see what SPI clock rates would work with my 5m strip.
So it would look like 14MHz is as fast as this will run without errors. It is not exactly scientific, so the plan is to run at at this speed for a bit and see how it copes.