DMX slave?

This post is part 2 of 6 of  LEGO and DMX

Controlling DMX fixtures with EV3 is cool but what I really want is creating my own LEGO fixtures – like the bubble maker.

The USB DMX adapter is great for generating DMX messages but I was in doubt if it could be also used to receive DMX messages since most DMX interfaces that allow TX/RX make use of some kind of microcontroller to reduce overhead.

Nevertheless I decided to give it a try. The cable uses a FTDI FT232R chip that is supported by PyFtdi for speeds up to 3 Mbps and the DMX “only” requires 250 kbps.

First attempts on my laptop with the very cheap 6-channel controller I have look promising:

import pyftdi.serialext
port = pyftdi.serialext.serial_for_url('ftdi://ftdi:232:FT4NMHF6/1', baudrate=2500000)
port.timeout=0.002
port.reset_input_buffer()
port.read(8)

With channels 1, 3 and 5 at maximum and channels 2, 4 and 6 at minimum I get:

b'\x00\x00\xff\x00\xff\x00\xff\x00'

and with the opposite (channels 1, 3 and 5 at minum and channels 2, 4 and 6 at maximum) I get:

b'\x00\x00\x00\xff\x00\xff\x00\xff'

The second byte always being ‘\x00’ is expected – the first frame or Start Code is ‘0’ for most common DMX usages.

And the first byte is the practical result of “the start-of-packet procedure is a logic zero for more than 22 bit periods,followed by a logic 1 for more than 2 bit periods“.

Now the problem is that if I read more than 8 bytes I will get a the same results repeated – for instance if I read 514 bytes (start-of-packet + start code + 512 channels) with all 6 channels at maximum I will get:

b'\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff'

So is it my cheap 6-channel controller really sending just 6 channel data instead of full 512 channel data (so 6 ‘FF’ followed by 506 ’00’) or am I doing something wrong when reading? Most probably the second option, of course.

The timeout = 0.002 was just an attempt, I probably need to use 0.023 (514 frames at 250 kbps take 22.616 ms).

And I also need a 3 pin XLR male to male adapter to assure connections are stable. But if this works I expect to have a DMX BUBBL3R before Easter.

Series Navigation<< LEGO and DMXMy first LEGO DMX fixture >>

Deixe um comentário

O seu endereço de email não será publicado. Campos obrigatórios marcados com *