Browse our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteris

How to work with DALI Arduino Library and an industrial PLC


DALI stands for Digital Addressable Lighting Interface. A DALI network consists of an industrial controller and one or more luminaires that have DALI interfaces. The PLC controller (DALI master) can monitor and control each luminaire by means of a bi-directional data exchange.

The communication is via a two-wire, low-voltage bus that operates at a low speed (1200 bits per second). Signal levels are defined as 0±4.5 V for logical '0' and 16±6.5 V for logical '1'. The idle state of the bus is the logical '1'. Manchester coding is used with 16-bit forward frames  (plus start and stop) and 8-bit return frames. In Manchester coding, the bit status is defined by a transition in the centre of the bit window: positive going transition = '1', negative going transition = '0'. The DALI protocol enables the luminaires to be addressed individually. It also incorporates Group and Scene broadcast messages to address multiple luminaires simultaneously . A single DALI network can control up to 64 luminaires.

Each bit takes two periods. The defined DALI bit rate is 1200 bps. Therefore, a 1-bit period is ~834 µsec. A frame is started by a start bit, and ends with two high-level stop bits (no phase shift). Data is first transmitted with the MSB. Between frames, the bus is in idle (high) state.

How to work with DALI Arduino Library and an industrial PLC


In order to work with the DALI Arduino Library you will need the following things:

  • Arduino IDE Software

  • An Industrial Shields controller Arduino: M-Duino-DALI family


Arduino-DALI Library implements the DALI communication protocol in the Arduino-based M-Duino-DALI family of programmable logic controllers.

Getting Started

This section shows the necessary prerequisites and installation of Industrial Shields boards to use this library.


Steps to install Industrial Shields Boards on Arduino IDE:

    1. Open the Arduino IDE, version 1.8.10 or superior.

    2. Press the “Preferences” option to “File” menu and open the preferences window.

    3. In the text box “Additional boards manager URLs”, add the address:

    4. Close the preferences window with the “Ok” button.

    5. Click on “Tools” menu , and open the “Boards” submenu, and click the “Boards Manager” option, to open the Boards Manager window.

    6. Find “industrialshields” to the search filter and select to the list and click “Install”. Download the 1.1.24 version or upper.

    7. Close the “Boards Manager”.

Once you have done all the steps, you can select each PLC you wish to work with on “Tools” > “Boards

DALI Library for Arduino IDE

#include "DALI.h"

The DALI library sends and receives data via DALI pins used in the M-Duino DALI family and Ardbox DALI family controllers. Refer to your DALI family PLC user's manual of your DALI family PLC to see the location of the data transfer pins via DALI.

DALI dali;

Use this statement before the setup() function to indicate your DALI family controllers the internal connections between the Arduino board and the DALI module attached inside the PLC Arduino.

Initializing the library:


Use this statement inside the setup() function to initialize the library properly.

The initNodes Funtion:

int initNodes(6);

In this example we are initializing the node 6, defined as a uint8_t data type.

To control two or more nodes, you can use the following function:

const uint8_t addresses[] = { 6, 7, 8, 9, 10 };
const int maxAddresses = sizeof(addresses) / sizeof(uint8_t);

int initNodes(const uint8_t* addresses, uint8_t numAddresses);

Functions to control the values of the nodes:

void turnOff(uint8_t nodeAddress);
void setMax(uint8_t nodeAddress);
void setValue(uint8_t nodeAddress, uint8_t value);

Want to learn more about DALI applications with Industrial Arduino PLCs?

Contact us, we will help you.

Share the DALI post on your favourite social network      

Do you want more information?

Open Source technology allows you to develop your installations.

Just fill the form and we will contact you as soon as we can.