• Stars
    star
    162
  • Rank 232,284 (Top 5 %)
  • Language
    C++
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Art-Net Sender/Receiver for Arduino (Ethernet, WiFi)

ArtNet

Art-Net Sender/Receiver for Arduino (Ethernet, WiFi)

NOTE : BREAKING API CHANGES (v0.2.0 or later)

Feature

  • Art-Net with both Ethernet and WiFi
  • Support a lot of boards which can use Ethernet or WiFi
  • Multiple receiver callbacks depending on universe
  • Mutilple destination streaming with sender
  • One-line send to desired destination
  • Flexible net/subnet/universe setting
  • Easy data forwarding to FastLED

Supported Platforms

WiFi

  • ESP32
  • ESP8266
  • Arduino Uno WiFi Rev2
  • Arduino MKR VIDOR 4000
  • Arduino MKR WiFi 1010
  • Arduino MKR WiFi 1000
  • Arduino Nano 33 IoT

Ethernet

  • ESP32
  • ESP8266
  • Almost all platforms without WiFi

Usage

This library has following Art-Net controller options. Please use them depending on the situation.

  • ArtnetReveiver
  • ArtnetSender
  • Artnet (Integrated Sender/Receiver)

Include Artnet

Please include #include "Artnet.h first.

If you use the board which has both WiFi and Ethernet, you can't use #include <Artnet.h>. Please replace it with #include <ArtnetWiFi.h> or #include <ArtnetEther.h> depending on the interface you want to use.

// For the boards which can use ether WiFi or Ethernet
#include <Artnet.h>
// OR use WiFi on the board which can use both WiFi and Ethernet
#include <ArtnetWiFi.h>
// OR use Ethenet on the board which can use both WiFi and Ethernet
#include <ArtnetEther.h>

ArtnetReceiver

#include <Artnet.h>
ArtnetReceiver artnet;

void callback(const uint8_t* data, const uint16_t size) {
    // you can also use pre-defined callbacks
}

void setup() {
    // setup Ethernet/WiFi...

    artnet.begin(); // waiting for Art-Net in default port
    // artnet.begin(net, subnet); // optionally you can set net and subnet here

    artnet.subscribe(universe1, [](const uint8_t* data, const uint16_t size) {
        // if Artnet packet comes to this universe(0-15), this function is called
    });
    artnet.subscribe(universe2, callback);  // you can also use pre-defined callbacks
}

void loop() {
    artnet.parse(); // check if artnet packet has come and execute callback
}

ArtnetSender

#include <Artnet.h>
ArtnetSender artnet;

void setup() {
    // setup Ethernet/WiFi...

    artnet.begin();
}

void loop() {
    // change send data as you want

    artnet.send("127.0.0.1", universe15bit, data_ptr, size); // one-line send
    // artnet.send("127.0.0.1", net, subnet, univ, data_ptr, size); // or you can set net and subnet

    artnet.streaming_data(data_ptr, size);
    artnet.streaming("127.0.0.1", universe15bit); // automatically send set data in 40fps (15bit universe)
    // artnet.streaming("127.0.0.1", net, subnet, univ); // or you can set net and subnet here
}

Artnet (Integrated Sender/Receiver)

#include <Artnet.h>
Artnet artnet;

void setup()
{
    // setup Ethernet/WiFi...

    artnet.begin(); // send to localhost and listen to default port
    // artnet.begin(net, subnet); // optionally you can set net and subnet here

    artnet.subscribe(universe, [&](const uint8_t* data, const uint16_t size) {
        // if Artnet packet comes to this universe, this function is called
    });

    artnet.subscribe([&](const uint32_t univ, const uint8_t* data, const uint16_t size) {
        // if Artnet packet comes, this function is called to every universe
    });
}

void loop() {
    artnet.parse(); // check if artnet packet has come and execute callback

    // change send data as you want

    artnet.send("127.0.0.1", universe15bit, data_ptr, size); // one-line send
    // artnet.send("127.0.0.1", net, subnet, univ, data_ptr, size); // or you can set net and subnet

    artnet.streaming_data(data_ptr, size);
    artnet.streaming("127.0.0.1", universe15bit); // automatically send set data in 40fps (15bit universe)
    // artnet.streaming("127.0.0.1", net, subnet, univ); // or you can set net and subnet here
}

