AU$ 102
pledged of AU$ 15,000pledged of AU$ 15,000 goal
9
backers
0seconds to go
Funding Unsuccessful
The project's funding goal was not reached on Sun, March 6 2016 8:24 AM UTC +00:00
Vlad ApostolovBy Vlad Apostolov
First created
Vlad ApostolovBy Vlad Apostolov
First created
AU$ 102
pledged of AU$ 15,000pledged of AU$ 15,000 goal
9
backers
0seconds to go
Funding Unsuccessful
The project's funding goal was not reached on Sun, March 6 2016 8:24 AM UTC +00:00

About

The WS2812B is an RGB LED with a built-in integrated control circuit. Each of the three LEDs in the device could be set to 256 intensity levels to create a total of 16777216 colours. Up to 1024 LEDs could be serially chained in a strip and individually controlled. This is an amazing product with limitless areas of application.

The LED uses proprietary serial interface, which requires specialized device to drive it. It could be implemented in a programmable logic device or a general purpose processor running real time firmware. 

A number of different interfaces for WS2812B are available at the moment, including popular single board computers. All of them require a relatively complex electronic controller and relatively advanced programming skills to use them. 

The goal of this project is to deliver the simplest possible way to interface with WS2812B. People with no programming skills will be able to use it in their Do It Yourself projects.

Interface specifications summary:  

1. No prior programming skills or experience are required. 

2. Implemented in a single 8-pin through-hole PIC12F1840 microcontroller, convenient for use with solderless breadboards. 

3. Single colour control of one to several thousand WS2812B LEDs via low power push button(s), switch (es) or potentiometer(s). 

4. Separate colour control of 1 to 1024 WS2812B LEDs strip via a UART interface. One simple ASCII text command is used to set individual colours of all LEDs in the strip. 

5. Could operate as a controller for simple animation sequences via additional 8-pin through-hole memory chip 23LCV1024. Two simple ASCII text commands are used to configure any animation sequences.


Areas of application:

1. Home lighting and illumination.

2. Vehicle interior illumination.

3. Vehicle signaling, e.g. daylights, combining stop lights, reverse lights and turn indicators.

4. Sign displays.

5. Animation displays.

The following schematic diagrams illustrate how to build different circuits with the PIC12F1840 interface chip. These schematics exclude the filtering, surge protection and other components, typically used in high reliability designs.

Example 1

Figure 1 shows simple lighting application. A strip of 1 to 1024 WS2812B LEDs is turned ON (all LEDs set to maximum intensity white colour) when +5V is applied. The LEDs could be turned OFF by closing the optional low power switch connected to pin 4 of PIC12F1840. If more than 1024 LEDs need to be controlled, additional LED strips could be connected to pin 7 of PIC12F1840. The number of strips is limited by the driving capability of the PIC12F1840 output pin. Additional LEDs (and strips) could also be connected to each WS2812B LED output pin.

 Figure 1

Video 1 demonstrates a breadboard circuit implementing Figure 1 schematic and controlling a strip of 144 WS2812B LEDs.

 project video thumbnail
Replay with sound
Play with
sound

Video 1

Example 2

Figure 2 shows lighting application with brightness control. A low power potentiometer R2 is used to set the LEDs white colour intensity from OFF to maximum level. More than 1024 LEDs could be controlled as explained in Example 1.

 Figure 2

Video 2 demonstrates a breadboard circuit implementing Figure 2 schematic and controlling a strip of 144 WS2812B LEDs.

 project video thumbnail
Replay with sound
Play with
sound

 Video 2

Example 3

Figure 3 shows application with 8 colours LED control. Each of the three WS2812B internal RGB LEDs could be turned OFF by closing the corresponding RED, BLUE and GREEN switch (button). This way up to 8 colours (black, red, green, blue, yellow, cyan, magenta and white) could be set. More than 1024 LEDs could be controlled as explained in Example 1.

 Figure 3

Video 3 demonstrates a breadboard circuit implementing Figure 3 schematic and controlling a strip of 144 WS2812B LEDs.

 project video thumbnail
Replay with sound
Play with
sound

 Video 3

Example 4

