The last post acted of examples of the application, but also basic control options, such as the use of a remote control. In this part, the control options are expanded step by step.
In order to be able to implement the projects more easily in this blog post, prior knowledge from the previous parts (Part 1, Part 2) needed.
Control with buttons and motion sensor
WLED offers the option of using physical buttons or motion sensors for control. For example, you can switch light effects with a simple button or automatically control your lighting with a motion sensor.
Button
Simple are suitable for this project Print buttonthat can be connected directly to your ESP8266- or ESP32 board as follows:
Open the WLED user interface as in the previous parts and navigate to LED PREFERENCES. Scroll down to the section Hardware setup. Under Button GPIO Select the corresponding GPIO PIN (GPIO10). Under Time & Macros You can determine which preset is called up when pressing, pressing or pressing twice. To increase the brightness, for example, create a new preset and click on Use Current State, then a text field should now Apicommand open. Enter commands like A = ~ 10 in this field to increase the brightness in 10 steps, for example.
The most important API commands:
& A = |
brightness |
& R = |
Red |
& G = |
Green |
& B = |
Blue |
& Fx = |
effect |
& Fs = |
Effect speed |
With ~ the value is increased, reduced with ~- and, for example, ~ 10 the value is increased by 10 steps, here any value can also be used.
Motion sensor
A PIR movement sensor (Passive INFRArEd; reacts to body heat) like that HC-SR501 It is ideal for recognizing movements and controlling the LEDs accordingly.
Connect the module as follows:
HC-SR501 |
D1mini |
VCC |
3V3 |
Gnd |
Gnd |
OUT |
Gpio12 |
Open the WLED surface and navigate to the LED PREFERENCES. Choose under Pir Sensor GPIO the GPIO pin to which the sensor is connected (in the example above: GPIO12). Under Time & Macros As with the buttons, you can Presets Set which are activated if the motion detector output is concerned or leaves (with the apicommand t = 1 or t = 0 the light can be switched on).
There are two small potentiometers on the PIR sensor: one to adjust the sensitivity and one to control the delay time. Adjust them to ensure that the sensor reacts correctly to movements and that the light only remains activated as long as desired.
Other communication protocols
In addition to direct control, you can also use various communication protocols to connect your setup to other systems or to implement special applications. This makes your WLED installation even more flexible.
Artnet & E1.31
These protocols are often used for professional light shows, for example for stage lighting for concerts or events. You can integrate WLED as part of a DMX network to carry out the controls.
For testing, install software, such as Jinx!, the Artnet or E1.31 supports and combines with the same network in which its WLED board is located.
Open the WLED interface, go to Sync interfaces and go to the option E1.31/Artnet. Compare the DMX start address and the universe with your control software here.
Use the DMX software or a light desk to create effects and scenes. You can then transfer these to your WLED device in real time.
Philips Hue
If you already Philips Hue-Use lighting, you can easily integrate WLED into your existing Hue network. So you can control all lights together.
Open the WLED surface and navigate too Sync interfaces. Give under the option Philips Hue Sync The IP address of your Hue Bridge and select which parameters should be updated.
Http requests
WLED offers a flexible HTTP-API through which you can control the system from any application that can send HTTP requests. Open a browser and enter HTTP commands to control your LEDs (see Api command).
For example:
http: // [WLED-IP]/WIN & T = 1 // switches on the LED
http: // [WLED-IP]/WIN & A = 128 // the brightness sets 50 %
http: // [WLED-IP]/WIN & R = 255 & G = 255 & B = 255 // all LED on
Use UDP commands
UDP is particularly suitable for applications in which a quick reaction to tax commands is necessary. An example of this is the Hyperion Project, which enables Ambilight backlight on a WLED controller (see blog: DIY Ambilight with D1 Mini ESP8266 and Hyperion )
Soundreactive WLED
With the Soundreactive-Wez version of WLED will react to music or audio signals and thus create lighting effects that are synchronized with the rhythm. This is ideal for parties to create simple and dynamic effect lighting. As a microcontroller you need an ESP32, load them like in first part The WLED software with the WLED installer On this. However, choose the special one here AudioActive version out of.
To continue to use the previous configuration, you can save it. Open in the Settings, Security & updates and click on Backup configuration. This downloads the configuration as a file. This can be uploaded again on the new board in the line below.
Next, close an i2s microphone like that Inmp441 to.
microphone |
D1mini |
|
VCC |
3V3 |
|
Gnd |
Gnd |
|
SD |
32 |
|
Sck |
16 |
|
WS |
17 |
In the WLED settings you still have to Usermods Adjust the pin assignment. Furthermore, the reinforcement (gain), noise suppression (squelch), the mathematical conversion (logarithmic, linear, ...) and the dynamics of the light reaction are adjusted.
If you now play music and select a compatible effect, the LEDs move every rhythm.
WLED studio
With WLED studio For example, you can stream photos or videos on a matrix.
Open a terminal on your computer and, if not available, install the latest python and git. Next they clone the Github respository from WLED studio With the following command:
git clone https://github.com/BradyMeighan/WLED-Studio.git
And switch to the directory with:
CD WLED studio
Then the program can be installed with the following commands:
python3 -m venv venv
Source VenV/Bin/Activate # On windows use `venv \ scripts \ activate`
pip install -r Requirements.txt
Open WLED Studio with python main.py In the terminal, carry the IP of your WLED node into the field Host and adjust the number of pixels.
In the software you can stream youtube videos, photos, text or videos via UDP on your WLED Matrix.
Home Assistant Integration
For smart home users, the integration of WLED in Home Assistant is a great way to integrate your lighting into your home automation. For example, you can control WLED with automation based on events or the presence of people.
In the Home Assistant Page, click on Integration. Enter the IP address of your WLED device to add it to Home Assistant.
Octoprint WLED
OctowLED is an expansion that especially for users of 3D printers with the Octoprint Server was developed. This allows you to display the status of your 3D printer (start, break, error) by visual effects on the LED.
Open the Octoprint user interface, go to the settings Plugin manager, look for WLED And install the plug-in.
Or add the following link to the field via external URL: https://github.com/cp2004/OctoPrint-WLED/releases/latest/download/release.zip
Enter the IP address of your WLED device in the plug-in settings and configure the desired colors and effects for different print phases.
The LEDs change their color or start to flash when certain events occur (e.g. printing, heating up).
New effects can be added via the "+" icon.
NacIf you have already got to know the communication through external software in this part, a small light control desk will be built in the next part with the help of an ESP32.
Have fun recovery :)