The media in this post is not displayed to visitors. To view it, please go to the original post.

Yes, you can absolutely build a USB (or, with an ESP8266, MQTT) to DMX adapter with an ATMega328 (as available on Arduino Nano or variants thereof), despite the fact that it only has a single UART.

All you gotta do is run TDMA between USB / UART input (57600 baud) and DMX output (250 kbaud). Also known as: Just send the desired output pattern several times, one of the transmissions will fall into the ≈300ms gap between two consecutive DMX frames.

Mwahahahaha :3

arti reshared this.

in reply to ity [unit X-69] - VIOLENT FUCK

@ity basically: DMX is a protocol for lightning fixtures that can also be transmitted with a UART hardware interface. However, the ATMega328 (8-bit microcontroller in an Arduino Nano, with a whopping 16 MHz / 32 KiB Flash / 2 KiB SRAM) only has one such UART → it cannot receive data via USB and output DMX at the same time, as the two use incompatible line speeds (baud rates).

Enter TDMA (time division multiple access): alternate between receiving USB (UART @ 57600 baud, transmit line for DMX idle) and sending DMX (UART @ 250 kbaud, receive line from USB not used).

That's it, really^^

in reply to derf

ooo
The RP2040 has two UARTs, one over its USB 2.0 controller, the other routed to PIO pins
It's very nice, the baud should be high enough too (plus the thing can do PIO faster than its own clock speed, the PIO is tied to shift registers and a few other fun things)

And yea, hardware limitations are very fun :3 I'm still bad at embedded engineering unfortunately, but it's really cool to watch others do these kinda things

in reply to derf

the RP2040 is cheap and fast, but it has no internal flash and no eeprom, so that adds 2 footprints and 4 caps to the bom. You may spare the eeprom if no persistant storage is needed but you need the external flash for your program.
If you do not really need the speed an Atmega328PB has an even smaller footprint, internal flash and eeprom and is sufficient for most use cases.
You can place them both by hand if you can reflow or have hot air.
@ity [unit X-69] - VIOLENT FUCK @derf
@derf