Figure 4 shows application with full LED colour control. The intensity of each of the three WS2812B internal RGB LEDs could be set between 0 and 255 via the corresponding low power RED, BLUE and GREEN potentiometers. This way, any of the WS2812B 16777216 colours could be configured. More than 1024 LEDs could be controlled as explained in Example 1.

 Figure 4

Video 4 demonstrates a breadboard circuit implementing Figure 4 schematic and controlling a strip of 144 WS2812B LEDs.

 project video thumbnail
Replay with sound
Play with
sound

 Video 4

Example 5

Figure 5 shows application with full LEDs colour control via UART interface. Each LED in the strip could be individually set to any of 16777216 colours. Only one simple ASCII text command is used to set all strip LED colours. The UART baud rate is set to 115200 and the flow control is RTS/CTS. The Rx input signal is where the UART serial command is sent to. The RTS (Request To Send) output is set to high (+5V) when the PIC12F1840 is ready to receive a command. The EN (enable) input has to be driven high (+5V) or left open for the command to be processed by PIC12F1840. If EN is driven low, the command sent to Rx input is ignored. The EN input could be used to select one of many PIC12F1840 interfaces (multiple LED strips) driven by a common UART interface .

 Figure 5

Video 5 demonstrates a breadboard circuit implementing Figure 5 schematic and controlling a strip of 144 WS2812B LEDs.

 project video thumbnail
Replay with sound
Play with
sound

 Video 5

The animation in the video is achieved by sending multiple commands back to back. The commands are sent from a Windows PC running PuTTY terminal emulator:

http://www.putty.org/ 

The PIC12F1840 serial interface is connected to the PC via USB to TTL-232 cable:

http://www.digikey.com/product-detail/en/TTL-232R-3V3/768-1015-ND/1836393

Here is an example of a command setting a strip of one LED to maximum intensity white colour:

S0001255255255

The above command is constructed by the following fields:

S        # strip command header character

0001  # strip length value in the range 1 to 1024

255    # green colour intensity value in the range 0 to 255

255    # red colour intensity value in the range 0 to 255

255    # blue colour intensity value in the range 0 to 255

Here is an example of a command setting a strip of three LEDs:

S0003255000000000255000000000255

The above command is constructed by the following fields:

S        # strip command header character

0003   # strip length

255     # first LED green colour intensity

000     # first LED red colour intensity

000     # first LED blue colour intensity

000     # second LED green colour intensity

255     # second LED red colour intensity

000     # second LED blue colour intensity

000     # last LED green colour intensity

000     # last LED red colour intensity

255     # last LED blue colour intensity

The “first” LED is the one at the end of the strip. The “last” LED is the one labeled as LED1 on Figure 5

All LEDs in the strip can be loaded quickly with the same colour by specifying strip length 0 followed by the colour. For example the following command will set all LEDs in the strip to maximum intensity green colour.  

S0000255000000

Any “white” characters such as space, tab, carriage return or new line are ignored by the PIC12F1840 interface. Any characters following (and including) the character # will be ignored until the end of the line is reached. The # character could be used to include comments between the command fields as in the two examples above.

Example 6

Figure 6 shows application of a simple animation controller. The additional 23LCV1024 memory chip is used to store the colour settings for of up to 16384 LEDs. The LED strip colours could be reloaded directly from the memory chip without the involvement of the UART interface. The battery connected to the memory chip is to preserve the memory content, when the +5V power supply is switched off.

Two ASCII text commands are used to program an animation sequence via the UART interface.

The first command is used to write the desired LED strip colours into the 23LCV1024 memory chip. This command could be sent as many times as needed to fill the required LED colours in the 23LCV1024 memory chip. The second command specifies up to 84 program sequences. Each program sequence will load all LEDs in the strip from a specified 23LCV1024 memory LED location. Each sequence also includes a delay time (in 50 milliseconds units), before the next sequence is loaded, allowing variable speed of animation. Every time a program sequence command is sent, it will overwrite any settings from a previous program sequence command.

 Figure 6

Video 6 demonstrates a breadboard circuit implementing Figure 6 schematic and controlling a strip of 144 WS2812B LEDs.

 project video thumbnail
Replay with sound
Play with
sound

 Video 6

The UART interface is connected to a PC in the same way as described in Example 5.

The following two commands will create and store LED strip animation that will play automatically in a loop every time after the +5V is applied.

