We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I finally managed it to put a little time into my already existing Art-Net library for Java & Processing. It is based on the 5 year old artnet4j project, hosted on google code.
I have added some very important extensions to library:
Allow Socket Reuse - This is necessary to run multiple ArtNet servers / clients on one system. Otherwise the artnet port can only be used by one application.
Network Interface Selection - It is possible to select the specific network interface to communicate with. This is necessary if you have a special network for your ArtNet devices, but would like to be connected to a second network (e.g. for monitoring).
Receiving ArtNet DMX Data - Without this modification, the library was not able to read ArtNet from another node. The library also supports a simple caching solution, to read the dmx data when you need it (not event driven).
Here is a simple example how to read data:
ArtNetClient artnet = new ArtNetClient();
// set interface address to listen to
artnet.start("127.0.0.1");
byte[] data = artnet.readDmxData(0, 0);
System.out.println("First Byte: " + data[0] & 0xFF);
artnet.start.stop();
You can download the library here (under releases): github.com/cansik/artnet4j
I am also waiting for the approval into the library manager.
Comments
You dear sir are a lifesaver! The code just... works. (Let's hope it keeps working until saturday!)
Thanks a lot!
@colouredmirrorball That's great to here! How did it work :)?
@cansik I made this overly complicated setup... I have a number of RGBW LED strips that I control with Arduinos, which are controlled by Raspberry Pis. The Pis run a Processing sketch that I can send commands to from another sketch running on my laptop. I could select colour, effect and effect speed per LED strip. No individual pixel control from the laptop even though the leds are individually addressable, but I programmed some effects on the Arduinos that used this property.
For a gig, my friend was using a Chamsys board running MagicQ. So I reprogrammed the sketch running on my laptop to accept art-net using your fine library. We connected the Chamsys board to my laptop with an Ethernet cable through one of its art-net outputs and voila, the LED strips became controllable from his console! Works also with Freestyler.
Only downside was a slight delay between control input and LED strip response, which isn't surprising if you know the signal path: console -> (art-net) -> laptop running Processing -> (wifi) -> Raspberry Pi running Processing -> (serial) -> Arduino -> LED strip... Another issue is a timing desync, eg. stroboscope flashes became misaligned between the strips.
In the future I want to deprecate the Raspis and use a better controller that I can connect to network directly. The Arduino Nanos with ethernet expansion board proved too slow for realtime per-pixel control, as the communication between the Nanos and the ethernet board is using the serial interface. So I'm looking for a microcontroller that can directly translate an image to pixel output, and do it fast enough to get a decent framerate. All I need is time and money...
Have a look at NodeMCU (ESP8266), they are already WIFI enabled and have much more processing power :) I think there is already an artnet library for them.
They have been recommended to me in the past, but they only work with wifi! I'd rather use ethernet cables and network switches, because that's more reliable than wifi in a stage setting. The ideal microcontroller can do both as wifi is a lot easier to set up than running cables, but the question remains how well they will work when there are a lot of them (currently at eight strips/controllers but I want MO4R!). Ideally I'd need something like an Arduino Mega but that gets expensive, and is probably overkill anyway.
@colouredmirrorball a completely different option for this might be TinkerForge It's a bit more plug-and-play, which has its pros and cons. :-)
They have a direct Java library and WiFi / ethernet connection. The library is built in to Praxis LIVE, but usable from Processing - I've done a few projects passing Processing images to LED strips with this.