Sunday, January 5, 2014

Walgreens 15 C9 Multi-color Light Show LED Christmas light hack

Overview

After Christmas I purchased a few strands of the Walgreen "15 C9 Multi-color Light Show" LED Christmas lights (WIC 276754; UPC 049022715905).  These have 15 individually addressable LED lights (3 sets of 5 LEDs arranged as red, green, blue, orange, white).  If you can find them on sale for a few dollars, they are a great deal.

The packaging available at Walgreens
BriteStar version of the same light set



The lights are apparently manufactured by BriteStar (www.britestar.com).  Unfortunately they have very little info on their website.  It appears that they intend to sell these and other similar light sets directly but they are not quite there yet.  Maybe by next Christmas season?

Seeing these lights in the package with the little "Try Me" button made it very obvious that the bulbs were individually addressable.  The brief demo in the package provides a few patterns.  I was immediately curious if they could be hacked to do other things.  Turns out that the protocol is very simple and easily implemented with an Arduino.

Tear Down

A quick look at the string revealed several interesting things.  First, there was a transformer at the head of the string labeled 5V at 500 mA.  That seemed promising.  Second, there was a small box, near the transformer that had two lines (presumably power) going in and out of it, plus a connector for the "Try Me" button on the outside of the package.  The first bulb in the series had two wires going in and three wires going out.  That seemed interesting as well.

Hardware

I started by pulling apart the small box next to the transformer.  My initial thought was that this might be the controller for the strand.  Alas, that was not the case.  In fact, this little box is only there to provide the connection point for the "Try Me" button and is otherwise useless.  However, it might provide a good place to slip in a controller (such as the Arduino Pro Mini) later!

Input for Try Me button
Closeup of the board mounted in the box

A quick test with the VOM confirmed that the strand ran on 5V DC (as listed on the transformer at the head of the strand).

Next I pulled apart the first bulb in the strand.  Inside I found a gold mine.  There was a simple board with two wires (power) coming in and three wires going out.  Two wires were obviously the power and that left one for signal. In addition to the inputs and outputs there was a bonded processor and an LED.

First bulb in the string (red)
with an added input interface wire (white)
Back of the board
I pulled apart the second and third bulb in the strand and found that the output of bulb one goes to the input pins of bulb two.  Likewise, the output of bulb two goes to the input of bulb three.

Protocol

The next step was to reverse engineer the protocol between the boards.  First I hooked up the trusty DSO Nano to confirm that the third line was a data line and that it was a 5V signal.

Next, I hooked up the Saleae logic analyzer and took a look at the data signals.  After looking at the data for a bit it became obvious that there were basically two packets being sent; an "on" and an "off".  Below you can see the output of the first three bulbs.  It is clear that each board forwards it's previous state on to the next bulb after receiving a new packet.

The top line is an "on" packet (note the 4 'wide' pulses at the end).
The second line is an "off" packet (note the 4 'short' pulses at the end).
It was also obvious that we had a very simple protocol going on.  The string of lights is basically a big shift register.  Each light stores whatever it is sent, and forwards on it's previous state to the next board.  Thus, we can keep pushing packets down the line to update the entire string.  The default firmware pushes out 15 packets each time.

Here are the specs for the packets:
  • 3 start bits, each 6.25 us (microsecond) wide high followed by 6.67 us wide low pulse
  • 4 data bits, each is either a 'wide' or a 'narrow' high followed by a 4.33 us low pulse
    • A "one" is indicated by a 3.75 us wide high pulse
    • A "zero" is indicated by a 1.24 us wide high pulse
An "on" packet consists of 4 "one" data bits while an "off" packet consists of 4 "zero" bits.  The astute reader may quickly think to themselves, "I wonder what would happen if I sent something other than all zeros or all ones."  Excellent question.

PWM capability

The default firmware on the string only uses full on or full off.  However, the boards support 16 levels of brightness.  It turns out that sending any value between 0 and 15 (LSB first) will generate increasing intensity levels in the LED.  A packet of SSS (3 start bits) followed by bits 1000 will be the dim value of 1; a packet of SSS0100 is a dim value of 2; etc.

