Forum

Artnet to lanbox

Hi all

im new to vvvv but can allready see how powerfull it is.

for now im trying to make a artnet to lanbox dmx converter.

i have no problem in reciving artnet but carnt get dmx out threw a lanbox. does any one have any working exampes of how to send out to a lanbox??

thanks in advance

ian

iirc lighting design genius @Kalle started his vvvv career with an absolute impressive set of modules and subpatches trying to program every aspect of the built in sequencer of the Lanbox. it might be of some historical interest, as it was done in one of the earliest betas.

a little piece of the whole system was the tiny and simple message string concatenation patch you would need for just sending out dmx over the lanbox. in fact i remember this part as quite simple, as the lanbox can be accessed with simple UDP or TCP messages.

hi, below is the info form the lanbox user ref on lanboxes UDP.

can any one help me trun this in to a VVVV Tx .

cheers

ian

From firmware version 2.xx for the LanBox-LCX and LCE, a UDP protocol is supported in order to broadcast DMX
buffers, or to set them directly from third party applications like MAX. For network and UDP setup see the LCedit+ tutorial
and the LanBox user manual.

The default UDP port used is 4777, and all integers are in “network order” (most significant byte first).

A packet consists of a 4-byte packet header followed by one or more messages. If a message has odd length, then a
padding byte is added to make sure the next message is at a 16-bit aligned offset. This padding may be omitted after the
last message of course.

Packet header C0 B7 sq sq
16-bit cookie
16-bit sequence number

The cookie must always be 0xC0B7.

Packets with a different cookie should be silently discarded.

The sequence number is incremented by 1 for each packet, and may optionally be used to discard packets that are received out of sequence.

(TheLanBox does not currently do this though)

Two different types of messages are currently defined:
Buffer broadcast C9 id ln ln ch ch
8-bit message type, always 0xC9
8-bit source buffer id
16-bit message length (of entire message, except padding)
16-bit channel offset
n bytes of data, where n = message length - 6

This message announces the contents of (part of) one of the buffers of the transmitting LanBox. The channel offset is the
channel number corresponding to the first byte of data.

A LanBox can be configured to transmit the following buffers:
252 DMX Input Buffer
253 Analog/Switch Inputs
254 Mixer Buffer
255 DMX Output Buffer

A LanBox can be configured to copy incoming mixer buffer broadcasts of some other LanBox into its own mixer buffer or
one of its layers.

Buffer write CA id ln ln ch ch
8-bit message type, always 0xCA
8-bit target buffer id, see below for a list of ids
16-bit message length (of entire message, except padding)
16-bit channel offset
n bytes of data, where n = message length - 6

This message is almost the same, except in opposite direction: it is sent to a LanBox to directly write into one of its buffers.
The buffer id must be either 254 to write into the mixer buffer, or the id of a layer to write into, in range 1 (layer A) through
63 (layer BK).

It possible that future versions of the protocol will define more types of messages. These will however all start with the
general form:
8-bit message type
8-bit value
16-bit message length

If the message type of a message is neither 0xC9 nor 0xCA, then the message length can be used to skip over the message.

If a message is encountered with length set to 0, parsing must abort to avoid an infinite loop.

hi henny,
-have you got dimmers under the hand with the lanbox ?
-can you send your early patch ?

i can have a look tomorrow morning ( 31 jully)

im looking at contoling verious things with the dmx from lanbox from vvvv

what i would like to end up with a subpatch that i can pass 512 or 1024 slises of 1>255. also an io box to set the buffer that it wrights to.

thanks in advance

ian

first what you need to do is to forget for the moment the artnet conversion. it s complicating things …

just to know wich coding its receiving… some more time wednesday…

EDIT: ok just taken a look inside their C examples

i maybe say a big non sense, but by a rapid look i would say:

what you need is to create an udp string message of 1472 character size. that is for the size of the message to send in udp.

first element of this buffer should be a value of 0xc0b7
then you have you 255 channels to write their value asstring ascii.

@oschatz, if you are around can you have a quick look at the C sample ?
i m not sure about this idea about having a layer buffer, a mixer buffer, a dmx out buffer… don t understand this idea…

Hi,

the lanbox works its dmx data in a number of layers/ buffers and mixes them all together to out as dmx the layer buffer setting sets whitch layer recives the data and so where it ends up.

ive attached the ref manule udp is on page 83

LCplus Reference v2.0a1.pdf (357.5 kB)

ok henny, i have a rehearsal soon, so can t be really there. i have a lack about my comprehension of english ( sometimes things don t go to the good place, im bugging).

can we say this:
this is an udp chain or to be more clear a string chain.
if you write in vvvv your name henny, its a chain of henny.
in udp you send the value transformed in a caracter… asstring
i have some example on my user page, this should help.

i had a quick look on the web and founded this example in perl

so it should be sending this type of udp chain like this:

1st carcater = cookie for the header, wich is always 0xC0B7
2nd carcater = your sequence number ( no time to read carefully) set to 0
3rd caracter = layer id = 0xCA
4th caracter = layer number ( 0)
5th carcater= tells the size of your udp packet: 6 + number of dmx channels you send ( if 10 = 16, if 256= 266)
6th carcater= you set the dmx channel to start to listen ( 1)
then you can send your channels and thats all

