Labels

lego (12) Linux (39) pi (20) Thinkpads (4)

Tuesday, 17 December 2013

USB WebMail Notifier [day 4 of 20-days-of-posts series]

I picked a few of these USB WebMail Notifiers from TheSource (made by Dream Cheeky).  They are common, places like DX carry a multitude of them cheaply.  The local store had them on clearance for less than a dollar.



The model number is 8003037.

The raw USB device information is:
DEVTYPE=usb_interface
DRIVER=usbled
PRODUCT=1d34/4/2
TYPE=0/0/0
INTERFACE=3/0/0
MODALIAS=usb:v1D34p0004d0002dc00dsc00dp00ic03isc00ip00in00

The instructions for the device: http://www.thesource.ca/sitelets/gadgetree/downloads/8003037_om_en.pdf

It comes with a mini-CD for installing drivers for Windows XP.

The designed use of the device is to flash different colours based on various email incoming alerts.

It's a basic USB device.  There are several cross-platform projects, most implemented in Python, since USB device driver support is extensive in Python.  One such project is https://github.com/konker/dreamcheeky_notifier

If you are using Linux, you can control the device using the /sys/devices/..

If you do a search for a handler call "green" such as find /sys | grep green, you should find where the device is located.

On my system I get /sys/devices/pci0000:00/0000:00:1a.1/usb2/2-1/2-1:1.0/green.  For the device, there should be inputs blue, red and green.  Each input represents the lighted value for that colour.  The value accepts input values from 0-255.  In actuality, each colour has effective values from 0-100, 0 representing off and 100 representing maximum light intensity.

Either through a Python script using the PyUSB device driver, a developer's open-source offering or by controlling the colours manually with the device driver, you can use the device for an infinite number of applications.  You can essentially use the device as a multi-coloured LED that you can turn off or flash different sequences or colours based on a set condition.  The controlled intensity makes the LED very visible.

You can control the device by echoing the value 0-100 into a combination of blue, red and green.  You'll need to first give your user ability to write to the device (sudo chmod 666 blue; sudo chmod 666 red; sudo chmod 666 green).  Then a simple echo 50 > blue would set the device to exhibit the blue colour on the LED with half intensity.

Here are two videos displaying the sequence demonstrated in the script below:

video


script: test.sh
Here is a video demonstrating the transitions from 0 to 100:


script: transition.sh

When you take the device apart, you see it's essentially a multi-coloured LED attached to a simple logic board.


For my application, I further cut the cable near the USB plug and near the logic board.  I then used a pair of scissors (carefully!) to splice away the shielding cable from the connector.  I then shaved away the shielding cable from the cut ends, spliced off the 4 wires, and soldered the two ends back together.  Heat seal tape over the solder joints (to avoid wires of different types from contacting eachother) and then heat seal tape over the bundle so that I'm left with a logic board connected to the USB connector by a short set of wires.  I then slid this into one of my raspberry pi lego cases, providing a multi-coloured LED that I can use to view various conditions on the pi (this pi runs as a headless server pi, so there is no screen attached, making it difficult at times to quickly check on things).  I use the LED programmed in a bunch of different scripts to visually display statuses to me, so I can visually see the status by looking at the unit.


A simple system LED as easy as pi ;)

No comments:

Post a Comment