Packets (S = start bit, 1 = wide pulse, 0 = narrow pulse)
  • SSS0000 = off
  • SSS1000 = dimmer value of 1 (dimmest)
  • SSS0100 = dimmer value of 2
  • SSS1100 = dimmer value of 3
  • SSS0010 = dimmer value of 4
  • SSS1010 = dimmer value of 5
  • SSS0110 = dimmer value of 6
  • SSS1110 = dimmer value of 7
  • SSS0001 = dimmer value of 8 (half brightness)
  • SSS1001 = dimmer value of 9
  • SSS0101 = dimmer value of 10
  • SSS1101 = dimmer value of 11
  • SSS0011 = dimmer value of 12
  • SSS1011 = dimmer value of 13
  • SSS0111 = dimmer value of 14
  • SSS1111 = dimmer value of 15 (full brightness)

Startup

You might be wondering how the first board knows it is the master.  The short answer is that if you don't see any packets on your input pin, you are the master.  A very simple startup protocol is to raise your output pin high for 150 ms (milliseconds) while looking at your input pin to see if you have an upstream neighbor (who would be doing the same thing on their output pin).  If you don't see anything on your input, then you must be the master.  

There is also a failsafe in the system that if you do not see any input for approximately 20 seconds, you should become the master.  Likewise, if you begin seeing valid packets on your input, you go into slave mode and start doing whatever you are told.

Below you can see the 150 ms wide high pulse on the left that occurs at startup.  The wide white areas in the center of the display are the first regular packets being sent

Startup protocol zoomed way out (note the scale at the top of the chart).
At startup, the master sends 10 sets of "off" packets.  It appears that if a board has no current state, it simply consumes a packet and does not send anything.  You can see this in the following capture.  Each white bar represents an entire packet.  I zoomed out so you can see the cascade of the first three bulbs as packets are being sent.

Startup packet sequence

New Controller

After discovering the basics of the protocol, I quickly created an Arduio program to simulate the protocol and started controlling the string myself.  Since the Arduino doesn't directly support this protocol I had to bit bang the line.  My ultimate goal is to be able to run multiple strings of lights from a single Arduino.  Since the times are so short (as small as a single microsecond) I had to disable interrupts during the packet transmission.

Source Code

Source code for a class implementing the protocol and a quick test program is available in github.

Interpacket gap

The default firmware waits about 1.13 ms between sending packets.  This gives more than enough time for a packet to propagate all the way to the end of the strand.  This seemed wasteful to me so I shortened the gap to 100 us.  It seems to work just fine.

New Arduino based controller showing 100us interpacket gap

Followup

If anyone has suggestions for improvements please let me know.  Also, if you implement this in a project I'd love to hear about it.  Please post in the comments below.

26 comments:

Vatsal said...

CMH grow lights come in both warm and cool color temperatures. With less radio frequency (RF) interference than LEDs, these lights are more efficient than other HIDs of the same wattage.

vinish said...

I would like to value the time the author has taken to share this content with us. The author has focused on a single topic and explained it in detail. Keep sharing more in the future.
Sign Board Manufacturers in Chennai | Sign Boards Chennai | Signage Chennai Metal Letters Chennai | LED Sign Boards in Chennai | Name Board Makers in Chennai

Nathan William said...

One of the most prominent issues the students have to deal with while writing assignments is plagiarism. Hence, they extensively use plagiarism checker to check if there are any copied content in the paper.Choose Myassignmenthelp.com.
Another major reason for using plagiarism checkers is that universities do not accept plagiarized content. Plagiarism is a serious offence. Hence, if found, the students are suspended or might even lose the grades.
Due to these limitations, it is evident that the plagiarism checking & wordcounter tool are not at all effective to check plagiarism. The term plagiarism is actually very broad. It is merely not coping with words. But these tools, unfortunately, detect words but not ideas. Hence, the chances of plagiarized papers remain.

