Skip to content

YoshiRi/PyDMX

Repository files navigation

PyDMX

Python based DMX control demo program.

Requirement

  • USB-RS485 Converter
  • PySerial
  • wxPython (only for fader)

I used DTECH USB-RS485 Converter.

to instal pyserial, try

pip install pyserial

for the GUI fader, wxPython is used.

pip install wxPython

How to use

PyDMX.py

PyDMX.py contains simple DMX control class.

For the instance create the connection like below:

from PyDMX.py import *

dmx = PyDMX('COM3') # for Linux use '/dev/ttyUSB0' or something

then, you can set '255' value in the address '1' as following:

dmx.set_data(1,255)

Finally use send() function to send dmx signals.

dmx.send()

Communication option

Here shows option in the constructor.

  • Option Name (Default Value)
    • COM (COM8): Comport device name. Check it on your device manager.
    • Cnumber (512): DMX channels number. DMX512 protocol uses 512 channel.
    • Brate (250000): Baudrate. Usually do not need change.
    • Bsize (8): Bite size decided by DMX512 protocol.
    • StopB (2): Stop bit number decided by DMX512 protocol.

You can add these options like a following example.

mydmx = PyDMX('/dev/ttyUSB0',Cnumber=1,Brate=9600)

save and load past data

To save and load past DMX data, you can try following option.

  • Option Name (Default Value)
    • use_prev_data (False): Set True if you want to preserve and load past DMX data.
    • preserve_data_name ("preserved_data.txt"): saved data file name.

PyDMX_fader.py

PyDMX_fader.py contains the GUI fader class named Controller().

You can just run this program as a fader.

python PyDMX_fader.py <fader channel number>

The default fader channel number is 4.

You may see following window after putting the COM port.

Program flow

DMX is a kind of serial communication. See Japanese explanation here.

You need,

  • 250kbps baudrate, 1 startbit, 2 stopbit
  • Break(LOW) Longer than 88us
  • MAB(High) Longer than 8us
  • startcode before data

For Debugging

DMX Break length and MAB length are not rigidly defined. You'll need to change these parameter depends on your devices.

About

DMX Controller for USB-RS485 Adaptor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages