Control Philips Hue Lights with a MIDI Pad Controller
This is a project that I created to control the lights in my office. It is designed to run on a Raspberry Pi 3, but it could also be installed on a laptop or any other device with wifi and USB.
Video demonstration forthcoming.
- Knobs 1-8
- The knobs are used to control the brightness, hue, and color temperature of the lights.
- Pads 1-8
- Each pad is bound to a lighting scene, which defines the color & brightness of one or more lights. Tapping on a pad will activate its scene, and holding down a pad can be used to re-program a scene.
See the code for more details.
|Akai LPDD8 Laptop Pad Controller|
|Raspberry Pi 3|
|Philips Hue Starter Kit|
Install the python script
$ git clone https://github.com/michael-lazar/hue-pad.git $ cd hue-pad $ pip install .
Register a systemd service to launch at startup (optional)
$ sudo cp hue-pad.service /etc/systemd/system $ sudo systemctl daemon-reload $ sudo systemctl enable hue-pad.service $ sudo systemctl start hue-pad.service
Usage: hue-pad [OPTIONS] Control lighting effects with a MIDI Pad Controller. This script will watch for incoming MIDI events from an Akai LPD8 and use them to update lighting/color effects through a Philips Hue Bridge. Options: --debug / --no-debug Enable verbose logging. --hue-ip TEXT IP address of the Philips Hue Bridge. --db-file TEXT JSON file with lighting scene data. --light-ids TEXT Comma separated list of light IDs to control. [default: 1,2] --help Show this message and exit.
Every pad on the LPD8 can be programmed to store a different lighting "scene". A lighting scene consists of brightness & color values for one or more lights. These scenes are stored in a persistent JSON document in the application's configuration directory.
The Hue Bridge API has it's own concept of "scenes" and "groups" that are built into the firmware. However, accessing and storing these settings introduces a noticeable latency when using the MIDI controller. Therefore, this application only stores and sends commands to lights using their unique IDs.
This project is distributed under the MIT license.