Fun Stuff: Controlling a Blink(1) with blinkserver

Background

This quick tutorial will show you how you can control a Blink(1) device.  The device could be plugged in to the local computer, or it might be on the same (or remote) network – so long as you can access the computer via TCP, you should be ok.

The tutorial is based around using a Raspberry Pi running Raspbian, but this has worked on a Pi running Kali as well.

Setting Up

Firstly, make sure your Blink(1) is plugged into the device and you have downloaded (or compiled) blink1-tool.  I found that blink1-tool worked fine on Raspbian, but needed to be compiled on Kali for it to work correctly.

You can test blink1-tool is working by running:

sudo ./blink1-tool --rgb ff0000

To turn the LED to red.

Run:

sudo ./blink1-tool --off

To turn it off.

Once you know the blink(1) device is working correctly, download blinkserver and unzip it into your home directory.  If done correctly, you should have a new folder in your home directory called blinkserver-x.x (where “x.x” is the version of blinkserver you downloaded.

Next, copy blink1-tool you downloaded above into the blinkserver-x.x folder.

Now, navigate into the blinkserver-x.x folder.  You should see the follow files:

blink1-tool
blinkserver.py

Running Blinkserver

From the blink server-x.x folder, launch the server by running:

python ./blinkserver.py

By default, blink server will start listening on TCP port 8888.  If you want to change this, you can run:

python ./blinkserver.py port

Where port is the TCP port number of your choice.

Blink server should start up and you should see the following appear in the console:

[Info] Now listening for incoming requests on port 8888.

Blinkserver is now up and running!

Testing Blinkserver

To test Blinkserver, launch a web browser (either on the local machine or on a different machine) and enter:

http://[server name or ip]:8888/v1?mode=glimmer&rgb=ff00ff

Where [server name or ip] is the name or IP address of the machine.  If you launched blinkserver using a different port, you’ll need to change the 8888 to that port.

For my set-up, my blink(1) is connected to a Raspberry Pi with IP address 192.168.5.50 so I entered:

http://192.168.5.50:8888/v1?mode=glimmer&rgb=ff00ff

With any luck you should see the blink(1) glow purple a few times!

You can read more about blinkserver here, and there’s a tutorial for getting Snarl to control a blink(1) device here.