The first command will write the colours (red and blue) of two LEDs into 23LCV1024 memory location 1 and 2 respectively:

W00001000255000000000255

The above command is constructed by the following fields:

W        # write command header character

00001 # write command start LED address in the range 1 to 16384

000     # first LED green colour intensity

255     # first LED red colour intensity

000     # first LED blue colour intensity

000     # second LED green colour intensity

000     # second LED red colour intensity

255     # second LED blue colour intensity

The following command will create a program with two sequences for a strip with one LED. The LED will blink with red and blue colours as specified with the write command earlier.

P00010000102000002040L

The above command is constructed by the following fields:

P         # program sequence command header character

0001   # strip length value in the range 1 to 1024

00001 # first sequence memory LED start address in the range 1 to 16384

020     # first sequence delay is 1 second (range is 0 to 999 in 50 milliseconds units)

00002 # second (last) sequence memory LED start address in the range 1 to 16384

040     # second (last) sequence delay is 2 second (range is 0 to 999 in 50 milliseconds units)

L         # start program sequence loop

Performance

For Example 1 to Example 4, all strip LEDs are updated 28.2 ms after a control input (e.g. LEDs ON button) changes state.

Table 1 shows the times for updating different strip lengths using the schematic in Example 5. The time is measured from sending the first command character ‘S’ to the time all LEDs in the strip are updated. The numbers (e.g. strip length and LED colours) in the command string could be encoded in ASCII hex or binary format to reduce the number of transmitted characters over the UART.

Table 2 shows the times for updating different strip lengths using the schematic in Example 6. The strip colours are first loaded into the 23LCV1024 memory via UART and the write command described in Example 6. Then the LED strip colours are read from the memory via a read command:

S0001R00001

The above command is constructed by the following fields:

S         # strip command header character

0001   # strip length value in the range 1 to 1024

R         # read command header character

00001  # read command start LED address in the range 1 to 16384

The time is measured from sending the write command character ‘W’ to the time all LEDs in the strip are updated. The numbers (e.g. strip length and LED colours) in the command string could be encoded in ASCII hex or binary format to reduce the number of transmitted characters over the UART.

Once the 23LCV1024 memory is loaded with LED colour information, it could be read as many times as needed. Reading the memory from different memory location will load the strip with different colour patterns. Table 3 shows the strip loading times excluding the write command. The time is measured from sending the strip length command character ‘S’ to the time all LEDs in the strip are updated.

The strip length command could be sent once only, followed by a series of read memory commands.

Risks and challenges

Risks:
As any software project there could be bugs not discovered during the final testing. If the project is funded, the firmware source code will be released on GitHub. Bugs discovered after the initial release will be addressed promptly.

Challenges:
Other software solutions designed for WS2812B LED strips are using primarily three serial interface techniques:
1. Bit banging.
2. On chip DMA controller streaming data to IO port
3. On chip SPI controller.

This project is codded entirely in C language without a single assembler instruction. It uses the free non optimized Microchip XC8 compiler, which is slow and using the bit banging method is not practical.

The PIC12F1840 does not have a DMA controller.

The PIC12F1840 SPI controller is not capable of transmitting back to back characters, which is a critical requirement to meet the WS2812B LED timing specifications.

The above limitations created a significant challenge to write firmware that fully satisfies the timing specifications of the WS2812B LED chip. Non trivial techniques had to be used to achieve the desired goal.

Learn about accountability on Kickstarter

Questions about this project? Check out the FAQ

Support

  1. Select this reward

    Pledge AU$ 10 or more About $7

    GitHub access to download the released firmware for the PIC12F1840 chip.

    Less
    Estimated delivery
    Ships to Anywhere in the world
    4 backers
    AU$
    Kickstarter is not a store.

    It's a way to bring creative projects to life.

    Learn more about accountability.
  2. Select this reward

    Pledge AU$ 20 or more About $14

    GitHub access to download the released firmware for the PIC12F1840 chip.

    For every multiple of $20 pledged, receive one pre-programmed PIC12F1840 chip with the released firmware.

    Less
    Estimated delivery
    Ships to Anywhere in the world
    3 backers
    AU$
    Kickstarter is not a store.

    It's a way to bring creative projects to life.

    Learn more about accountability.

Funding period

- (60 days)