boxysean / beaglebone-DMX

Library to turn BeagleBone into a DMX interface
32 stars 15 forks source link

Output DMX from your BeagleBone

DMX is a standard in the lighting industry and is used in applications from architecture to art installations to stage production.

Build instructions

  1. build pasm by cding into pasm/pasm_source and running the appropriate pasm build script (linux, mac, windows)
  2. type make in the project's root directory

Features

How to run: Software

  1. Run modprobe uio_pruss
  2. Launch DMX server: cd into bin and run ./dmx
  3. Launch DMX client: run a DMX client script, e.g., cd contollers; python cycle.py

How to run: Hardware

  1. Make this circuit.
  2. Connect pin 3 of the BeagleBone's P8 header to the input (pin 4) of the IC.
  3. Connect pins 5, 6, and 7 to ground, signal, and signal inversion respectively to target unit.

image of DMX circuit

You can change the Bone's pin by editing the defined pin in src/dmx.c and recompiling.

DMX Server Protocol

The DMX server expects UDP string packets in the following format:

N <value1> <value2> ... <valueN>

N refers to the number of channels, and valueI is the value of the Ith channel, an integer between 0-255. A single space is expected between the values, and there should be no space after the last value.

Send these packets to port 9930 on the BeagleBone. You can change the port by editing the variable in src/dmx.c and recompiling.

Production Mode

It's possible to make the DMX client and/or server launch when the BeagleBone boots up. Follow these instructions.

Benchmark

BeagleBone rev A6 running both the DMX server and a DMX client written in python. The client sends 1000 updates messages back-to-back, changing all 512 channels.

root@beaglebone:~/workspace/beaglebone-DMX/controllers# time python performance.py 1000

real    0m11.088s
user    0m8.610s
sys     0m0.120s

1000 frames updating all 512 channels takes 11.088s, which is about 90 FPS. No packet drops by the server.

How it works

This library takes advantage of the BeagleBone's PRU (Programmable Realtime Unit). The DMX server passes the DMX values to the BeagleBone's PRU, which is constantly bit-banging the DMX protocol in realtime. (Read more.) The hardware circuit converts the bit-banged protocol into RS-485, which is what all standard DMX units expect.