for some reason I would like to integrate a Spark Core intoo a DMX light controller. Currently I use a case with integrated power supply so all you need is to plug in power and DMX. As we use another DMX controller for simple light effects, I also need to switch the DMX line to the light controller.
With a Spark Core it should be possible to receive DMX signals (using DmxSerial) and send them as ArtNet-UDP-Packets over WiFi. As soon as the Spark Core device is online I can implement a rule that switches the DMX line to the ArtNet-Receiver (with data from Spark Core).
I don’t assume that generating valid ArtNet packets should be that complicated. My problem right now is that I don’t succeed to implement the DmxSerial library, which sounds to be the most simple solution, to the Spark Core firmware.
To port the DmxSerial to Spark Core I need to set all the registers for the USART-Serial interface, but I don’t have an idea how to get all these:
// These definitions are used on ATmega8 boards
#define UCSRnA UCSRA // Control and Status Register A
#define TXCn TXC // Transmit buffer clear
#define UCSRnB UCSRB // USART Control and Status Register B
#define RXCIEn RXCIE // Enable Receive Complete Interrupt
#define TXCIEn TXCIE // Enable Transmission Complete Interrupt
#define UDRIEn UDRIE // Enable Data Register Empty Interrupt
#define RXENn RXEN // Enable Receiving
#define TXENn TXEN // Enable Sending
#define UCSRnC UCSRC // Control and Status Register C
#define USBSn USBS // Stop bit select 0=1bit, 1=2bits
#define UCSZn0 UCSZ0 // Character size 00=5, 01=6, 10=7, 11=8 bits
#define UPMn0 UPM0 // Parity setting 00=N, 10=E, 11=O
#define UBRRnH UBRRH // USART Baud Rate Register High
#define UBRRnL UBRRL // USART Baud Rate Register Low
#define UDRn UDR // USART Data Register
#define UDREn UDRE // USART Data Ready
#define FEn FE // Frame Error
#define USARTn_RX_vect USART_RXC_vect // Interrupt Data received
#define USARTn_TX_vect USART_TXC_vect // Interrupt Data sent
#define USARTn_UDRE_vect USART_UDRE_vect // Interrupt Data Register empty
Ah sorry bout that. We need to get DMXsimple ported somehow. I see that they are using Timer to implement this so porting is going to take more changes.
Let me see what I can do
@joky So i looked at the DMXSerial code and it requires ISR and Timer which aren’t really exposed to Users at this point in time on the core.
Beyond my knowledge to get this ported over at this point in time!
@mohit could you shed some light and see how feasible it is to get this going?
@joky one workaround i can think of at this point in time is to have an Arduino interfaced to be the DMX controller and the Core will talk to the Arduino through I2C communications. I know it doesn’t cool this way but that’s a temporary tryout you can consider
Woo! Y’all gonna make me port this library, up in here, up in here! Y’all gonna me code all out, up in here, up in here!
(Off the chain, leave Arduinos soft in the brain! All my RuffCoders meet me outside! timb gotcha bouncin’ again, bouncin’ again, bouncin’ again!)
@djMax, that IS a doozy of a library since it is so hardware dependent. A port would require rewriting the USART serial port code to handle the different baud and stop bit configurations, as well as, managing the receive and transmit interrupts. Yuck!
Reading/generating the break that signals the start of frame is another fairly unique issue - I’ve used framing errors for that in the past, but that’s not really the way you’re “supposed” to do it.
DMX512 isn’t that complicated, but it can get a little messy.
I have no plans to port any existing arduino library or hook things into the cloud, I’ll probably be looking at a task-specific firmware load, but this project has not made it back to the top of my TODO pile yet, sorry.
@AndyW Any luck porting the library? Will the Photon make things any easier for DMX control? Hoping to control some BlinkyTiles with the Spark and FastLED, but this has been the blocker.
I did a lot with DMX and Arduinos. I managed to implement a cross fade version of the well known Arduino lib. It worked good with 128 channels. and at the same time the Arduino run a web interface.
I think that a good DMX implementation needs a multiprocessor approach. Imagine a Spark with a little shield that holds 2 atmega’s each running a universe. The spark sends them the changes in DMX settings via SPI.
With this approach we can build a powerful Wireless DMX controller that can be controlled from many sources.