Giter VIP home page Giter VIP logo

dmx's Introduction

USB-DMX512 Python Module

This python module supports actual the following USB-DMX interfaces (FT232R chip based):

  • EUROLITE USB-DMX512 PRO Cable Interface (Link)
  • EUROLITE USB-DMX512 PRO Interface MK2 (Link)

Requirements

  • Python โ‰ฅ 3.6
  • numpy
  • pyserial

Note: Tested on Windows 10, amd64, Python 3.8
Should also work on Linux, MacOS and on AARCH64 devices (ARM devices like Raspberry PI).

Installation

Make sure to have git, python and pip in your environment path or activate your python environment.
To install enter in cmd/shell:

git clone https://github.com/monzelr/dmx.git

cd dmx

pip install .

Alternative with python:

python setup.py install

Example Code Snippets

If you want to dim 4 channels up and down:

from dmx import DMX
import time

dmx = DMX(num_of_channels=4)
dmx.set_data(1, 0)
dmx.set_data(2, 0)
dmx.set_data(3, 0)
dmx.set_data(4, 0)

while True:
    for i in range(0, 255, 5):
        dmx.set_data(1, i, auto_send=False)
        dmx.set_data(2, i, auto_send=False)
        dmx.set_data(3, i, auto_send=False)
        dmx.set_data(4, i)
        time.sleep(0.01)

    for i in range(255, 0, -5):
        dmx.set_data(1, i, auto_send=False)
        dmx.set_data(2, i, auto_send=False)
        dmx.set_data(3, i, auto_send=False)
        dmx.set_data(4, i)
        time.sleep(0.01)

If you want to add your own adapter or multiple adapter by serial number:

from dmx import DMX

dmx = DMX()
my_device_serial_number = dmx.use_device.serial_number
del dmx

my_device_sn = dmx.use_device.serial_number
del dmx

dmx2 = DMX(serial_number=my_device_sn)
dmx2.set_data(1, 100)
dmx2.send()
time.sleep(1)
del dmx2

Technical notes

to EUROLITE USB-DMX512 PRO Cable Interface / EUROLITE USB-DMX512 PRO Interface MK2 :

  • uses chip FTDI232R (like EUROLITE USB-DMX512 PRO Interface MK2)

  • the FTDI FT232R updates the DMX automatically - you do no need to refresh the DMX universe by yourself

  • if you only have 4 channels, set them at the DMX address start (1 to 4), thus sending updates to the FT232R chip is faster

  • 250000 baudrate for the FT232R is a must

  • needs 5 start bytes: [0x7E, 0x06, 0x01, 0x02, 0x00]

    • byte 1: signal start byte 0x7E
    • byte 2: TX DMX packet: 0x06
    • byte 3 & 4: LSB of DMX length (in this case 513 -> do not forget address 0): 0x01 and 0x02
    • byte 5: address 0 of DMX signal: 0x00
  • supports only label 6: TX DMX Packet

  • needs one end byte [0xE7]

Building the documentation

Go into the dmx root folder (where setup.py is) and type in the following command in the cmd/shell:

python setup.py build_sphinx

The documentation can than be found in dmx/build/sphinx/html.

dmx's People

Contributors

monzelr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

dmx's Issues

No connection on Buster64

Hi,

Thanks for this project! I am trying to get the MK2 to work on Buster64, but so far no luck.
Do you maybe have a hint on what to check?

Thanks for your time

Can't install

I am unable to install using the instructions provided.

Sphinx has no module "sphinx_setup.command"

I found no solution for this error:

`
pi@ola:~/dmx $ pip3 install .
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing /home/pi/dmx
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /tmp/tmps9usjuq4_in_process.py get_requires_for_build_wheel /tmp/tmpta2n02m0
cwd: /tmp/pip-req-build-d23qjsp4
Complete output (15 lines):
Traceback (most recent call last):
File "/tmp/tmps9usjuq4_in_process.py", line 280, in
main()
File "/tmp/tmps9usjuq4_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/tmp/tmps9usjuq4_in_process.py", line 114, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-1loa7x9a/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/tmp/pip-build-env-1loa7x9a/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-1loa7x9a/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 311, in run_setup
exec(code, locals())
File "", line 51, in
ModuleNotFoundError: No module named 'sphinx.setup_command'

WARNING: Discarding file:///home/pi/dmx. Command errored out with exit status 1: /usr/bin/python3 /tmp/tmps9usjuq4_in_process.py get_requires_for_build_wheel /tmp/tmp ta2n02m0 Check the logs for full command output.
ERROR: Command errored out with exit status 1: /usr/bin/python3 /tmp/tmps9usjuq4_in_process.py get_requires_for_build_wheel /tmp/tmpta2n02m0 Check the logs for full command output.
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.