Feb 072014
This is an interrupt driven DALI interface for Arduino. It can be used as a master or slave in a DALI Lighting system, for example as a dimmer for LED Panels.
The library is capable of running multiple DALI interfaces simultaneously. The example program demonstrates with a DALI Master (interface dali1) sending commands received by the DALI Slave (interface dali2) on a single Arduino.
/*###########################################################################
DALI Interface Demo
On the Arduino connect pin18 and pin19 together
Dali interface1 transmit on pin18, interface2 receives on pin19
----------------------------------------------------------------------------
Changelog:
2014-02-07 Created & tested on ATMega328 @ 16Mhz
----------------------------------------------------------------------------
pq_Dali_Demo.ino
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
see http://blog.perquin.com for latest, bugs and info
###########################################################################*/
#include "pq_Dali.h"
//create the DALI interfaces
Dali dali1;
Dali dali2;
//callback to handle received data on dali2 interface
void dali2_receiver(Dali *d, uint8_t *data, uint8_t len) {
Serial.print("RX");
if(len>=2) Serial.println((int)(data[0]<<8) + data[1]); else Serial.println((int)data[0]);
}
void setup() {
Serial.begin(115200);
Serial.println("DALI Master/Slave Demo");
//start the DALI interfaces
//arguments: tx_pin, rx_pin (negative values disable transmitter / receiver)
dali1.begin(18,-3);
dali2.begin(-2,19);
//attach a received data handler
dali2.EventHandlerReceivedData = dali2_receiver;
}
uint16_t i=0;
void loop() {
Serial.print("tx");
Serial.println(i);
dali1.sendwait_int(i);
//delay(200);
i+=1;
}
Great! A DALI lib
I was looking for DALI projects but I can only find little to no info on the WWW :/
I have Xitanium LED drivers here and I try to figure out how to dim the LEDs using a microcontroller.
There’s no PWM input or something similar which makes it way harder to find a solution, but these power sources have DALI.
Is it possible to dim the connected LED panel using your lib? Do I need some interface between the Xitanium and the Arduino?
I’m thankful for any hint!
Thanks a lot in advance,
Nik
Very nice library, I was looking for this for a very long time.
I was wondering if I could ask you for some advice, I’m trying to build a sensor which is a dali slave device. So I could transfer an analog value to the dali master (when asked for), do you perhaps have an idea how to do this?
Greetings,
Sven
Nice project! Exactly what i was looking for. Could you post some details about the hardware part? Do you use a boost converter to reach the necessary voltage for DALI?
Many thanks in advance!
Interesting stuff!
This really looks worth trying – but how do you physically connect the Arduino to the DALI-bus? Level-shifters? Optocouplers? Amps? Or cables straight to the connector pins?
What hardware interface must be used with Arduino to talk on a DALI bus?