PLEASE NOTE: This site is no longer being actively maintained. For frequently updated BeagleBone resources please visit Beaglebone.org.

Tuesday, May 20, 2014

On 7:08 PM by Unknown

Overview

Logic Supply's CBB-Serial cape includes an RS485 transceiver, which can be used to generate DMX512 messages to control lighting. In this tutorial we will learn how to hook up and control a DMX512 RGB light.

What You Will Need

Hardware

Start by following the Getting Started steps in the CBB-Serial manual. Ensure that the J7 jumper is in the GPIO1_16 position:

Next, with both the BeagleBone and the light powered off and unplugged, connect the GND, RS485A and RS485B signals on the serial cape's screw terminal to the male end of the XLR cable:

With everything connected, first power on the BeagleBone, then plug in and power on the light. Ensure that your light is set to DMX channel 1 (consult your light's manual to configure it's channel settings).

Software

Our example DMX512 software uses the PyBBIO Python library, so start by following the PyBBIO installation steps here. DMX uses a non-standard baud of 250000. The PySerial library didn't support non-standard baud rates before version 2.7, so use the Python package manager pip to make sure it's up to date:
On Angstrom:
  # opkg update && opkg install python-pip
Or on Debian / Ubuntu:
  # apt-get update && apt-get install python-pip
Then:
  # pip install --upgrade pyserial

Next you'll want to fetch the example code from Github. It's easiest to download it directly to your BeagleBone from the command line:
  # cd ~
  # mkdir dmx_demo && cd dmx_demo
  # wget --trust-server-names http://git.io/742LlA
  # wget --trust-server-names http://git.io/EBd3Lw

You should now have the dmx512.py module, which provides a DMX512 object, as well as the dmx_test.py program, which demonstrates how to use it. Run the demo program with:
  # python dmx_test.py
The program will run through a few tests, and if your light is hooked up correctly it should look something like this:


You can use the PyBBIO template and import the dmx512 module to write your own DMX program, for example:
from bbio import *
from dmx512 import DMX512

dmx = DMX512(Serial4)

def setup():
  pass

def loop():
  d.addData(1, 255)
  d.send()
  delay(1000)

run(setup, loop)
which will set the red channel to full brightness. Check out the documentation inside dmx512.py for more usage instructions.