All Projects → DaAwesomeP → Dmxusb

DaAwesomeP / Dmxusb

Licence: apache-2.0
DMXUSB emulates an ENTTEC-compatible DMXKing USB to DMX serial device with one, two, or n universes.

Programming Languages

cplusplus
227 projects

Projects that are alternatives of or similar to Dmxusb

Arduino Applemidi Library
Send and receive MIDI messages over Ethernet (rtpMIDI or AppleMIDI)
Stars: ✭ 177 (+168.18%)
Mutual labels:  arduino, arduino-library, teensy
Teensystep
Fast Stepper Motor Library for Teensy boards
Stars: ✭ 191 (+189.39%)
Mutual labels:  arduino, arduino-library, teensy
Adafruit ina219
INA219 Current Sensor
Stars: ✭ 129 (+95.45%)
Mutual labels:  arduino, library, arduino-library
Arduinoxinput
XInput library for USB capable Arduino boards
Stars: ✭ 126 (+90.91%)
Mutual labels:  arduino, library, arduino-library
Control Surface
Arduino library for creating MIDI controllers and other MIDI devices.
Stars: ✭ 377 (+471.21%)
Mutual labels:  arduino, arduino-library, teensy
Lpd8806
Arduino library for LED strips and pixels using LPD8806 (and probably LPD8803/LPD8809)
Stars: ✭ 207 (+213.64%)
Mutual labels:  arduino, library, arduino-library
Md max72xx
LED Matrix Library
Stars: ✭ 186 (+181.82%)
Mutual labels:  arduino, library, arduino-library
Taskscheduler
Cooperative multitasking for Arduino, ESPx and STM32 microcontrollers
Stars: ✭ 613 (+828.79%)
Mutual labels:  arduino, library, teensy
Adafruit Pwm Servo Driver Library
Adafruit PWM Servo Driver Library
Stars: ✭ 300 (+354.55%)
Mutual labels:  arduino, library, arduino-library
Md parola
Library for modular scrolling LED matrix text displays
Stars: ✭ 282 (+327.27%)
Mutual labels:  arduino, library, arduino-library
Guislice
GUIslice drag & drop embedded GUI in C for touchscreen TFT on Arduino, Raspberry Pi, ARM, ESP8266 / ESP32 / M5stack using Adafruit-GFX / TFT_eSPI / UTFT / SDL
Stars: ✭ 534 (+709.09%)
Mutual labels:  arduino, arduino-library, teensy
Brutal
Payload for teensy like a rubber ducky but the syntax is different. this Human interfaes device ( HID attacks ). Penetration With Teensy . Brutal is a toolkit to quickly create various payload,powershell attack , virus attack and launch listener for a Human Interface Device ( Payload Teensy )
Stars: ✭ 678 (+927.27%)
Mutual labels:  arduino, arduino-library, teensy
Ewma
Exponentially Weighted Moving Average Filter
Stars: ✭ 21 (-68.18%)
Mutual labels:  arduino, arduino-library
Ntc thermistor
[For Arduino and STM32] Library for working with a NTC thermistor.
Stars: ✭ 19 (-71.21%)
Mutual labels:  arduino, arduino-library
Uduino
Simple and easy connection between Arduino and Unity
Stars: ✭ 25 (-62.12%)
Mutual labels:  arduino, arduino-library
Easyntpclient
Library to read time from Network Time Protocol (NTP) servers.
Stars: ✭ 20 (-69.7%)
Mutual labels:  arduino, arduino-library
Grove bme280
Stars: ✭ 18 (-72.73%)
Mutual labels:  arduino, arduino-library
Ferret
Ferret is a free software lisp implementation for real time embedded control systems.
Stars: ✭ 878 (+1230.3%)
Mutual labels:  arduino, teensy
Button
An Arduino compatible library to make working with user input easier
Stars: ✭ 27 (-59.09%)
Mutual labels:  arduino, arduino-library
Teensy
teensy示例代码
Stars: ✭ 34 (-48.48%)
Mutual labels:  arduino, teensy

DMXUSB

License GitHub release Github Releases Downloads build status

DMXUSB implements the ENTTEC DMX USB Pro Widget API Specification 1.44 on any serial port. DMXUSB can emulate a single DMX port/universe device like the DMXKing USB ultraDMX Micro, a two port/universe device like the DMXKing ultraDMX Pro, or an n-universe DMXUSB device. All devices are compatible with the ENTTEC standard. DMXUSB works with the Open Lighting Architecture (OLA) as a usbserial device.

Installation

DMXUSB is regularly tested on the Arduino Mega 2560 and the PJRC Teensy 3.2. Compilation tests for many more boards are completed via Continuous Integration.

Via Arduino IDE Library Manager

In the Arduino IDE, go to Sketch > Tools > Include Library > Manage Libraries and search and install the latest release version DMXUSB. If you are not using a PJRC Teensy board, then you will also need to install the elapsedMillis library.

Via the ZIP archive

