Color Changing Christmas Lights
I like the idea of a string of lights controlled by wifi. It's an internet of lights (IoL)!
Other people's projects
Model: GE G-35 iTwinkle WiFi (36 lights)
Cost: about $60 at Costco
Power Supply (5V 3A):
The hardware seems fine. The wifi chipset has a Rayson mac address but I haven't looked at the CPU because the screws are annoyingly triangle.
They draw 0.11A/7W with a power factor of 51% with the lights on (measured by a Kill-A-Watt). and 0.04A/2W with the lights off.
The app is bad. It directly changes your wifi settings to do its work. This didn't work on my Samsung phone, but worked most of the time on my Nexus 10 tablet. The reviews of the app reflect this and other problems (see the next section) - the Android App has 36 one star reviews out of 70 total (with a final score of "2.3" stars). The iPhone App seems to have 2.5 stars with 7 ratings.
Various problems with the design
When I first installed their app, it had an option to have the lights join your wifi network. It "scans for free IPs" by doing DNS lookups (which is not how you actually find unused IPs). There was no way to tell it what IPs to use or to have it use your DHCP server. The lights have their own DHCP server, and it continues to answer even when it joins your wifi network, which is a big problem. The lights did not like my long wifi password, so I had to change it to something shorter. It took several tries to get it half working. Possibly because of these problems, the feature to have the app program a wifi network into the light string was removed, and now you can only connect to the light's wifi SSID.
I've never received a software bug report via mail before. But this means they're working on improving it at least.
When you connect to the wifi SSID it creates (default password "2015"), you can control the lights from the app but you have no internet till you disconnect from the light's SSID. That's annoying, but it works better.
The app saves the light's SSID as a wifi connection to automatically use. This is annoying when your tablet/phone auto-connects to it instead of the internet.
I configured the lights with the app to join a SSID I created for just this device. I setup tcpdump on the AP to capture the traffic. After that, it was simply a matter of comparing the network traffic to how the lights reacted.
The commands are sent over UDP to port 1281, and they are 20 bytes long.
The general form of a command looks like this:
[CC] = two hex characters for the command (see below for known values),
[II] = two hex characters for the intensity (00=off, fe=full on),
[BB][GG][RR] = two hex characters for blue/green/red for the commands that take a color (00=black, 0f=full color).
The app seems to send the command five times. There's no ack in the protocol, so this is probably to avoid packetloss problems.
|Command||Description||Uses Color and Intensity?|
|01||change color, keep current pattern||yes|
|09||slow per bulb transition to new color?||?|
|18||color for custom color set?||yes|
|20||change speed||intensity = speed, no color|
|21||fade in/out, note: accepts cmd=01||no|
|22||white light moves through||yes|
|24||middle to edge bounce color cycle pattern||no|
|25||"lightning", note: accepts cmd=01||yes|
|26||per bulb rainbow cycle "marching"||no|
|27||randomly choose patern?||?|
|2a||per bulb rainbow cycle "fading"||no|
|e0||end custom color programming?||?|
|e8||send remainder of colors for custom color set?||?|
|ee||start custom color programming?||?|
There are 8 patterns (21,22,23,24,25,26,28,2a) as well as the random mode (27) and the custom color set mode (18+ee+e8+e0)
When chaining sets together, they send what looks like a timestamp every second over udp port 1281 to the next strand's IP address. I'm guessing this is to synchronize the clocks so they go through the patterns at the same rate. It almost looks like a unix timestamp, but the device probably doesn't have a battery backed RTC so the time is wrong.
kleCTT1436038702 kleCTT1436038703 kleCTT1436038704
An example command line way to send command 28 (solid color), intensity fe (full brightness) and color 0f0f0f (white) from a Linux machine (say, a raspberry pi). 10.1.5.150 is the IP of the lights in this example, but it'll be different for your setup.
echo -n "kleCMD28fe0f0f0f(&'+" | socat stdio udp-sendto:10.1.5.150:1281
Timestamp of Patterns:
0:00 - fade in/out
0:15 - moving light
0:30 - moving darkness
0:47 - middle to edge bounce pattern
1:05 - lightning pattern
1:19 - marching rainbow
1:36 - solid color
1:51 - fading rainbow
Custom Color mode example
TODO: finish this
green + red with random patterns
15? 17? colors - double check sequence