Artnet Receiver + FastLED

#include <Artnet.h>
ArtnetReceiver artnet;

// FastLED
#define NUM_LEDS 1
CRGB leds[NUM_LEDS];
const uint8_t PIN_LED_DATA = 3;

void setup() {
    // setup Ethernet/WiFi...

    // setup FastLED
    FastLED.addLeds<NEOPIXEL, PIN_LED>(&leds, NUM_LEDS);

    artnet.begin();
    // if Artnet packet comes to this universe, forward them to fastled directly
    artnet.forward(universe, leds, NUM_LEDS);

    // this can be achieved manually as follows
    // artnet.subscribe(universe, [](uint8_t* data, uint16_t size)
    // {
    //     // artnet data size per packet is 512 max
    //     // so there is max 170 pixel per packet (per universe)
    //     for (size_t pixel = 0; pixel < NUM_LEDS; ++pixel)
    //     {
    //         size_t idx = pixel * 3;
    //         leds[pixel].r = data[idx + 0];
    //         leds[pixel].g = data[idx + 1];
    //         leds[pixel].b = data[idx + 2];
    //     }
    // });
}

void loop() {
    artnet.parse(); // check if artnet packet has come and execute callback
    FastLED.show();
}

Other Settings

Subscribing Callbacks with Net, Sub-Net and Universe as you like

  • You can set Net (0-127) and Sub-Net (0-15) like artnet.begin(net, subnet)
  • Universe (0-15) can be set in artnet.subscribe(universe, callback),
  • Callbacks are limited to 4 universes (depending on the spec of Art-Net)
  • These universes (targets of the callbacks) are reflected to net_sw sub_sw sw_in in ArtPollreply automatically
artnet.begin(net, subnet); // net and subnet can be set only once
artnet.subscribe(univ1, callback1); // 4 callbacks can be set
artnet.subscribe(univ2, callback2); // these universes are reported to
artnet.subscribe(univ3, callback3); // Art-Net controller if it polls
artnet.subscribe(univ4, callback4); // Art-Net devices

Or you can register callbacks based on 15 bit universe. But these universes are not reflected to ArtPollReply automatically.

artnet.subscribe15bit(univ15bit1, callback1); // 4 callbacks can be set
artnet.subscribe15bit(univ15bit2, callback2); // these universes are NOT reported to
artnet.subscribe15bit(univ15bit3, callback3); // Art-Net controller if it polls
artnet.subscribe15bit(univ15bit4, callback4); // Art-Net devices

Sending Art-Net to Net, Sub-Net and Universe as you like

One-line sender

artnet.send(ip, univ15bit, data, size);         // use 15bit universer or
artnet.send(ip, net, subnet, univ, data, size); // net, subnet, and universe

Streaming

artnet.streaming_data(data, size);       // set data first
artnet.streaming(ip, univ15bit);         // stream to 15bit universe or
artnet.streaming(ip, net, subnet, univ); // net, subnet, and universe

ArtPollReply Setting

  • This library supports ArtPoll and ArtPollReply
  • ArtPoll is automatically parsed and sends ArtPollReply
  • net_sw sub_sw sw_in etc. are set automatically based on registerd callbacks
  • You can configure the information of ArtPollReply as follows
    • void shortname(const String& sn)
    • void longname(const String& ln)
    • void nodereport(const String& nr)

APIs

ArtnetSender

// streaming packet
void streaming_data(const uint8_t* const data, const uint16_t size);
void streaming_data(const uint16_t ch, const uint8_t data);
void streaming(const String& ip, const uint32_t universe_);
void streaming(const String& ip, const uint8_t net_, const uint8_t subnet_, const uint8_t universe_);
// one-line sender
void send(const String& ip, const uint32_t universe_, const uint8_t* const data, const uint16_t size);
void send(const String& ip, const uint8_t net_, const uint8_t subnet_, const uint8_t universe_, const uint8_t* const data, const uint16_t size);
// others
void physical(const uint8_t i);
uint8_t sequence() const;

ArtnetReceiver