Download the latest release ZIP from here or the latest testing release from here. Then go to Sketch > Tools > Include Library > Add ZIP Library. If you are not using a PJRC Teensy board, then you will also need to download and install the elapsedMillis library.

Usage

Currently, the library only receives DMX messages from a PC over USB. Please take a look at the Simple_Test sketch for a complete example.

DMXUSB (serial, baudrate, mode, callback, outUniverses, serialNum)

The DMXUSB class initializes a new instance of the library. The outUniverses argument is only required for mode 2. The serialNum argument is also not required. Example:

DMXUSB myDMXUsb(Serial, 115200, 0, myDMXCallback);

serial (Stream)

Any Stream-based serial port. On my Arduino-like boards, Serial is the USB serial port. If multiple classes are initialized, then multiple serial ports can be used.

baudrate (int)

The baudrate of the serial port or stream. The library assumes that the serial port or stream is opened with this baudrate in setup().

Note that one raw DMX port runs at 250 kbps (250,000 baud). It is recommended to use the maximum available reliable baudrate for your device. Set the mode setting below accordingly with consideration for the error rates of your device.

Also note that the USB serial on Teensy boards always operate at 12 mbps regardless of setting. You should always set the baudrate to 12,000,000 baud for Teensy devices.

mode (int)

The type of device to emulate:

value description
0 A standard ENTTEC-compatible device with one universe output that emulates the UltraDMX Micro (ESTA ID: 0x6A6B, Device ID: 0x3)
1 A DMXKing two-universe device that emulates the UltraDMX Pro (0x6A6B, Device ID: 0x2)
2 A DMXUSB n-universe device similar to the DMXKing two-universe device (requires the outUniverses argument) that is in development and not yet supported by OLA (0x7FF7, Device ID: 0x32)

The following table shows which universes receive callbacks when different commands are sent to DMXUSB. When label 6 is received in all modes, the callback will be called multiple times and output to all universes as per the DMXKing specification.

mode label (command type) universe 0 universe 1 universes 2 through n
0 6 Yes No No
0 100 No No No
0 101 No No No
0 102 through n No No No
1 6 Yes Yes No
1 100 Yes No No
1 101 No Yes No
1 102 through n No No No
2 6 Yes Yes Yes
2 100 Yes No No
2 101 No Yes No
2 102 through n No No Yes

Note that mode 0 only responds to ENTTEC label 6 and outputs to universe 0 in the callback. When mode is 1 or 2, label 6 outputs to either universe 0 and 1 for mode 1 and universes 0 through n for mode 2 (the callback is called multiple times). This mimics the DMXKing specification. With mode 1, label 100 outputs to only universe 0 and label 101 outputs to only universe 1.

callback (void)

A callback function to call when a DMX transmission is received. This function should have three parameters:

parameter description
int universe An integer starting at 0 with which universe received the DMX message
char buffer[512] The array of 512 DMX values starting at 0

Example function that lights an LED with channel 1 on universe 0:

void myDMXCallback(int universe, char buffer[512]) {
  for (int index=0; index < 512; index++) { // for each channel, universe starts at 0
    int channel = index + 1; // channel starts at 0, so index 0 is DMX channel 1 and index 511 is DMX channel 512
    int value = buffer[index]; // DMX value 0 to 255
    if (universe == 0 && channel == 1) analogWrite(LED_PIN, value); // LED on channel 1 on universe 0
  }
}

outUniverses (int)

The number of output universes. This parameter is required only when the mode is 2. The number of output universes defaults to 0 if mode 2 is used and this parameter is not set. This argument is ignored for modes 0 and 1.

The maximum number of theoretical universes is found with the following equation:

(maximum universes) = [(device baud rate) / (250,000 baud)] - 1

You must subtract one as seen above because there are a few extra bytes in every DMX packet when sent over USB with this library. This equation does not take into account CPU time and load or how long it takes to process the data or run the rest of your program. With this math, the Teensy can theoretically achieve 47 universes!

serialNum (uint32_t)

If you are using multiple devices on one computer, then you should use unique serial numbers. Unique serial numbers will be applied by default for Teensy LC/3.0/3.1/3.2/3.5/3.6 devices when this argument is not included or it is set to 0xFFFFFFFF. The default serial number is 0xFFFFFFFF for non-Teensy devices. This should be a uint32_t.

DMXUSB.listen ()

A function of the class that causes the library to check for messages. This function is typically called at the top of loop(). Example:

void loop() {
  myDMXUsb.listen();
}

DMXUSB Device Specification (mode 2)

The DMXUSB Device extends the DMXKing UltraDMX Pro specification in the following ways:

Labels 100 through 100 + n

Label 100 will send to universe 0, label 101 will send to universe 1, label 102 will send to universe 2, etc. Sending to more universes than are configured in out_universes or are responded with the Extended Parameters message is simply ignored.

Label 53 Extended Parameters

Sending an empty message with label 53 will respond with the label 53 Extended Parameters Message with the following data:

  1. Number of output universes (one byte)
  2. Number of input universes (one byte)

More data may be added to this packet in the future.

References

This library was built using the following sources:

License

Please see the LICENSE file

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].