Dmx interface for raspberry pi

From BitWizard Wiki
Revision as of 18:24, 5 April 2016 by Rew (talk | contribs) (→‎OLA)
Jump to navigation Jump to search

Introduction

The DMX interface for raspberry pi allows you to interface a raspberry pi with DMX hardware.

There is also a version "with FT245" That version adds the option to use your raspberry pi with our board as an Enttec USB Pro compatible device from another computer (raspberry pi or PC, Windows or Linux)

software

There are several software packages that can be used with your DMX interface for Raspberry pi.

First there are QLC and OLA. These are packages that run on Linux on the raspberry pi and allow you to control a DMX Universe.

Second, there are several packages by Arjan van Vught that use the raspberry pi "bare metal".


QLC and OLA

Don't forget to remove the console and getty from the serial port that the DMX inteface is using.

See: http://elinux.org/RPi_Serial_Connection#Preventing_Linux_using_the_serial_port


QLC

todo

OLA

On raspbian jessie installing OLA is easy: apt-get install ola should do the trick. The downside is however that it doesn't work :-( .

what does work however is:

mkdir ola
cd ola
https://github.com/OpenLightingProject/ola/archive/0.10.1.tar.gz
tar xvfz 0.10.1.tar.gz
cd ola-0.10.1
autoreconf -i
./configure 
make -j 5
sudo make install

On Wheezy, adding

deb   http://apt.openlighting.org/raspbian  wheezy main

to /etc/apt/sources.list, and then the apt-get install ola should work.

There are some important hints at: http://opendmx.net/index.php/OLA_Device_Specific_Configuration#UART_native_DMX

Most importantly: add:

init_uart_clock=16000000

to your config.txt file in the /boot directory.

Next, you need to configure ola to use the native-uart plugin. This is described at: http://www.raspberrypi-dmx.com/raspberry-pi-ola-dmx512-sender

Locate your ola-uartdmx.conf (on some systems I'm told it is in /etc/ola/conf/, on others /var/lib/ola/conf/). Edit it and set enabled to true, set the correct device (ttyS0 on rpi3, ttyAMA0 on others), and add /dev/ttyAMA0-break = 100 and /dev/ttyAMA0-malf = 100 . It should then look like:

/dev/ttyAMA0-break = 100
/dev/ttyAMA0-malf = 100
device = /dev/ttyAMA0
enabled = true

Then set the board to output mode. I would recommend creating a small script (sudo nano /usr/bin/set_dmx_mode; sudo chmod 755 /usr/bin/set_dmx_mode) :

#!/bin/sh
# set_dmx_mode
echo 18 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio18/direction
echo $1 > /sys/class/gpio/gpio18/value

then calling the script:

sudo set_dmx_mode 1

I recommend putting that line in /etc/rc.local so that it gets executed at boot time so you don't have to worry about it. (IIRC there is an "exit 0" in there, so don't put it AFTER that!)