Introduction: MIDI2DMX

Control DJ lights and LEDs from any software or hardware that can transmit MIDI

Most content in a more terse form is on GITHUB: https://github.com/jmej/MIDI2DMX

This project was developed to facilitate curriculum at Portland Community College for the Music and Sonic Arts department.

This is an easy (and inexpensive / ~$40) way to get total control over a wide variety of lights - using existing music software (ableton live, logic, bitwig, garage band, pro tools etc). It also allows for easy interfacing with programming environments like Pure Data, MaxMSP, Processing and other languages.

It's great for sequencing lights for live music performances, doing algorithmic light programming, mapping sound analysis, data from the internet, or sensor data to any number of low cost lights.

This unlocks cheap DJ lights, turning them into flexible and expressive tools/instruments.

Tasteful light shows for live techno sets are easy with this.

It turns out that it's pretty hard to find a good, well supported, inexpensive DMX controller.

There are a lot of expensive DMX controllers with proprietary drivers. There are a lot of cheap DMX controllers with little or no documentation. (Although these days a lot of them are copied from the uDMX project). Some of them work intermittently, some work only on windows, and some work only with specific (unexciting) DMX control software.

The uDMX project is the only well documented open source option out there, but in my experience - it's not that good. It suffers from choppy framerates and frequent drop outs, and on top of that, all the units I tried became unresponsive fairly often in a variety of software applications. There is a fundamental design flaw: it relies on your computer to send DMX frames. If your computer is processing audio (from Pure Data or Max for instance) - you end up with pretty severe audio dropouts. Also your DMX framerate suffers due to varies computer and USB bus performance issues.

Being a huge fan of the Teensy microcontroller boards - I reached out to the designer, Paul Stoffregen, who kindly shared some simple, fast and reliable DMX code that runs well on the Teensy. (The code is available on step 3!)

I then programmed the Teensy to be a USB midi device, and to translate midi cc's into DMX channel values. (Mapping CC numbers directly to DMX channel numbers). Midi is my preferred control protocol for most things - because such a huge variety of software can send and receive.

I've been using this solution professionally quite a bit.

In this example a teensy is not only sending out DMX to all of those LED strips, but another one is reading 9 ultrasonic rangefinders for motion detection. A single modest computer handled all of the sensor readings, DMX processing, animation design, and sound generation and processing.

I designed a PCB to make the circuit easy to build, and have assembled quite a number of them with students in my interactivity courses at Portland Community College.

These instructions will provide everything you need to build this simple, inexpensive, rock solid, and super fast usb midi and hardware midi DMX controller.

Step 1: Stuff You Need

Not counting some sort of enclosure, and some sort of lights to control - the total project cost is about $40.

For lights - you can build your own using LED strips and DMX relays. You'll also need a power supply if you go that route.

Or you can use off the shelf DMX lights like this, this, or even lights with motor controlled heads (you can control all the movement parameters with this board as well). You'll also need an XLR cable per light. Any light from any vendor that says DMX and has an XLR jack should work! It's pretty easy to find a powerful RGB par style light for around $80.

