My first LEGO DMX fixture

probably also first LEGO DMX fixture ever in the multiverse 🙂

So my Cameo Control 6 DMX controller is not probably full DMX compliant – I can only read 6 channels and even so only when cutting one of the data wires off. But who cares? (I do, but this month’s budget is already exceeded so I will only get a more decent DMX controller for Easter).

But using PyFtdi on EV3 works:

pip3 install ftdi

I could not confirm my FTDI url with ‘’ like I did on my laptop but used same url (‘ftdi://ftdi:232:FT4NMHF6/1’) and it worked:

#!/usr/bin/env python3

from ev3dev2.motor import MediumMotor, LargeMotor, DcMotor, OUTPUT_A, OUTPUT_B, OUTPUT_C,  SpeedPercent
from ev3dev2.port import LegoPort
from time import sleep

lights_port = LegoPort(OUTPUT_C)
lights_port.mode = 'dc-motor'


import pyftdi.serialext
port = pyftdi.serialext.serial_for_url('ftdi://ftdi:232:FT4NMHF6/1', baudrate=250000)


channels = [0]*6

pan = MediumMotor(OUTPUT_A)
pan.position = 0
pan.speed_sp = 90

tilt = LargeMotor(OUTPUT_B)
tilt.position = 0
tilt.speed_sp = 90

lights = DcMotor(OUTPUT_C)
lights.duty_cycle_sp = 0

while True:
    dmx_data =

    i = 0
    error = False
    for b in dmx_data:
    #    print(b)
        if i == 0 or i == 1:
            if b != 0:
                error = True
            channels[i-2] = b
        i = i + 1
    if error:
#        print("Channels:", channels)
        pan.on_to_position(SpeedPercent(25), channels[0] * 90/255 - 45)
        tilt.on_to_position(SpeedPercent(25), 45 - channels[1] * 90/255)
        lights.duty_cycle_sp = channels[2] * (100/255)

Now it’s time to plan a few DMX fixtures: a bubble machine, a fog machine, a spark machine, a confetti cannon, a flamethrower… 😀

Series Navigation<< DMX slave?Compatibility issues >>

Deixe uma resposta

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