SparkCore with DMX512 output - Intelligent Ambient Light and movement sensor

Hi all, I got one spark, which surprised me with easyness and out-of-box- functionality.
So I got few great ideas : I plan to build from spark a DMX512 master controller, which will send data to my DMX512 lights. A preprogrammed behavior will be stored in scenes, which will be called by behaviour on Inputs : a press of a buton, level of light sensor, or information from microwave movement sensor. I want to create a very soft and natural *Intelligent ambient and movement sensor system, which will evaluate and set a Light level dynamicaly according to the outer conditions (movement, levels, time, etc…). Collecting datas to the cloud and possibility of changing the levels curve through internet seems to me very interesting.

Biggest problem I have is with the DMX function to get to the Core without deep programming. I know there are many DMX libraries to be downloaded from many gadget vendors, which can be applied very easily(raspbery Pi, etc), and the outout pins will sent the code as needed, but I have no idea about the SPark libraries. Does anybody have any idea, if there are these libraries available, or compatible.
Can anybody point me out to some similar project so I can learn a bit?

Are there available any freelancers, which can be hired for this or other projects (0-10V voltage regulator with DMX input, Cloud Programmable DMX ouput controller with transfer of pre-programmed scenes, Multi-cell independent network controllers for multiple LEDs…etc.) I will appreciate any help if possible.

I am looking forward to any help, ideas, support, If not I will get there, but the more complicated way :smiley: .
Thanks, Jozef

1 Like

I have once built a DMX controller with an Arudino clone (Teensy) and the tricky part was the timing.
Since the cloud communication does need some time, this might be an issue here, but have you seen these two threads?

Maybe you could tag the guys there, they’re are awesome and most likely willing to help :wink:

1 Like

I have hardware in hand - overkill for what you have in mind, but you can easily depopulate what you don’t need or want.

I have not created an output library yet, not because it is difficult, just because it’s never made it to the top of my priority list yet - which is a shame since the hardware exists:

I’m not sure how the interactions with the cloud will go - output is pretty easy, I can arrange for the bulk of the output to be handled by interrupts and.or DMA, and for output if you’re slow all that happens is your update rate suffers.

I’ll try and find the time to put the eagle files up somewhere soon, and I can share the design on oshpark, but I hesitate doing that before I have completed hardware checkout.


Hi, great, thanks for suggestions. I have allready so many cool ideas, cant wait to create first projects…

Hi Andy, Thank you for your reply. The dificult part for me seems the software. I am electronic & hardware skilled, but with programming of ICs and software projects I have limited experience. The wifi on this DMX controller was meant mainly for transfering the scenes to the DMX controller, so the controller can go to DMX-Idle state when scene will be updated…I think the DMX refresh rate will be no problem then. The PCB you have included seems professional, however I plan to minimize the design as much as possible. My first and biggest question is : How do I tell the spark core to send to certain ID a DMX valid code with valid timing to the digital IO pins? Changing the ID to a pool, or setting a scene might be much easier for me then (basic cycles, loops, and work with variables I can remember from school, but complex things I have never done before) Can you point me out somehow about the DMX libraries, or maybe is it possible to hire a somebody as freelancer to help with all projects I have in mind?(I am confident mainly in hardware and great ideas )

No idea where to hire people to augment your skill set and help you realize your concepts; however you’ll find a lot of like minded and helpful people here and when skills and needs overlap well, you’ll be amazed what can be accomplished.

I imagine that the software would need to receive either wholesale or channel specific updates over the wifi interface that would update a table of 512 bytes in the core. The DMX send subsystem would simply spend it’s entire life transmitting these out of a serial port, with the correct break/mab timing. DMX really isn’t that complex or stressful, but it is a bulk protocol; meaning that you always need to transmit at least as many channels as the highest address you intend to control.

I plan to interface my system with ArtNet, you might want to base your thinking on that as a pre-existing protocol since it is almost always better to use an existing protocol than create a new one.

When I did my Arduino DMX I used DmxSimple lib.
As far as I remember the code was not to difficult to understand and it would be portable quite nicely, since there is an ARM Cortex version available for the Teensy 3.0/3.1 here

The portions that are enclosed with #if defined(CORE_TEENSY) && defined(__arm__) ... #endif or #if defined(__arm__) ... #endif are the ones that are ARM specific and need to be checked if they need further porting for the Core or can be taken as are.

At the moment, I haven’t got time to port it, but maybe it’s worth a look for you and maybe someone driving by, might find it an interesting challenge :wink:

It looks like DmxSimple bit bangs the output. Fetch me a bucket.

This might work OK for an arduino that is doing nothing else but spinning in a loop and calling delay() - but for a core that needs to talk to the cloud and/or other devices it’s kind of an ugly hack. I can imagine it being made to work by masking interrupts for the entire time the DMX frame is being sent - so someone can go ahead and do that if they want.