1 PCB or breadboard. You can make this circuit pretty quickly and easily on a breadboard. I prefer to use PCB's because they're more robust, easier to gig with, put in an installation, etc. They're also faster and easier to build. I designed a PCB - you can get it fabbed through OSHpark with this link. If you don't want to order 3 copies (which is the OSHpark minimum, you could also drop me a line and see if I have some.

1 Teensy USB board - I've used the 3.2, in theory the cheaper LC should also work - the pinout is compatible. I just haven't tried it.

$9 worth of parts from Mouser.

You'll also need a soldering iron, some solder, and some wire cutters.

A micro-usb cable

A computer that can run the Arduino software, and some software that can send midi.

Note to DIYers:

The XLR connector in my parts list below is meant to mount on a PCB - so you'll want to use a different jack, and work out a panel mounting solution (and a panel/enclosure) if you use a breadboard. Also - for anyone not using the PCB layout files below - even though the schematic shows a PC110 optocoupler - it is actually wired and laid out for a Sharp PC900V optocoupler. This isn't something you have to worry or think about if you're using the PCB and parts list below - but if you're designing your own PCB, or doing a build on breadboard or perfboard - keep that in mind.

Step 2: Populate the PCB

Solder the resistors, capacitors and chips on the board. This build is straightforward - you can definitely build this even if you've never soldered before. Check out Adafruit's excellent guide to soldering!

Make sure the 3 chips are oriented the right way. (the notch or dot on the small ICs should match the notch on the pcb silkscreen, the Teensy should be mounted with the USB jack facing out).

Solder the two connectors on.

Note that the hardware midi portion of this project is untested at time of writing - and also not included in the code yet. Right now this project is just tested and working as a USB midi device. The hardware midi port probably will work with a little bit of teensy programming - so go ahead and implement it if you want!

Step 3: Program the Teensy

Download the Arduino software.

Download the Teensyduino addon.

Install them both.

Download both of the attached program files and put them into one folder.

Open the midi2dmx.ino file with the Arduino program. You should see 2 tabs - one of them with Paul's DMX code (called dmx.cpp) and the other with the main arduino code.

Do the following:

Tools -> Board -> Teensy 3.2

Tools -> USB type -> Midi (this makes the device show up as a generic midi device for any software on any operating system.)

Click the upload button to program the teensy. Reset the teensy if the teensy software pops up and asks you to do so.

Step 4: Test Your Lights!

Check out the manual of your light. Make sure the light is setup to receive DMX, and take note of which DMX channels do what. There is usually a DMX implementation chart in the manual with a list of channels. Connect a standard XLR/mic cable between the light and your MIDI2DMX.

An easy way to test your controller is with the attached Pure Data patch. Download Pure Data if you don't have it. It's amazing and this is a great way to start using it if you haven't before!

Plug in your MIDI2DMX, then fire up Pure Data. That order is important - your device won't show up if you plug it in after PD has been started.

Go to the Media menu and choose Midi Settings. Select Teensy Midi from the output Devices dropdown menu. If you have a midi keyboard - choose it as an input device.

Open DMX_test.pd

Go to the Edit menu - make sure edit mode is unchecked.

Turn up the Intensity slider - and then play with the other sliders. If you have a light that (like many) responds to Red on channel 1, Green on channel 2, Blue on channel 3, and Intensity on channel 7 - you should see some colors. If your light needs different channels - switch into edit mode from the menu (or using cmd-e or ctl-e) and change the second term in the message boxes below the sliders to correspond with whatever channels you want to try controlling (again - this in the manual that came with your light). Copy/paste the slider - message combo as many times as you need for more channels to test.

Step 5: Do Amazing Things With Your Lights!

You can draw midi automation lanes from any DAW - just make sure you send to the right CC#'s (if your lights are like mine - cc1, cc2, cc3 and cc7). You can chain multiple lights with XLR cables, and without doing any setup - any lights that you chain together will behave the exact same way at the same time. If you manually set the DMX addresses on each light (details in your light's manual) - you can have independent control over up to 127 channels of lights. If you need even more channels - you could program the Teensy a little bit more to map specific midi channels to ranges of 127 lights. 4 channels could map to all 512 possible DMX channels. This is beyond the scope of these instructions - but is very doable!

DMX_color_presets.pd shows how to translate RGB and HSV color values into messages you can send to your lights. Google has a nice color picker tool that will give you the 3 RGB numbers you need to program any color.

hsv2rbg.pd is an abstraction that the other patches rely on. All of these pd patches need to be put in the same folder to work correctly.

DMX_color_organ.pd has a simple midi mapping using Scriabin's pitch-color associations. This patch will make your light playable from a midi keyboard (or midi sequencer). This means you can write in normal midi notes from sequencers like Ableton Live, Logic, Bitwig - as well as hardware sequencers like MPCs and Octatracks. This is my preferred method for programming custom light shows for live PA's. You just need to set PD's midi input to be the virtual output of your DAW, or the physical input from a hardware sequencer.

Finally DMX_audio_analysis.pd demonstrates pitch and amplitude tracking and translation into light color and intensity using pd. You need to make sure you have an audio input setup in PD (Media -> Audio Settings) - although the built-in mic on your laptop should work just fine. For this one to work - you need to click on the main PD window (Or choose Window -> Pd Window) and check the 'DSP on' checkbox. If you whistle, sing, or play music - pitches will be detected and turned into colors for the light - and the louder the music/sound, the brighter the light will be.

All of these patches run well on a Raspberry Pi - which is also beyond the scope of these instructions, but it's great for hardware setups!

Comments

author
chrishem (author)2016-11-30

Any reason to utilize an entire Teensy for this? The code looks pretty simple; I would think an ATMEGA328 should be able to handle it well?

author
jmejia (author)chrishem2016-11-30

It is simple, and the DMX side of things could definitely be done on an ATMEGA328. The less simple part would be programming the usb device type to show up as usb-midi (as opposed to simply using an FTDI usb interface). Showing up as a class compliant usb midi device is a critical component to the project - and that makes it worth using a Teensy. (The Teensy has a programmable USB device type.) The HW midi part would work fine - but USB midi is important. That said - the project is on github and I would welcome improvements / collaboration / issues / pull requests etc

author
chrishem (author)jmejia2016-12-01

Ah, true -- I somehow missed that USB was involved here. Thanks for the quick reply, though! :)

author
BuffaloFan32 (author)2016-11-29

Does this work with WS2812's?

author
jmejia (author)BuffaloFan322016-11-29

Hmm - you could use it with that, but you would need to do some additional work. This is meant for DMX controlled lights - so you would need to build a dmx controller for the ws2812. It's not a normal analog controlled LED - the ws2812 has a microcontroller attached to each led that needs PWM to control it. Some good details on the ws2812 are here: https://learn.sparkfun.com/tutorials/ws2812-breako...

You're also probably better off building a matrix with those (since they're individually addressable) - this project is more geared towards strips of leds that all behave as one, and have a DMX relay driving them.. or commercial lights with DMX interfaces. Per pixel control on a matrix is kind of a different beast.

author
SFS88 (author)2016-11-27

thats a really nice pcb

author
jmejia (author)SFS882016-11-29

Thanks!

author
electricitypinto (author)2016-11-26

Creative use of LED with the teensey board. Nice work!

author
DIY Hacks and How Tos (author)2016-11-26

This is a great first Instructable. You should definitely enter this in the First Time Authors contest that is currently running.

About This Instructable

3,838views

60favorites

License:

More by jmejia:MIDI2DMX
Add instructable to: