I am just sharing somthing I am experimenting with as I saw there was no mention of sending DMX on the forum. I am no expert but I have got some initial tests working, eventually I will make a simple library.
I am using a standard MAX485 to drive it.
This post was a great help
http://www.ubasics.com/DMX-512
I am not sure if I am matching the standard enough that it will guaruntee work with all lights but here is the test script that works for me.
Code: Select all
from pyb import UART
#Serial Tx on pin X9
dmx = UART(1)
dmx.init(250000, bits=8, parity=None, stop=2)
#make an editable frame
dmx_bytes = [chr(0)]*513
#This is just a simple test to make the first 3 channels a certain brightness
def write_frame(brightness):
# Change first 3 channels
dmx_bytes[1] = chr(brightness)
dmx_bytes[2] = chr(brightness)
dmx_bytes[3] = chr(brightness)
# It expects a minimum 88uS break to begin a frame, this produces a low for 52uS but works on my device
dmx.sendbreak()
#send bytes
dmx.write(''.join(dmx_bytes))
#Dim up forever
while True:
for i in range(255):
write_frame(i)
Code: Select all
Traceback (most recent call last):
File "main.py", line 24, in <module>
File "main.py", line 19, in write_frame
OSError: 116
Code: Select all
MicroPython v1.5.2-62-gaeadda4 on 2016-01-15; PYBv1.0 with STM32F405RG