OpCode parse();
// subscribers
template <typename F> inline auto subscribe(const uint8_t universe, F&& func);
template <typename F> inline auto subscribe(const uint8_t universe, F* func);
template <typename F> inline auto subscribe(F&& func);
template <typename F> inline auto subscribe(F* func);
// for FastLED
inline void forward(const uint8_t universe, CRGB* leds, const uint16_t num);
// unsubscribe
inline void unsubscribe(const uint8_t universe);
inline void unsubscribe();
inline void clear_subscribers();
// ArtPollReply information
void shortname(const String& sn);
void longname(const String& ln);
void nodereport(const String& nr);
// option
void verbose(const bool b);
// others
inline const IPAddress& ip() const;
uint16_t port() const;
String id() const;
uint16_t opcode() const;
uint16_t opcode(const uint8_t* p) const;
uint16_t version() const;
uint8_t sequence() const;
uint8_t physical() const;
uint8_t net() const;
uint8_t subnet() const;
uint8_t universe() const;
uint16_t universe15bit() const;
uint16_t length() const;
uint16_t size() const;
uint8_t* data();
uint8_t data(const uint16_t i) const;

Note

Some boards without enough memory (e.g. Uno, Nano, etc.) may not be able to use integrated sender/receiver because of the lack of enough memory. Please consider to use more powerful board or to use only sender OR receiver.

Reference

Embedded Libraries

License

MIT

More Repositories

1

MPU9250

Arduino library for MPU9250 Nine-Axis (Gyro + Accelerometer + Compass) MEMS MotionTrackingâ„¢ Device
C++
229
star
2

ArduinoOSC

OSC subscriber / publisher for Arduino
C++
171
star
3

ESP32DMASPI

SPI library for ESP32 which use DMA buffer to send/receive transactions
C++
103
star
4

MsgPacketizer

msgpack based serializer / deserializer + packetize for Arduino, ROS, and more
C++
61
star
5

Tween

Tween library for Arduino with Robert Penner's easing functions
C++
41
star
6

Packetizer

binary data packetization encoder / decoder based on COBS / SLIP encoding
C++
34
star
7

MsgPack

MessagePack implementation for Arduino (compatible with other C++ apps) / msgpack.org[Arduino]
C++
33
star
8

ArxContainer

C++ container-like classes (vector, map, etc.) for Arduino which cannot use STL
C++
32
star
9

DebugLog

Logging library for Arduino that can output to both Serial and File with one line
C++
28
star
10

ArduinoEigen

Eigen (a C++ template library for linear algebra) for Arduino
C++
25
star
11

ESP32SPISlave

SPI Slave library for ESP32
C++
24
star
12

TaskManager

polling-based cooperative multi-task manager for Arduino
C++
23
star
13

MQTTPubSubClient

MQTT and MQTT over WebSoket Client for Arduino
C++
22
star
14

MCP4728

Arduino library for MCP4728 quad channel, 12-bit voltage output Digital-to-Analog Convertor with non-volatile memory and I2C compatible Serial Interface
C++
18
star
15

Dynamixel

Arduino library for Dynamixel
C++
17
star
16

Debouncer

Debounce library for Arduino
C++
14
star
17

TCS34725

Arduino library for TCS34725 RGB Color Sensor
C++
11
star
18

CRCx

CRC calculation for Arduino
C
10
star
19

TsyDMASPI

SPI library using DMA buffer for Teensy
C
10
star
20

ofxArtnetProtocol

The port of Art-Net protocol parser https://github.com/natcl/Artnet to openFrameworks and mbed.
C++
8
star
21

Filters

Filter utilities for Arduino
C++
8
star
22

L6470Stepper

L6470 / L6480 wrapper for Arduino
C++
8
star
23

FastLEDManager

My FastLED Manager that can generate multiple sequences with layered (mixed) output
C++
7
star
24

ArxTypeTraits

C++ type_traits for Arduino which cannot use it as default
C++
7
star
25

EmbeddedUtils

collections of utility headers for embedded c++
C++
6
star
26

SPIExtension

SPI extension/wrapper for Arduino
C++
6
star
27

Sony9PinRemote

RS422 Sony 9-Pin Protocol Remote Controller of VTRs for Arduino
C++
6
star
28

IM920

