Two pin serial communication

I should start by saying that I’m a complete newbie with electronics. I’m in the planning stages of a project and I think I’d like to use Spark for it, but I have a question before I start.

My project involves receiving wifi packets and transmitting the info in them via DMX, which involves the use of an XLR connector. The thing that I’m unsure about is that the DMX spec involves two pins of the connector for communication. When the voltage of pin 1 is greater than pin 2, a “1” bit is transmitted, and when the voltage of pin 2 is greater than pin 1, a “0” bit is transmitted.

That’s simple enough, and I assume I could use two digital pins on the Spark unit for it, with functions to turn them on or off depending on what to transmit. This seems like reinventing the wheel, though, when I’m just writing ordinary serial data and there’s a serial transmission pin on the device.

So, TLDR: I need to transmit serial data to two pins using a single output pin. What do I do?

Thank you for reading,
Jesse

1 Like

You’re working with DMX?

There’s a DMX arduino shield and we had some discussion about this before.

Only issue is we need to get the code ported over.

If the interface is purely UART then you can use it with the spark core almost immediately.

Let us know what are you trying to hook up to the core? :smile:

2 Likes

DMX uses differential signaling, which is why you need two pins to control it:

I am guessing this will require a true DMX library for the Spark Core; I found a couple of things, I’ll link to it on the other thread that @kennethlimcp shared above.

2 Likes

We gonna need a shield somehow yeah? :slight_smile: together with a library and we can do great stuff!

Thank you for the additional info. I wanted to Google this stuff, but being so new, I didn’t know the names.

In response to what I’m doing, it seems to be the direct reverse of joky’s project. I’m hoping to receive Artnet (or sACN) packets and transmit them to light fixtures. Basically, I’m sending data from a MacBook using a USB interface connected to a wireless transmitter at the moment, with receivers on the light fixtures. This all seems ludicrous and over-complicated when the MacBook has a Wifi interface built into it and stuff like ArtNet and sACN already exist.

I did know about the DMX Arduino shield, I just thought that the Arduino shield converter AND the DMX shield was a fair amount of size and complexity bloat for what I hoped to be a single XLR connector and three wires. I’m happy writing my own DMX code - for my purposes, it’s pretty simple.

Going over the links and info, it seems I need a 3.3V RS-485 transciever. At this point, it might just be easier to use the Arduino shield and go from there.

Probably a good starting point, at least

Actually, I did just find this.

http://www.ebay.com.au/itm/RS485-MAX3485-breakout-DMX-Module-Arduino-Raspberry-RS422-/281208253682

Please forgive my ignorance, but I’m assuming the three separated pins (B, A, G) are hot, cold and ground for connecting to an XLR connector, and the 3-5V power range includes the Spark’s 3.3V. The TX and RX pins accounted for, that just leaves RTS, which I have no idea about.

Is there any obvious reason that I couldn’t just hook this straight up to the Spark and eliminate the shield middle men?

@Kadmium That should take care of the physical interface, but you still need the library which has some extra communication protocol layers.

Some good info here too
http://playground.arduino.cc/DMX/DMXShield

RTS pin is part of the UART interface (tx/rx) but i guess you won’t need it for your case.

It’s used to better control communications over UART.

Wow you know how to write DMX code? Will you be able help with the Arduino DMX shield code --> Spark DMX code? :smile:

So… You want to:

RS485 ------> Light fixture? OR

RS485 --> Wireless transmitter --> Light fixture?

I’m thinking Wireless transmitter --> Spark Core but i need the information about the transmitter :smile:

Honestly, I thought I knew how to write DMX code. By the looks of it, it seems I know how to control an Enttec Pro, which makes it staggeringly easy in comparison to actually doing it by hand. I was hoping to just implement sending data, which I thought would be a simple matter of setting up UART properly, signalling a DMX command then iterating through an array of values. This is looking like a naive assumption.

What I want to do is go…

Macbook -> ArtNet over wifi -> Spark -> RS485 -> Light Fixture

  1. ArtNet over wifi --> Spark not sure if this is going to be a smooth implementation with the need of a Library to understand the ArtNet protocol.

But i found an Arduino implementation so we need to study how to get it ported over

  1. RS485 --> Light fixture need more information on this as well. So we know what commands need to be sent based on the Artnet message received.

Hmm…

Does the Light fixture have a DMX interface or something?

Oh, actually, my Spark program was going to interpret the ArtNet (or sACN, or whatever) data and grab the DMX packets from it. I kind of assumed that I’d have to roll out my own ArtNet implementation. Assuming I can start a UDP server on the Spark (I daresay that shouldn’t be too hard) then interpreting ArtNet packets isn’t a big chore.

The light fixture does have a DMX interface - that’s why I’m bothering with DMX in the first place :smile:. Most stage lighting is controlled with DMX.

Sounds like we are good to go? :smiley:

Sorry i’m really not familiar with RS485 at all. So it’s just purely RS485 --> Light fixture?

You just need to get hooked up, code the Artnet stuff in the spark core…and woola!

Sounds like it. Time to order a pair of Sparks.

1 Like

Hi guys,
there is another topic open rgd. porting a DMX library to Spark:

The hardware to create a (not-isolated) DMX-Port is quite simple. The isolation can be done by some optocoupler, but as we’re using isolated AC/DC power-supplies and WiFi it would be safe to build a non-isolated DMX-interface.

If you still want to connect your core to other peripherals or a computer I’d higly recommend to implement a isolated interface.

regards

1 Like

BTW: The project I’d like to implement is to connect a DMX-Console over a Spark Core to ArtNet over WiFi. With some patches I could even implement some channels to control other network-enabled hardware, eg. a WiFi controlled light dimmer.

1 Like

There’s a DMXshield for spark core but no promises yet. So with that shield, code is definitely coming to make it work and many users working with DMX is gonna enjoy It :slight_smile:

1 Like

I have been playing with receiving ArtNet packets with the Spark. I am not sure it is able to keep up with the 40 packets per second. Getting the DMX data form the ArtNet packet is pretty easy. I need to clean up my code a little before I can post something but as of now I am not having good luck.

I will try to update later with some code.

If someone is have success with receiving ArtNet reliably by all means jump in please.

1 Like

Your’re gonna make people enjoy :spark: + DMX!

Hi guys,

has anyone succeeded to port a dmx-in/out-library to spark core? I’m watching this forum since months and I get more and more use-cases for such a solution,…

kind regards