I got a new monitor, and got a new cheap LED strip to stick behind it. This one though isn't the same as my old Triones / HappyLighting one and identifies itself as ELK-BLEDOM and the app is called duoCo Strip. I did find a project on github which provides some commands that can be sent to control the lights though.
Some examples are at the bottom of the page

To be able to talk to the LED strip I first needed to find its Bluetooth address, that can be done using sudo hcitool lescan which will keep on displaying the addresses of any device which is ready for a connection. In my case, the address is BE:58:50:00:54:15. CTRL-C will stop the lescan.

$ sudo hcitool lescan
LE Scan ...
BE:58:50:00:54:15 ELK-BLEDOM   
BE:58:50:00:54:15 ELK-BLEDOM   
BE:58:50:00:54:15 ELK-BLEDOM   
BE:58:50:00:54:15 ELK-BLEDOM   
^C
$

Once you have the address of the device you can connect to it using gatttool in interactive mode with the command sudo gatttool -I. It needs to be run as root otherwise it won't work, at least it didn't for me. At the [LE]> prompt you can connect to your device and get its characteristics

$ sudo gatttool -I
[                 ][LE]> connect BE:58:50:00:54:15
Attempting to connect to BE:58:50:00:54:15
Connection successful
[BE:58:50:00:54:15][LE]> characteristics 
handle: 0x0002, char properties: 0x12, char value handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0005, char properties: 0x10, char value handle: 0x0006, uuid: 0000fff4-0000-1000-8000-00805f9b34fb
handle: 0x0008, char properties: 0x06, char value handle: 0x0009, uuid: 0000fff3-0000-1000-8000-00805f9b34fb

After a bit of playing around I found out that the handle 0x0009 was the one I wanted to be sending commands to. According to the github project above, each command is 9 bytes starting with 0x7e 0x00, ending with 0x00 0xef and the actual command in between. Some examples are:

    Power on: 0x7e, 0x00, 0x04, 0xf0, 0x00, 0x01, 0xff, 0x00, 0xef
    Power off: 0x7e, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0x00, 0xef
    Set color: 0x7e, 0x00, 0x05, 0x03, 0xRR, 0xGG, 0xBB, 0x00, 0xef                 where R, G, B are the red green and blue values in hex
    Set brightness: 0x7e, 0x00, 0x01, 0xZZ, 0x00, 0x00, 0x00, 0x00, 0xef            where ZZ is the brightness value as hex

So to set the color to red, then blue, you would send the following commands to gatttool

$ sudo gatttool -I
[                 ][LE]> connect BE:58:50:00:54:15
Attempting to connect to BE:58:50:00:54:15
Connection successful
[BE:58:50:00:54:15][LE]> characteristics 
handle: 0x0002, char properties: 0x12, char value handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0005, char properties: 0x10, char value handle: 0x0006, uuid: 0000fff4-0000-1000-8000-00805f9b34fb
handle: 0x0008, char properties: 0x06, char value handle: 0x0009, uuid: 0000fff3-0000-1000-8000-00805f9b34fb
[BE:58:50:00:54:15][LE]> char-write-cmd 0x0009 7e000503ff000000ef
[BE:58:50:00:54:15][LE]> char-write-cmd 0x0009 7e0005030000ff00ef

The brightness command seemed to work, but it's not quite right and if you set the value too low you need to use the mobile app to get the lights to work again.

You can also send the commands directly from the command line (without using interactive mode) which would be useful when you want to change your LED strip settings from a shell script. This can be done using the --char-write-req option.

Examples

Here are some examples for quickly changing the LED strip color from the command line

$ sudo gatttool -b BE:58:50:00:54:15 --char-write-req -a 0x0009 -n 7e0004f00001ff00ef # POWER ON
$ sudo gatttool -b BE:58:50:00:54:15 --char-write-req -a 0x0009 -n 7e000503ff000000ef # RED
$ sudo gatttool -b BE:58:50:00:54:15 --char-write-req -a 0x0009 -n 7e0005030000ff00ef # BLUE
$ sudo gatttool -b BE:58:50:00:54:15 --char-write-req -a 0x0009 -n 7e00050300ff0000ef # GREEN
$ sudo gatttool -b BE:58:50:00:54:15 --char-write-req -a 0x0009 -n 7e0004000000ff00ef # POWER OFF

Previous Post Next Post