mydana / CircuitPython_DMX_Transmitter

DMX512 lighting protocol transmitter on the RP2040
MIT License
8 stars 2 forks source link

Use it without rp2040 #4

Closed davy39 closed 4 months ago

davy39 commented 9 months ago

Hello, Many thanks for your library !

I would like to use it with BLE with an ESP32, but seems to rely on rp2pio.

Would you know how to modify it in order to use it with broader range of boards, maybe using pulseio ?

mydana commented 9 months ago

Hi @davy39,

Thank you for your question.

Indeed the library requires the rp2pio. I’d used the PIO to avoid any bit banging. Honestly, I’m not familiar with BLE or Pulseio, but it looks like Pulseio isn’t particularly suitable for DMX512

In case you’d hadn’t a chance to look into the DMX512 standard, it’s a 250 kbit/sec serial data stream, but unlike more sophisticated serial protocols, each packet is framed by a longer break, instead using framing bytes.

One possibility is to use a UART. But, I don’t know how to send the break. If the UART can do it, great. Or maybe use a GPIO pin and some logic. The DMX512 standard is pretty permissive on the length of the break, as long as it’s 92 microseconds or longer. If you experiment with a UART keep in mind that DMX has TWO stop bits per byte, but your equipment may not care.

Another possibility is to use this product that Adafruit sells: https://learn.adafruit.com/quickstart-raspberry-pi-rp2040-with-ble-and-circuitpython/overview it looks like this product allows BLE to be connected to a RP2040 microcontroller.

Let me know if this helps.

Dana

P.S. I’m interested in knowing more about your use case. Please tell me more about it.

davy39 commented 9 months ago

Hi, Thanks for your answer. I would like to build a wireless dmx controller that use BLE to send DMX bytes to a receiver that transmit them as a DMX signal. As soon as I get my MAX485 chip, I'll try to use UART to send DMX signal.

For now, my only way to send a break is digitalio. However, switching form digitalio to UART is a quite long process, so MAB is > 200µs !

I'll see if my dmx equipment care about such a long MAB...

davy39 commented 8 months ago

Hello, Finally I didn't try to use uart, but SPI instead. Thanks for your advices. You can find my very basic, but working code here. Cheers.

mydana commented 7 months ago

@davy39 That's a really clever solution. Bravo!