This is a Python3 library to control your DALI lamps with the brand new daliMaster hat for Raspberry Pi, with built-in DALI bus power supply system. B:boom::boom:m!
Are you looking for Arduino™ library and DALI shield? See here.
DALI (Digital Addressable Lighting Interface) is a powerful protocol to control lighting. Through DALI you can dimmer your led lamps, ask them status, recall a predefined scenario and so on. If you want more information about DALI you can find many useful links to the bottom of this page.
Well, the answer is YES.
With daliMaster hat! As the name suggests, that hat transforms your Raspberry Pi in a DALI master, acting as a bridge between I2C interface and DALI bus. Let's make an example to explain how it works.
-
Turn your Raspberry Pi off.
-
Fit daliMaster hat on your Raspberry Pi
-
Make connections (you can find an example here)
- Connect your lamps to their ballasts
- Connect your ballasts to mains..be careful!
- Connect your ballasts and daliMaster hat to DALI bus
- Connect your 24V DC power supply to mains and to daliMaster..again, be careful!
-
If I'm right, now you should have all lamps on.
-
Turn your Raspberry Pi on.
Enable I2C interface of your Raspberry Pi
sudo raspi-config
Select "Interfacing option">"I2C">"Yes" to enable the interface. Then install the I2C utilities:
sudo apt-get update
sudo apt-get install python3-smbus i2c-tools
Now digit
sudo i2cdetect -y 1
and you should see something like that:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- 23 -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
If you see '23' (I2C address 0x23), your daliMaster is online: well done!
Download this library and digit:
sudo python3 examples/shellControl/shellControl.py
Remember: "sudo" is needed because we are trying to access system resources such as I2C. Now you should see something like that:
I2C DALI master(0x23) begin..
PING I2C device 0x23..ok
device 0x23 is ready
Digit your command (press "Enter" to see all options):
Well, write and send this command:
-d -b 0
If everything went well your lamps now are off. But we don't like darkness, so let's switch them on to the minimum:
-d -b 1
Cool! Let's push them to maximum:
-d -b 254
Easy, isn't it? Now you can modulate all lamps from 0 up to 254 with those simple commands. 👍
See more informations about shell commands here. See other examples to play with your lamps (try Pulse.py). See also the following links to know more about daliMaster and DALI.
- main commands
- DALI international standard (English/French) 60929 © IEC:2006
- v.1 First release April 2019
See credits.md file for details. Raspberry Pi is a trademark of the Raspberry Pi Foundation.
This project is licensed under the MIT License - see the LICENSE.md file for details