Opening knc: the Depth Camera Controller UI

knc user interface

I’ve been working hard on a YouTube project lately, which I’ll blog about later. For now, I’m pleased to announce that I’ve opened up the source code for Nitrogen Logic’s Depth Camera Controller browser-based UI, called knc.

knc is a Ruby- and EventMachine-based service that serves a dynamic browser-based UI (HTML, CSS, JS) for controlling Nitrogen Logic automation systems and Philips Hue lights using the Kinect.

What knc does

knc talks to my previously released knd for Kinect camera support, and provides xAP protocol and Philips Hue support. The xAP protocol allows common DIY automation systems like Homeseer to respond to 3D presence events, using knc. knc also serves the frontend UI over http.

Check out the project’s README file for more information.

Also released

In addition to knc itself, some C-based extensions were released as gems, and new versions of existing gems were released:

  • nl-fast_png configures libpng for the fastest possible 8-bit grayscale encoding of depth images, allowing the UI to run well on the limited hardware in the original Nitrogen Logic controllers.
  • nl-knd_client uses some C functions from nlutils to accelerate parsing of zone data from knd.
  • nlhue provides the EventMachine-based interface to Philips Hue lights.
  • xap_ruby provides xAP protocol support.

Running and using

Running knc is as simple as installing its dependencies (including knd and nlutils), then running its main script.

1
2
bundle install
KNC_SAVEDIR=/var/tmp/ ./knc.rb

knc log output

Then you visit http://localhost:8089 in your browser to see the UI:

knc user interface

You can use the state of zones you create in the main UI to control Philips Hue lights using simple if/then rules. Especially useful if you don’t have a Nitrogen Logic Automation Controller.

knc rules interface

What’s next

I’ll continue opening more Nitrogen Logic code as the days/months/years go by and I find the time. Until then, check out my current YouTube project, which I’ll write more about soon, and enjoy knc!