Interplan IM920 series wrapper for Arduino and openFrameworks
C++
5
star
29

ADS1x1x

Arduino library for ADS101x / ADS111x Ultra-Small, Low-Power, I2C-Compatible, ADCs
C++
5
star
30

MTCParser

Midi Time Code (MTC) parser
C++
5
star
31

Sketches

sketches
Rust
5
star
32

MAX17048

Arduino library for MAX17048/MAX17049 1-Cell/2-Cell Fuel Gauge with ModelGauge
C++
5
star
33

SPIDaisyChain

Daisy-chained SPI library for Arduino
C++
5
star
34

HyperDeck

BlackMagic Design HyperDeck controller for Arduino via TCP
C++
5
star
35

DRV2667

Arduino library for DRV2667 Piezo Haptic Driver with Boost, Digital Front End, and Internal Waveform Memory
C++
5
star
36

TCA9534

Arduino library for TCA9534 Low Voltage 8-Bit I2C and SMBUS Low-Power I/O Expander with Interrupt Output and Configuration Registers
C++
4
star
37

MPU6050

Arduino library for MPU-6050 Six-Axis (Gyro + Accelerometer) MEMS MotionTrackingâ„¢ Devices
C++
4
star
38

PCA95x5

Arduino library for PCA9535 and PCA9555 (Remote 16-bit I2C and SMBus I/O Expander with Interrupt Output and Configuration Registers).
C++
4
star
39

ArxSmartPtr

C++ smart pointer-like classes for Arduino which can't use standard smart pointers
C++
4
star
40

PollingTimer

Arduino library to manage timing and event in a flexible way with polling
C++
4
star
41

PCA9547

Arduino library for PCA9547 (8-channel I2C-bus multiplexer with reset)
C++
4
star
42

I2CExtension

I2C extension/wrapper for Arduino
C++
3
star
43

Easing

Easing function library for Arduino
C++
3
star
44

VectorXf

Vector class 2f, 3f, 4f (port of ofVecXf (openFrameworks))
C++
3
star
45

TFmini

Arduino library for Benewake TFmini micro LiDAR module
C++
3
star
46

SceneManager

cooperative multi-scene manager for Arduino
C++
3
star
47

PCA9624

Arduino library for PCA9624 8-bit Fm+ I2C-bus 100 mA 40 V LED driver
C++
3
star
48

MsgPackRosInterfaces

ROS2 `common_interfaces` bridge based on MsgPack
C++
3
star
49

ofxSerial

Tiny extension to set options of ofSerial communication
C++
3
star
50

bevy_serial

Serial Port Communication Plugin for Bevy
Rust
2
star
51

GammaTable

Gamma Table for Arduino
C++
2
star
52

SpresenseNeoPixel

NeoPixel library for SPRESENSE (Arduino)
C++
2
star
53

ofxModbusOriental

modbus protocol wrapper for oriental motor
C++
2
star
54

pvoc-mini-plugins

Port of pvoc-plugins that can be available without LADSPA
Rust
1
star
55

rust-esp32-osc-led

Control smart LEDs from OSC via Wi-Fi on ESP32-C3
Rust
1
star
56

ES920

Arduino library for ES920/ES920LR FSK/LoRa wireless module
C++
1
star
57

hideakitai.github.io

1
star
58

hideakitai

1
star
59

rust_gui_iced_introduction

Rust
1
star
60

ArxStringUtils

Arduino String utilities
C++
1
star
61

XBeeATCmds

XBee AT Command Wrapper for Arduino
C++
1
star
62

EmbeddedApp

application template for embedded software
C++
1
star
63

TDCPlusPlusTemplate

touchdesigner CPlusPlus templates for myself
C++
1
star
64

TouchDesigner-GLSL-Sound

Template to use GLSL Sound on TouchDesigner
GLSL
1
star
65

TimeProfiler

Time profiler for Arduino
C++
1
star
66

msgpack-arduino

msgpack-c/c++ for arduino
C++
1
star
67

DS323x

Arduino library for DS3231/DS3232 Extremely Accurate I²C-Integrated RTC/TCXO/Crystal
C++
1
star
68

PCF2129

Arduino library for RTC PCF2129 with integrated quartz crystal
C++
1
star