rickypauls said...

It is very effective post regarding Assignment Help. Many times, students could not able to get required information for composing their assignments which hampers their performance. If you are in same situation, do visit greatassignmenthelp for great support.
Assignment Help Online
Online Assignment Help
Assignment Help Online Services
Assignment Helper
Assignment Assistance
Assignment Help Experts
Online Assignment Help Services

Michael Jones said...

If you are also perplexed by the same situation, here we have few tips for your assignment help and with the help of these tips you can easily make your assignment.
Assignment help online

Online Assignment help

Programming help

myassignmenthelpau said...

I suggest everyone to choose Assignment Help Australia for getting the best guidance in their academia. The proficient experts assist as per the requirements and learning styles desired by the university.

rickypalm said...

Thanks for updating the post! Your post has shared all essential information of Assignment Help very clearly. Students should opt for online assignment writing services in order to save their time. For more details regarding the best academic writing, connect with customer care services of assignmenthelpshop
Assignment Help Online
Online Assignment Help
Assignment Help Online Service
Assignment Helper
Assignment Assistance
Assignment Help Experts
Online Assignment Help Services

shashi said...

Get all the essential information about IGNOU PTS 6 Project like how to write the project, the last date to submit it and other information. Our experts will help you with all the information and even guide you to how to write the project. Bachelor of tourism consist of three project which are pts 4,5 and 6 and we offer guidance in all the project.

Nathan William said...

This study is conducted to assess Nike, Inc. reviewing the four major aspects of concern. Nike, Inc. is listed on NYSE with offices located all over the world. A Nike swot Analysis helps review its strategy and its performance against all the external and internal factors. It includes Strengths, Weaknesses, Opportunities and Threats. They are known as the basis of its short-term and long-term strategic direction.

Assignment help Australia said...

Order now for Australian assignment help by assignment experts who are always ready to serve you with every kind of paper writing service. The writer assigned for academic help are subject-specific and have expertise in providing the work to the students come diverse of universities.

My Assignment Help Australia | AllAssignmentHelp

Assignment Help said...

Assignment help
is the major key to the success of many students. They are becoming more affordable as there is competition in the writing industry today.

Stacy Kelly said...

Thanks for great info! Quicken you have the rights to change or update your profile’s information. Do you also want to update your Quicken ID profile information in a swift way? Well, there is nothing to worry because you can easily deal with your Quicken ID profile and edit information such as password, phone number, address and the Quicken ID itself. In doing so, if you need some additional support from skilled professionals then you need to make connection with them. You can do that in both ways, either by dialing Quicken support Phone number
or via https://www.quickensupporthelpnumber.com/blog/tag/quicken-support-chat/ service. In chat service, you will get the step wise solutions for your queries.
Quicken Support Number
Quicken support
Quicken Help
Quicken Customer Service
Quicken Customer Service Phone Number
Quicken Customer Service Number
Quicken.com
www.quicken.com
quicken.com/support
www.quicken.com/support

Jessica said...

Since these assignments carry a lot of marks, students need to write to them with all their heart so that they can score better grades. Our cms assignment help assures you of higher grades and better knowledge.

Assignment Help said...

The Assignment help online
service you have been looking for is here. Click here to find out the range of disciplines we would be happy to help you with.
java Assignment help

Alisah Wilson said...

All assignment help UK is a leading assignment help service provider in UK. We provide Law Dissertation Help UK student. Contact us and you will get 100% original & quality content at affordable price.
Assignment Help

myassignmenthelpau said...

MyAssignmnetHelpAu providing students Assignment Help. If need Assignment Help. Then Contact our expert team. Our professionals follow a standard assignment writing style and make sure that there are no spelling or grammatical mistakes in your assignments. Our expert available 24*7. You have also visited our website.

ammie said...

Being an academic writer from past 5 years providing assignment writing services to college and university students also associated with Myassignmenthelp platform. I am dedicated in providing best online academic writing services to the college students at the affordable rates.

Epson Support said...

