For the python script, I used the python module, PySerial to communicate to the port. As I couldn’t get PySerial to work on Windows 7, I decided to write a quick VB app. I added to the app the ability to send faulty start bytes, to allow channels to have the same value as the start byte, and to allow a false checksum to be sent. The box passed the test every-time.
I needed a way to get Discolitez to send dimmable values via serial, and adhere to the protocol I devised. A breakthrough came when I learned that Discolitez Pro had a way to pipe UDP packets out through a network socket. I fired up Wireshark and found the packet it was generating was 18 bytes in length.
Out of the 18 bytes, 16 represent 8 channels. Each channel is represented by two bytes that represent an 8-bit value. For each channel, the first of the two bytes represent the first nibble of the value, and the second byte represents the second nibble. The nibble is sent in plain text as ascii. So “0-F” will be sent. By combining the first and second nibble, an 8 bit value of the channel can be determined.
The 17th byte will always be 0x0D, and the 18th byte will always be 0x0A.
Using this knowledge, I wrote a script that took in the UDP packet, interpret it, and spit it right back out to serial using my protocol. The results were great! ^_^
Although… I found that the frequency bands didn’t allow for too much uniqueness, and I was limited to use Winamp as my audio player.
I decided I wanted a way for the code to work wirelessly, so I found a guide to get UART out of a WRT54G series router. Using the SD-Card hack, I was able to install Python and run my script off of it.
–UDP over Wifi w/ WRT54G-TM SD Card and Max232n
Late night a few weeks later, I was on a Skype video call with my friend, and FamiLAB member, “Tetsu” Dan, and showed him a floor lamp I had hooked to my light dimming box. I forwarded the UDP port through NAT on my home router, and challenged him to code a home automation webapp for my iPod touch.
A short time after corresponding back and forth, he was able to control my lamp using the sencha touch api for NodeJS. I am very pleased by the results. The video screen capture below was recorded that night:
Lastly, Hardware based music sync.