Skip to content

uoaerg/dmx-arduino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This repository contains the full source code and hardware designs for the
Arduino shield used for teaching DMX at the University of Aberdeen. The Arduino
Mega 2560 compatible shield allows an Ardunio to operate as either a DMX bus
master or slave.

The dmx-arduino Board (Rev I and II) was designed by Cyril Danilesvski in 2014.
The software was written and was updated by Tom Jones, 2015-2017.
The software is updated by Gorry Fairhurst, 2020-2023.

# Uploading the code

Open the Arduino project from dmxcontroller/dmxcontroller.ino.

Import the libraries from the libraries/ into the Arduino IDE. It is
important that you do not allow the Aruduino IDE to update these libraries.

Compile and upload.

# Operation

Program mode and DMX addressing are controlled by the 12 dip switches on the
main sheild PCB. Program status is indicated using the three LEDs in most
program modes or using additional LEDs on the DE9 connector in other modes.

There is a default program that can is used in any empty slot in the program
mode. This program will only blink the green LED.

The RED LED on the board provides the DMX status. If valid DMX data has been seen
on the bus, then DMXTIMEOUT will flash the red LED. If no valid DMX data has
been seen for 1 sec this LED will be lit solidly. This functionality operates 
outside the control of any of the programs.

When the main loop of the program detects a change in program mode the green
LED will be flashed momentarily. This flash can be difficult to see when
turning off DIP switches, but is easier to see when turning on DIP switches.

## DIP Switches

The 12 DIP switches form a 12-bit number with the MSB starting with switch 1.
The program mode is encoded in the top three bits of the DIP switches and the
DMX address is encoded in the bottom 9 bits.

                  1 1 1
1 2 3 4 5 6 7 8 9 0 1 2
P P P D D D D D D D D D


The software has 8 modes (3 bits):

0 - DMX Controller
1 - Digital Output Control
2 - PWM Control 
3 - Servo Control
4 - Neopixel Strip Control
5 - Stepper Motor Control
6 - Unused.
7 - Long Strip Control


0 - DMX Controller Mode
	The programmed DMX address will be displayed on the 8 DE2PINs with the 9th
	bit displayed on the green LED.

	If a DMX address of 0 is selected on the DIP switches, the slot sequence
	0x55 0xFF 0x0F 0xF0 will be output for the first four DMX slots.

	In controller mode, the program will read from a 10K pot connected to POT_PIN. The
	10bit value from the ADC will be scaled (divided by 4) to fit with in a DMX
	byte. If this value is greater than 128, then the yellow LED will be lit. The
	scaled value from the pot. will be written to the DMX bus at the slot set by the DMX
	address.

1 - Digital control
	Eight DMX channels will be read from the bus. If the DMX value is
	greater than 128, then the corresponding DE2PIN will set high.

	The yellow LED shows the status of channel 1.

2 - PWM Control 
	The first eight DMX channels will be read from the bus. The corresponding
	DE2PINs will be given a PWM values from the DMX value.

	The yellow LED shows the status of channel 1.


3 - Servo Control
	The servo will be driven to a position based upon the DMX value at the selected
	DMX address.

	The yellow LED shows the status of channel 1.

4 - Neopixel Control
	An encoded colour value will be read from a set of DMX slots. Each *byte*
	encodes an RGB value. These values are split out then set to an attached
	LED strip using the Neopixel Library. These are sent as a time division
	multiplex as 3 serialised 8-bit colour values using the assigned pin.

	The yellow LED shows the status of channel 1.

5 - Stepper Motor Control
	An encoded stepper motor control value will be read from a set of DMX slots. 
	A set of 2 slots control the speed of rotation of the stepper motor and direction.
	A set of 2 slots sets an index position, and then controls the relative angle to 
	the indexed position. The rotation controls also control the speed of movement.

7 - Long Neopixel Control
	As mode 5, but with the timing adjusted to allow a long strip to be driven.

	The yellow LED shows the status of channel 1.