Does your printing job is interrupted by Epson Error Code 0XF1? Well if so, then you don’t need to panic, you can get the proper solution at your fingertips. The Epson printer Error 0XF1 is a very critical error that you encounter within your Epson Printer. This error restricts your printer to accomplish a printing command sent by the computer. This crops up mainly due to the entry of damage registry in your computer. When you turn your Epson printer on, the printer head is unable to read either from the left side or from the right side or while it is initiating the printing process. Anyhow, you have to terminate this error code if you want to print your documents. For this, you can take aid from skilled technicians via dialing helpline number.
Epson Printer Error Code 0x97

Epson Error Code 0x97

Epson windows service disabled error

Epson wireless printer setup

Epson printer offline

Epson Printer in error state

Epson Support

Epson Printer Support
Epson Printer Not Printing

Marie Claire said...

Avail html assignment help from Assignment Desk today and get exclusive offers and amazing discounts.

ammie said...


Studies show that around 56% of all students consider their homework as the most primary source of stress in their life. It is no wonder then these students constantly think of ‘who can do my homework ’ in UK. Fortunately for them, we provide expert homework help at very reasonable prices. Recent research has also revealed that on average students between the ages of 6 to 17 have to spend a little more than three and a half hours each day of their school life doing homework. Our aim is to cut the time you spent doing your homework by more than a half by offering homework online services in UK to students. We offer you with several extraordinary benefits that make us the best choice for you. Homework help uk

personal statement writing
ghostwriter
coursework help

Writing essays can be both time consuming and hectic. This is why most students hate the task. If nothing else is constant in your life, essay writing is what will take the place. MyAssignmenthelp.com has the best essay writing service for you. If you cannot perfect your papers or don’t know how to write a winning essay, then our service is what you need.

uk essays
essay writing service
essay typer

singapore assignment help said...

The essay writer at SingaporeAssignmentHelp.com are specialize in providing excellent essay help to a student in all the academic discipline. We have masters and Ph.D. writers in our team that work hard to deliver quality assignments.

ammie said...

Dissertation writing can be the most complicated task you undertake during your student life. Based on this paper, your university is going to decide whether you are eligible for receiving your final degree or not. So, the dissertation paper that you are going to submit has to be impeccable. Wait, do not get nervous. We are here to provide you top-notch help with your dissertation.
dissertation help


MyAssignmenthelp.com, you can totally get the perfect ghost writers who can be the real essay helpers in your academic career. You do not have to think about your any assignment work once you have chosen us. Our service has a pool of ghostwriters in UK who are actually expertise in these fields.


Confused about how to cite a source in the Harvard referencing generator? Fear not, we are here to help you. Every informational source used in a piece of writing needs to be cited using a referencing style correctly. Now, it often becomes very complicated because how one resource will be cited depends on the type of source, the number of authors, the writer's name etc. But if the referencing style is used incorrectly, a good portion of the total score can get deducted.

daisythomas said...

Hire Our assignment writers for College Assignment Help service under your budget with 100% plagiarism free and Error Free work. StudentsAssignmentHelp.com provides instant services at affordable prices. Our Assignment services help to improve your grades. get your first order with 10% discount on any assignment booking. For more information contact here- +44-755-536-9184.

Alex Kim said...

Singapore translation services have a unique identity to distribute Academic translation services to the Singaporean and abroad country students. Our high experienced translators are always ready to provide meticulous, plagiarism-free translation work in small pocket pinch.

Assignment help Australia said...

Writing articles is a big deal, I know better but your skill of writing is amazing, editing proofreading service

Jennie Rohe said...

Hi, this is a nice blog thanks for sharing the Informative blog. my assignment help provide the mba essay writing singapore for a assist to student queries. Our writers conduct thorough research to provide you with a flawless sample of mba essay writing singapore. My Assignment help brings do my Consumer Behavior assignment .Writing an elaborate do my Consumer Behavior assignment is anything but easy and most students lack the tenacity to work on the details accurately. If you get the more details Please visit the site through Link.