Simple STM32 based USB to DMX512 Interface


Simple STM32 based USB to DMX512 Interface

A simple and compact USB to DMX512 interface based on the STM32F042F6 microcontroller (20 pin TSSOP) is presented. The main intention for this project was to check out the DMX capabilities of STM32 microcontrollers.

DMX commands and power supply are provided via USB. It is seen by a host PC as a MIDI interface or as a virtual COM port.
Accordingly, DMX control is possible by MIDI messages as well as by ASCII text based commands. As a special case, the MiniDMX protocol is implemented, which is supported by a number of DMX control software, for example "DMXControl3".
A similar USB to DMX interface with the same command set but upgraded with DMX control by Art-Net via Ethernet is described at this website.

board assembly photo
Assembly of the simple STM32 USB to DMX interface (top and solder side view). Compact board size 43x30mm.

The USB interface is "full speed USB2.0" grade. The host sided USB class selection between MIDI and virtual COM port is made by a jumper on the SWD connector (may be extended to a switch). The 5V supply (total current no DMX load ca. 20 mA, with terminated DMX bus up to 50 mA) is scaled down by a linear low drop regulator to 3.3V which supplies the microcontroller.

In MIDI as well as in ASCII mode,

  • The commands are designed in a way that manual DMX control is possible with ASCII terminal software or with a MIDI sequencer.

  • commands are provided to set any of the 512 DMX channels to any level 0..255

  • perform soft fade transitions with fade time up to 12.7 seconds, adjustable in steps of 1/10 seconds

  • limit the number of transmitted DMX channels between 24 and 512

  • Read the actual levels of specific DMX channels back to the control software.

  • save up to 13 lighting scenes nonvolatile in the microcontroller flash and reload any by command. (Scene no. 0 is automatically loaded after power up.)
The MiniDMX protocol is well suitable for complex lighting operations controlled by special lighting software.

When USB works as virtual COM port, a special setup mode is available to configure the basic MIDI channel and user specific USB Vid/Pid. The user setup is stored nonvolatile in the microcontroller flash.

Because no RS-232 interface is installed on the board, the board is programmed (and debugged) via SWD ("Serial-Wire Debug") interface, preferably with ST-LINK, which is connected to the 3 pin socket next to the USB connector.

The firmware was developed with EmBitz 1.11. This source code is quite well suitable as a template for further own development, especially concerning DMX and USB. It is programmed directly on register level, no external libraries or drivers are used.

A detailled construction- and operation manual is provided here (PDF file).

Downloads:
The subsequently downloadable material is copyrighted (c)2017 by Wolfgang Schemmert.
Assembly and use of the device is permitted for free by everybody for any purpose ("freeware").
All information is based on best knowledge, but "as is" and without any warranty. Any responsibility is excluded.

PCB layout for the STM32-UsbDmx board (1:1 TIF format, mirrored view "from component side" for PCB reproduction)

Firmware "stm32-usbdmx13.hex" for the STM32-UsbDmx interface (Version 1.3 , 13 October 2017)

Source code "stm32-usbdmx13.zip" for the STM32-UsbDmx board (status 13 October 2017)
This source code is provided as complete "EmBitz1.11" project (ZIP file, 608 kB). Parts published by EmBitz are under license of Embitz, parts published by STM are under license of STM, parts programmed by me are provided under GNU GPL3 license.



* State of information October 2017.
* Right of technical modifications reserved. Provided 'as is' - without any warranty. Any responsibility is excluded.
* This description is for information only. No product specifications are assured in juridical sense.
* Trademarks and product names cited in this text are property of their respective owners.