example: we say that you want to send only 10 channels, ok ?

your chain will be like this :
0xX0B7[ascii value of 0](ascii value of 0)0xCA[ascii value of 0](ascii value of 0)[ascii value of 16](ascii value of 16)[ascii value of 1](ascii value of 1)[ascii value of channel 1](ascii value of channel 1)[ascii value of channel 2](ascii value of channel 2)…[ascii value of channel 10](ascii value of channel 10)

ok i run to my reherasal, i will be back tomorrow morning…

Cheers.

it all makes some sence now, attached is my guess at how it should be implimented in VVVV, just grenated some input values so i had somthing i could see in the lanbox monitor

mor than likeley verry wrong but …

lanbox-test-1.v4p (13.8 kB)

hi ian,

i just see i have made a not clear example for the 5th carcater.
the 5th caracter say how many caracters at the total the lan box wil have as string information.
wich means 6 + 512 for your patch example . So in your example this should not be 522 but 518.

hope this works, has i have taken a forum talking as a base of work… please let me know if you succeed and i m not sending you in the nuts ;-) …

nota: in the C example max buffer lenght is 1472

  • define LCUDP_BUFSZ (1472)

Please note that several fields are 16-bit integer rather than 8-bit, so they take up two bytes/characters.

A simple example (with each character given as hex value) that sets channels 1-6 of layer A to the values 0, 51, 102, 153, 204, 255 would be:
{CODE(ln=>0)}C0 B7 00 00 CA 01 00 0C 00 01 00 33 66 99 CC FF^
explanation per byte:
{CODE(ln=>0)}(packet header)
C0 - cookie, high byte
B7 - cookie, low byte
00 - sequence number, high byte
00 - sequence number, low byte

(message - 12 bytes total)
CA - message command (0xCA = buffer write)
01 - message target (decimal 1 = layer A)
00 - message length, high byte
0C - message length, low byte (decimal 12)
00 - start channel, high byte
01 - start channel, low byte
00 - value for channel 1
33 - value for channel 2 (decimal 51)
66 - value for channel 3 (decimal 102)
99 - value for channel 4 (decimal 153)
CC - value for channel 5 (decimal 204)
FF - value for channel 6 (decimal 255)^

your sequence number ( no time to read carefully) set to 0

The sequence number is supposed to be incremented for each packet. in theory this would allow the lanbox to detect reordered packets (which won’t happen over a LAN but can happen over the internet) and prevent old data from overwriting newer data.

The current lanbox firmware however does not implement this detection and just ignores the sequence number, so you can get away with setting it to zero. Note however that it is possible that this would break if a future version of the lanbox firmware does implement sequence number checking.

Another note about the message length: this covers the entire message starting with the message command (CA). If your packet contains only one message then this is the packet length minus 4 bytes. Total packet length must not exceed 1472 bytes.

You are allowed to put multiple messages in a single packet, so then you get the 4 byte header (C0 B7 + seqnum) only once, and then one or more messages. If a message has odd length then an extra “padding byte” must be inserted after that message to make sure the next message starts at an even offset from the start of the packet. If the last message of a packet has odd length you are allowed to append a padding byte, but not required to. The value of a padding byte is irrelevant.

For example, setting channel 1 of layers A, B, and C to 255:
{CODE(ln=>0)}C0 B7 ss ss (ssss = sequence number)
CA 01 00 07 00 01 FF xx (xx = padding byte)
CA 02 00 07 00 01 FF xx
CA 03 00 07 00 01 FF(xx) (last padding byte is optional)

total packet length: 27 or 28 bytes^

hi xmath…
good to have a real “informatician minded” around ;-P
good to know WHY there is sequence and the idea of rerouting over wifi-net…
good to see i miss a strong point in this story…

ok, just to help henny, for the communication with his Lan Box, can you translate all that in a vvvv patch ( ;-) ) about the low and high byte ?

hi all

xmath is from the lanbox e-mail list, some help i asked for.

i have used the 6ch example

C0 B7 00 00 CA 01 00 0C 00 01 00 33 66 99 CC FF

and have tried to implement it in vvvv

dosen work,attached any way

also if i have a udp send and recive on the same patch im i right in thinking they will talk if configured to local host and the same port. because they dont.

thanks

ian

lanbox-test-2.v4p (15.6 kB)

hi all, thanks to xmath i have a working 6 channel output patch for lanbox. ill tidy it up, expand it and post in the next day

good to read you arrived to the result !;-) it will be a pleasure to read all this hex stuff in a simple vvvv string…

HI, a 24 ch example attached.

will do a wright up and post it in the docs soon.

lanbox 24ch send .v4p (39.9 kB)

Henny, have you still got under the hand for some days the lanbox ?
I would like to implement it in schwartzpeter. Could be great to have a beta tester on lan box …

yep no probs

i have 2 lcx’s and an lce so would be happy to test

thanks henny ! i will code it for beginning of september.
thats pretty cool , youpi youpi youpi ay ! ;-)