Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
usb_powered_animated_christmas_lights [2014/02/11 03:13]
Joel Dare [Hubs Known to Work]
usb_powered_animated_christmas_lights [2014/02/11 03:14] (current)
Joel Dare [Hubs Known to Work]
Line 1: Line 1:
 +====== USB Powered Animated Christmas Lights ======
  
 +For a few years I've wanted to produce some animation using Christmas lights. ​ I while back I stumbled on [[http://​www.gniibe.org/​ac-power-by-usb/​ac-power-control.html|gniibe'​s page]] about controlling the power on some USB hubs.  I tried it on half a dozen hubs I had laying around and none of them worked. ​ Later, I found a Targus USB hub on eBay and purchased it.  Last night I successfully controlled the power on it's 7 ports.
 +
 +===== The USB Hub =====
 +
 +According to gniibe'​s page, USB hubs that have the power controlling hardware are rare.  I found one of the models listed as known to work and purchased it.
 +
 +===== hub-ctrl.c =====
 +
 +These hubs can be controlled by software. ​ I downloaded and compiled the hub-ctrl.c program presented on gniibe'​s page. I've now published it on [[https://​github.com/​codazoda/​hub-ctrl.c|Github]]. ​ Before compiling it, I needed to install libusb-dev under Ubuntu. ​ I installed that with the following command.
 +
 +  sudo apt-get install libusb-dev
 +  ​
 +You'll also need the GCC tool chain. ​ I already had that installed. ​ Then, to compile the hub-ctrl.c program I ran the following compile command.
 +
 +  gcc -o hub-ctrl hub-ctrl.c -lusb
 +
 +That results in an executable binary called hub-ctrl. ​ You can control the power on a port using the following command.
 +
 +  sudo ./hub-ctrl -h 3 -P 1 -p 0
 +  ​
 +That says to control hub 3 (-h 3) port 1 (-P 1) and to turn the power off (-p 0).  You can also use "-p 1" to turn the power back on.
 +
 +You can also specify the USB device based on the BUS and DEV numbers. ​ Use the following command the list the currently connected devices. ​ It's useful to run this with the device disconnected and then again with the device connected so that you can tell which device is the one you are trying to target (the Targus in my case).
 +
 +  lsusb
 +  ​
 +Now that we know the BUS and DEV numbers, we can control the power using those numbers as well.  Here's the command for that.
 +
 +  sudo ./hub-ctrl -b 001 -d 005 -P1 -p 0
 +  ​
 +This time we are controlling the device on BUS 001 (-b 001) device 005 (-d 005) port 1 (-P 1) and turning the power off (-p 0).  ​
 +
 +===== The Lights =====
 +
 +USB provides 5 volts of power for each port.  Christmas lights are generally 2.5v per bulb. [[http://​michaelbluejay.com/​batteries/​dc-christmas-lights.html|Michael Bluejay]] has a site about powering Christmas lights with battery power. ​ Based on that information,​ you can get 6v strands of battery powered lights or you can create your own by wiring two bulbs in series (5v) and then string together as many of those as you like.  His website shows the wiring diagram if you want to build your own 5v light strand.
 +
 +===== Hubs Known to Work =====
 +
 +Here is a list of USB Hubs known to support USB Port Power Control.
 +
 +  * D-Link-DUB-H7-High-Speed-7-Port (Old version: Silver)
 +  * Elecom U2H-G4S
 +  * Sanwa Supply USB-HUB14GPH
 +  * Targus, Inc. PAUH212
 +  * Hawking Technology UH214
 

comments powered by Disqus
usb_powered_animated_christmas_lights.txt ยท Last modified: 2014/02/11 03:14 by Joel Dare