I have a headlight connected to my rpi with dmx cable and a RS422 / RS485 Serial HAT shield (https://www.hwhardsoft.de/english/projects/rs485-shield/). According to the instructions it should be using the serial port over UART PL011. I have a Rpi 2 running raspbian. I don't manage to open this port in python and send commands to it. For example

ser = serial.Serial("/dev/serial0",9600)

does not work. With this I mean I have serial installed, the code runs, my light is listening (showing A001), but nothing happening to the light. I also found out about pySimpleDMX (https://github.com/c0z3n/pySimpleDMX) but then using

import pysimpledmx
mydmx = pysimpledmx.DMXConnection("/dev/serial0")
mydmx.setChannel(1, 255) # set DMX channel 1 to full
mydmx.render() render

Does not do anything and the connection with the dmx light is dropped. This board is meant for this kind of communication so I am sure it should be able to work, but I don't know how to do that. Many thanks for any advice


Roughly translated, your question seems to be, "How do I write a Python program on the Raspberry Pi?" If that's a fair translation, it suggests you've not "done your homework"; i.e. you've not searched, read or tried to do this before asking your question.

If this is the case, I would suggest that you do that now... here's a place you might find useful as a first stop. After reading that, you should be able to write a simple Python program, and run it on your RPi. After that, try putting this in Google: how to write and run a python program on the raspberry pi; lots of help will follow.

If this is not the case, please edit your question so that it's more specific.

  • No this is definitely not my question, I know how to write and run python scripts.. I don't know how to send the right commands to the right ports to be able to control the light through dmx, I will clarify my question – crazjo Jun 15 '18 at 6:33

@ crazjo: Hi, I'm nu to this topic also, so I can't really help you with your code itself from that point of view. However, you need to adjust the baudrate to 250k, since all DMX devices only work at this rate.

  • Hi and welcome to SE.RPi! Whilst you are indeed correct about the asynchronous serial data rate, your answer is a little terse. Could you provide a link (Wikipedia: DMX512: Protocol as an example? And how that compares to the Maximum Baudrate of UART in Raspberry Pi 3) and some additional information in your answer, as it is a little bit terse, and as such may be better suited as a comment. – Greenonline Aug 17 '18 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.