Mayday, mayday! We are blinking!

Logo-v2

For some time now, we at Mayflower can have slack time on every second friday. All colleagues who do not have urgent projects for our customers can choose to improve their knowledge, do some opensource development or just try out something cool and nerdy.

The Idea

blinkenpi-spot

First, we ordered some Raspberry Pis to test out their capabilities. Since we developed the new Steinigke webshop, we have a good source at hand for light and sound equipment. So we settled for some DMX experiments together with our customer.

The Plan

blinkenpi-raspi

We knew that DMX is a well-documented, developer-friendly protocol. We also knew of a really active project having a nice DMX library already ported to run on a Raspberry Pi. So we decided to start by trying to talk to a spotlight.

We assembled the neccessary parts:

Assembly

blinkenpi-andy

Starting up a Raspberry Pi is rather easy. The images listed on the OLA Raspberry page are outdated, but a short look into the crystal ball directed us to an image maintained by Simon Newton, who also has a leading role at the OLP. After downloading the image, we started it up with Qemu just out of curiosity, and also to change the default hostname.

We did not need to connect a monitor to our Raspberry Pi, since it got an IP adress easily via DHCP. The Raspbian image has an active sshd preconfigured. Since our DHCP server also does some DNS magic, we got our blinkenpi box up and were able to talk to it by name in no time.

Talking to the PAR-24 was a little more trouble after connecting it with the DMX adapter to the Raspberry’s USB. We read a lot and tried almost everything, but in the end we noticed we had the neccessary stuff already on board. There were just two things to do, prevent the cdc_acm linux kernel module to grab the devices and tell udev what to do with them.

In this snippet, plugdev is the group that gets the device, so the standard user should be a member of this group so we do not have to care about permissions later on. Vendor and product id can be determined from the output of ‘dmesg’ after the devices have been connected.

Starting up the software

blinkenpi-ola

If the OLA daemon does not run correctly, it might be because it runs as root, so in some cases we just had to stop the daemon and run it as unprivileged user instead. Now we had a web interface running, waiting to be configured. We needed to add a “universe” there and tell it to connect to the light effect via USB.

This yielded a large array of sliders (255 of them), so we needed to consult the manual for the PAR-24. After finding the right knob, we already were able to turn up the strobe and flash our colleagues.

Lighting up the office

The first step to programming the PAR-24 was to look at what the webinterface does. It calls a REST interface, reporting or polling every slider value, all the time.

blinkenpi-torbenmartin

The manual told us that three sliders for every LED on the PAR-24 represent one individual RGB value. Knowing this, we could activate single pixels by calling set_dmx and feeding back an updated array.

We then tried two things. There also is a set of command line tools to get and set the values; we wrote a script to play a little animation painting pixels with a php script that can be triggered from the shell or possibly from a browser. Torben started building a node.js server that can be talked to, so setting values would be more flexible.

Results

From the project, we learned a couple of things

  • Setting up a Raspberry Pi to talk to a DMX device is rather eacodesy, thanks to the Open Lighting Project.
  • DMX is different than HTTP, the signal needs to be sent constantly, or the spotlight turns off again.
  • Talking to a PAR-24 to do something it’s not already programmed to do is also not very hard
  • Connecting the server to a mobile app is not out of reach
  • The spot has some predetermined programs, everything else needs some work. Creating a universal user interface and a way to create and store custom programs will be neccessary to fully utilize the PAR-24.
  • The 255 sliders are a bit unwieldy, in a setup with multiple light effects, a better visualization is needed. Also one user interface for different light effects would really be handy.

Für neue Blogupdates anmelden:


Ein Gedanke zu “Mayday, mayday! We are blinking!

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.