I’m looking at using the real serial port hardware to send frames @ 250Kbaud.

I agee - bit banging is not the best way to do things in real life products and not the most efficient use of the hardware, but it does help - or at least did for me, years ago, when I had my first encounters with Arduino - to understand the very basics of the protocol and what’s going on behind the scene.

And it’s comparably easy to port without having to dig into the STM datasheet - when you are not already familiar with the chip, as @jojino described himself.

And as the lib name suggests, it’s meant to be simple - and if you want the Core to do only a simple task, it wouldn’t matter if there were some spare clock cycles left, when they won’t be used otherwise anyway.

This said, the bucket might be a bit harsh in this connection.

The intended use may determin the appropriat solution.

Nevertheless Andy, I would really love to see DMXSerial ported - this definetly would be the better solution and will make the Spark shine brighter :wink:

Agreed, but the core is different. It needs to do other things, like talk to the cloud or other remote apps - which sometimes behave badly through no fault of their own. To bit-bash on the core you really need to wrap the critical sections with {dis,en}able interrupts, or the timing may go out the window.

Anyway, I’ll stop being then Grinch and get back to being positive.

1 Like

Hi all, Thanks for your comments. I think we can ease the whole thing to start somewhere : The core, when sending DMX, doesnt need to comunicate lively with the cloud, it can focus only on streaming the DMX signall correctly and on time. When Some change to the scene , programm, etc will be needed, The DMX output can be paused, the cloud connection can be established, and when all done, again the DMX can start…Then We might think of adding some more features,…but will need to make sure the core has enough power for DMX and other features too. …sounds easy, but I have no idea where to start. I know to change the code as needed mostly, but not to create or develop my own.

Did Anybody similar project who can post the code?
Kind regards, jozef


i have the following setup:
Loxone miniserver => Network => spark core => DMX512 => LED Controllers

I started using the following code:

All I did is to remove the ArtNet-Part of the code and add some basic UDP-communications (S1,255; = Set Channel 1 to 255). These commands can be generated by the miniserver.

The only (big) issue is that I didn’t manage to compile it in the cloud IDE so I had to compile the app & firmware locally.


1 Like

Recently received a spark core, lurking around, figured I’d sign up. While I’m a complete noob when it comes to the technical end of C++ programming / building electronics, I have some practical experience with DMX and IT stuff.

Your project is quite ambitious. My first thought would be to keep a lighting console in place and let it do all of the heavy lifting for DMX and let the core deal with the environment monitoring and simple triggering. Program your scenes on the console, then you might be able to use something like MIDI input on the console to call your scenes. I’m sure that I’ve used a MIDI controller to trigger bump buttons on an NSI console before (I think it was a 1616). I would imagine that sending a single MIDI note to the console could also call up pre-programmed scenes.

Just a suggestion as it might help simplify things for you in numerous ways…easy to change / create new scenes on the board without changing code. Of course, it also might complicate things. It would also give you less cloud control and probably added latency. A bit of a tradeoff.

Anyway that’s my 2 cents…good luck!

1 Like

Hi All,

Revisiting this old thread.

Anyone have any knowledge of DMX being done from a Particle Photon?

As with others on this and other related threads, I’ve had success on Arduino and Teensy with DMX libraries, but haven’t been able to find anything that appears to work on Particle Photon. I’m not sophisticated enough to be able to port the various libraries I’ve found (interrupts and timers and such).

Any suggestions? Thanks in advance!

@ninja118, can you provide links to those libraries and I’ll assess the porting effort :smiley:

Awesome, thank you @peekay123

The library I’ve used successfully on Teensy is

Note that while it would be awesome if the Photon could simultaneously transmit DMX and be connected to the cloud, I’d still be very happy with an initial (interim?) solution where the cloud needed to be disabled during DMX use, and DMX disabled during cloud use. I would, however, like to have the Photon be able to respond to I2C (as a slave) while DMX transmission is happening (or, at least be able to interrupt or abort its DMX transmission in order to not miss the incoming I2C command, and then resume its DMX activity).

@ninja118, I’ll have a look and post back a response.

@peekay123, that is the same lib I asked you about back in 2013 :wink:
It’s still only bit-banging, which still doesn’t play well with the cloud stuff.

1 Like

There is also this DMX library for Teensy that is Serial based, in case that makes things easier for porting to Photon:

I have not used this library, and also don’t need all the RDM stuff that’s in there, nor the Receive functionality (just need simple DMX transmit).

Hi Guys,

I have written a little bit of code to send DMX-512 using the UART of the photon. I’ve shared the library called “SimpleDmx”, so that other particle users can use it.
It’s also available on Github:

I know the topic is old, but I found the topic while searching for a way to send DMX with a photon.

The library uses only the high level firmware API. So it should also run on different hardware. On the other hand, this means that the implementation is not very efficient. It might produce some unnecessary CPU overhead and produce bad output if the timer function is interrupted by the system.