Introduction: Colour Addressable LED Dsiplay
The display is constructed from strips of tri-colour LEDS controller type WS2811 running at 400kHz. There are 8 strips each with 40 individually controlled LEDS. The controller is a BV500 ByPic device which can easily control 8 or more of these strips simultaneously.
The display was built as a concept to test the speed and feasibility as such not much effort was put into the actual design so there are some problems particularly with the power supply. If you want to build something like this then read the text in full as there are some valuable lessons that can be learned.
In use the update is very quick, probably quick enough for video but with only 320 pixels total that is not practical. It does however make a good display and the images and animation is only limited by the imagination.
The display will operate stand alone with pre-programmed information but it has Bluetooth and so can be controlled remotely.
This is a video of the display working, sorry about the quality but is does give an idea of how the display can operate.
Step 1: How It Works
Shown is a block diagram.
This is the actual back of the display sowing the component parts.
The power is derived by two 2A regulators, one regulator feeds strips 0 to 3 and the other one feeds strips 4 to 7 however this is not really enough if the LEDs are full on. At full brightness each LED consumes about 35mA so in theory each strip would need 1.4A each. This is a display, not a light, however and so that situation can be avoided, even so if this was not a prototype I would provide a power supply that could provide at least 10A.
In practice if the regulators are supplied with 6V they can actually illuminate the full display for short (a few seconds) periods.
The demo display routine never has all of the displays on full at once.
ControllerThe controller is a PIC32 with the ByPic operating system installed. This makes it easy to program the controller remotely (because all it needs is text) and carry out what-if scenarios over the Bluetooth link.
The controller also provides the 3.3V required for the Bluetooth transceiver as it has an on board regulator.
The BV500_T controller with PCB
The controller board uses lines B0 to B8 to control the LED strips. The clock/data signal is derived by careful software timing. The WS2811 LED controller only requires one line to control each LED strip and so only 8 lines are needed for all 8 strips.
An I2C interface is obtained from B8-B9, when I2C is used these lines are dedicated to the I2C interface by the PIC32 hardware. This interface is used to communicate with the real time clock, the RTC clock PCB has built in pull up resistors so these are not needed separately.
Power to the board is via the +5V pin derived from one of the regulators and the 3.3V output is used for the Bluetooth transceiver. The Bluetooth is connected to TX and RX shown on the diagram as B10 and B11. This in-fact is UART2 and is the main communication for the ByPic software. All of the development and programming can be done via Bluetooth if required. If not there is a separate connector on the left hand side of the board for this purpose. It is unfortunate that the Bluetooth does not put out a DTR signal that can be used to reset the processor from time to time.
This is a ByVac product BV206. A cheaper product could be used but with the cheaper versions it is not always possible to access the AT commands. With access to the AT commands you can change the Baud rate of the Bluetooth module to match the native baud rate of the BV500 which is 115200. The alternative is to use the SYS_COMBAUD constant to match the BV500 to the Bluetooth. Quite often they are fixed to 9600 which is a bit slow for development.
Having the Bluetooth module enables the display to be programmed after it has been built and in situ. It could be high up on a wall and you would still be able to access it.
An improvement would be some kind of reset hardware in case something went wrong. There is a watchdog on the BV500 that could be implemented but it would be good if say an independent bit of hardware detected a particular character or sequence of characters from the Bluetooth and exerted reset. This would not be difficult to implement.
RTC (Real Time Clock)
This is not necessary to the operation of the device but it seams that a good use for the display for some part is to use it to display the date and time. The device used is the BV4239 which is based on the DS1307
This also has an EEPROM which is not being used. This device has a built in battery and requires 5V and an I2C interface.
The LEDs come on a strip of flexible PCB as shown and 8 strips of 40 LEDs have been used to create the rectangular display. They are normally bought in lengths of 4 or 5m but be warned that they are manufactured in smaller strips. Why is this important? The 4 or 5m lengths consist of several strips joined together, unfortunately some distance is lost when joining the strips and so where the join occurs the LEDs are closer together. This matters when creating a display as the LEDs will not line up. They need un-joining and re-joining with some wire to ensure that the distances between the LEDs are maintained.
For this display the strips were stuck down onto a piece of 3mm acrylic 85mm x 670mm using 6mm double sided tape. The connections were made to the left hand side of the display with the LED strip arrows pointing to the right. Using double sided tape works very well but more though is needed on mounting the acrylic to a frame as at the moment it is a bit Heath Robinson.
Step 2: Framework
The frame is constructed of 20mm angle aluminium mitre cut and soldered using HTS-2000 which can be done with a standard gas blow torch, no specialist equipment needed.
The layout can be seen looking at the back of the display. The equipment has simply been stuck to the acrylic using double sided tape and nearly all of the wiring is DuPont type leads just plugged into pins. The black strips that can be seen is the double sided tape (the type used for sticking on number plates to cars) sticking the LED strips to the acrylic.
Because of the long signal wires to the LED strips and because the signals are at 400kHz a ferrite ring has been used to keep the interference down. I am not sure if this is really necessary but it is there anyway.
BlutackThe LED strips you may have noticed are white which is not really a good background colour for a display, black is better. Before the front acrylic was put in place a tiny amount of blutack was put over each of the 320 LED windows and then a matt black spray paint was used before removing the blutack.
It takes a long time but considerably enhances the display. The final touch was to use an ink jet printer to print on some overhead transparency a grey colour. The actual colour used was 80,80,80 (RGB). This produced a grey / black film that was cut and placed over the LEDs. They are very bright and so this does not effect the LEDs but does mask the background quite well.
As an alternative tracing paper could be used or get the front acrylic cover sand blasted to make it ‘frosted’
Step 3: Software
At the start of the text is the display showing “Colour” and 3 squares with each letter of the word a different colour. The final program to do this is here:
The function ‘putc’ will place a character on the display as follows:
putc(character,position,foreground colour,background colour)
This shows just two of the functions, there are others such as drawing boxes, lines and text scrolling from the left.
The software is built up in layers which makes it easier to understand and develop. The following is a description of each layer and how it works.
LED DriverThere is a full description of driving these addressable LEDs at http://www.bypic.co.uk/projects/colour-addressable-leds/ however a recap will not go amiss.
The WS2811 controller needs just one wire, the signal is sent from LED to LED at a specific pace (frequency) and so the timing is important. The devices used in this display are 400kHz which according to the data sheet is half speed, full speed is 800kHz
The 1’s and 0’s are sent as above where the transition from H to L occurs before half way for 0 and after half way for 1. The actual timing for the frame or cell is 2500nS for 400kHz. For the BV500 running at 40MHz this is 24 CPU cycles so it is arranged that 1 is 16/8 cycles (high/low) and 0 is 8/16 cycles (high/low).
This is done by delaying the timing loop with nop or dummy instructions. I have seen the SPI interface used for this purpose but can’t understand why?
The next step up is to supply the LED with three bytes that will describe the colour, the order is green, red and blue, the higher the number the brighter that particular colour. For convenience the three bytes are placed into a 32bit integer and there are as many integers as there are LEDs so for a strip of 40 LED’s there will be 40 32bit integers. A ByPic array is conveniently used to store these and a two dimensional array is used because there are 8 strips, one dimension for each strip.
Because the timing is critical it is handled directly in C, via a function plug-in. ByPic can call a function and pass information to it. The function handles the critical timing sending the data that is passed to it. Fortunately the LEDs retain their status and so the plug-in only needs to run when there is an update. This is called render() which will update all 8 strips.
Illuminating an individual LED is simply a matter of setting the array value to the required RGB and then rendering it by calling the function render(). The size of the array is larger than 8x40 as some of the first bytes in the array are used to tell the plug-in which port and lines to use so the actual first LED on strip 1 is disp(7,0).
Higher levelsThe next set of functions initialize the array and take care of displaying characters. The character shapes are formed using 5 bytes and are displayed as a 5x7 cell on the display. I already had the font file and so made use of it.
A slight complication is the scrolling, instead of displaying the whole character at once it is possible to just display one column of it, this is what makes scrolling possible.
There are 7 programs in all, listed at the back of this text. Apart from the RTC each one relies on function in the previous one. This could have all been placed in one program but by doing it this way it makes development much easier.
As an example there is a graphics program that draws lines and boxes etc. By having the basic functions in place, in Flash it was easy and quick to develop and get right these functions without having to load all of the previous functions over and over again. By the same token the ‘effects’ program was developed after the graphics program using some of the functions in the graphics program.
PitfallsAs previously said this display is a concept and so if you intend to build something like it then the following are things to watch out for.
Dead LEDs: The display I built has 3 dead LEDs – not completely just one colour. It was not something I expected and so did not check for. Before using a strip make sure ALL of the colours work.
LED distances: I was under the impression that when you bought a 5m string of LEDs that it was all one strip, not so. The LEDs are joined at intervals by soldering the copper parts of the PCB together. The joint causes the LED spacing to vary and so these need to be de-soldered and soldered at the correct distance.
Construction: Acrylic on an aluminium frame works well but the 20mm angle I used is not really deep enough to house the components.
Power supply: If the small 5V regulators are used then one per two strips are required, they are cheap enough to do this but would take up some space. Ten amps is quite a hefty linear power supply and so I would go for a switching supply. The alternative mentioned in the text is a lithium battery and a wall wart type charger. This could still be a problem though as I guess that the average current drawn would be in the region of 2-4A
ImprovementsLots; but probably a good idea is to include a DCF radio time module and temperature / humidity sensor.
Step 4: Finally
Building & PartsThe project is reasonably expensive due to the cost of the LEDs, the parts here do not include any hardware.
6m of WS2811 Addressable LED strip approximately £70.00 (eBay)
1 x RTC – BV4239 £5.40 (www.byvac.com)
1 x Bluetooth BV206 £12.95 (www.byvac.com)
1 x BV500_T_k2 controller and PCB £9.90 (www.byvac.com)
2 x BV106 Power regulators £1.81 each (www.byvac.com)
DuPont connecting wires £0.50 (eBay)
The BV500_k2 has no USB module but the k3 (£13.90) does so if you do not already own a USB to serial convertor go for kit 3 or develop using the Bluetooth. The only disadvantage with the Bluetooth is that it cannot reset the controller which will definitely be needed from time to time. The resent in this case is carried out manually.
Building & SoftwareThe software required for this project is here and the URL can be pasted directly into the text load dialog box on BV_COM
After each download type flsave(“”) and this will save each program to flash. At his point in time it should be possible to test the display thus:
The above will fill the whole display with a dim light, CDIM is defined as colour(10,10,10) which means that each LED colour is set to 10.
All of the above files are text and so can also be viewed in a browser. As an alternative they can be downloaded to local files.
The last file contains the function ‘main’ which if saved using flsave(“”) will run when the processor is reset or powered up. There is a get out; if any key is pressed then it will exit the function.