Smart Home ESP8266 LED Controller Setup
RGBW 4Kanal Modul

EI-OT ESP8266 RGBW Controller LDR ADC Lichtsensor konfigurieren

EI-OT RGBW LED Controller Module LDR Light Sensor Configuration
LDR ADC Lichtsensor Konfiguration

Das EI-OT ESP8266 4 Kanal RGBW LED Modul kann um einen LDR / Fotowiderstand erweitert werden. Mittels dem LDR kann eine entsprechende Auswertung des  Umgebungslicht durchgeführt werden. Dabei geht es keineswegs um ein Luxmeter, sondern vielmehr um eine Hell- Dunkel- Differenzierung um die Aktivierung oder Deaktivierung der LED Beleuchtung automatisch auszuführen.

Selbstredend muss zur Lichtsensor Konfiguration im Vorfeld der Anschluss und die Einstellung des LDR abgeschlossen sein.

Nachfolgend wird zunächst die grundlegende Konfiguration des LDR als Lichtsensor beschrieben:

  1. klicke auf Einstellungen um das ESP-OS Konfigurationsmenü zu öffnen
  2. klicke im ESP-OS Konfigurationsmenü auf Gerät konfigurieren
  3. wähle im Drop Down GPIO17 ADC Licht aus
  4. klicke auf den Button Speichern 
  5. ESP-OS speichert die Konfiguration und führt einen Neustart des  ESP8266 aus
  6. Nach erfolgreichem Neustart erscheint die Benutzeroberfläche und gibt den aktuellen Beleuchtungswert aus.

Wie bereits erwähnt dient der LDR nicht als Luxmeter, hierzu bedarf es einer Kalibrierung unter Zuhilfenahme eines Messgeräts zur Bestimmung eines Referenzwertes. Der LDR dient zur Differenzierung zwischen hell und dunkel, im Detail Ermittlung eines Schaltpunkt / Schwellenwert.

LDR ADC Light Sensor Configuration

The EI-OT ESP8266 4-channel RGBW LED module can be expanded with an LDR / photoresistor. A corresponding evaluation of the ambient light can be carried out using the LDR. This is by no means a lux meter, but rather a light-dark differentiation in order to automatically activate or deactivate the LED lighting.

Please make sure connection and setting of the LDR is correct.

Configuration of the LDR ADC Light Sensor:

  1. click on Configuration
  2. in the ESP-OS Configuration Menu click on Configure Module
  3. select in GPIO17 Drop Down List ADC Light
  4. click on Button  Save
  5. soon as Parameters saved, ESP-OS initiate a reboot
  6. after reboot ESP-OS reloads the Webinterface will show actual ambient light value

As already mentioned, the LDR does not serve as a lux meter, this requires calibration with the help of a measuring device to determine a reference value. The LDR is used to differentiate between light and dark, in detail determining a switching point / threshold.

Tasmota Rule light-dependent control EI-OT RGBW LED Controller Module
Lichtsensor Regel

Wie im Vorfeld bereits erwähnt dient der LDR als Lichtsensor zur Differenzierung zwischen Hell und Dunkel. Im Detail wird dazu ein Schwellenwert

  • wann ist dunkel / soll das LED Licht eingeschaltet
  • wann ist hell / soll das LED Licht ausgeschaltet

werden.

Ohne zu sehr ins Detail zu gehen, der folgenden Regel werden folgende Eckdaten zugrunde gelegt

  • Schwellenwert Dunkel < 30
  • Schwellwert Hell > 29
  • var1 ist die Variable die den Betriebsmodus festlegt
    0 = automatische (lichtabhängige) Steuerung ist deaktiviert
    1 = automatische (lichtabhängige) Steuerung ist aktiviert
    2 = automatische (lichtabhängige) Steuerung ist temporär deaktiviert
  • var2 hier wird der aktuelle Wert / Lux zwischengespeichert

Zu beachten ist dabei, wird das LED Licht manuell eingeschaltet während var1 ==1 ist (die lichtabhängige Steuerung aktiv ist), so schaltet das LED Licht wieder ab, da var2 also der Helligkeitswert zu hoch ist. Diesbezüglich wird bei dem manuellen Schalten der wert in var1 auf 2 gesetzt (temporär deaktiviert). Wird das LED Licht manuell wieder ausgeschaltet wird var1 wieder auf 1 gesetzt, sodass die lichtabhängige Steuerung wieder aktiv ist.

Die Tasmota Regel lautet wie folgt: Rule2 ON Analog#Illuminance DO var2 %value% ENDON ON Power1#State = 1 DO IF (%var1%==1 (AND var2>29)) var1 2 ENDIF ENDON ON Power1#State = 0 DO IF (%var1%==2) var1 1 ENDIF ENDON ON Analog#Illuminance<30 DO IF(%var1%==1) Power1 ON ENDIF ENDON ON Analog#Illuminance>29 DO IF(%var1%==1) Power1 OFF ENDIF ENDON

und wird wie folgt konfiguriert:

  1. klicke auf Konsolen um das ESP-OS Konsolenmenü zu öffnen
  2. klicke im ESP-OS Konsolenmenü auf Konsole
  3. gebe in die Kommandozeile Rule2 ON Analog#Illuminance DO var2 %value% ENDON ON Power1#State = 1 DO IF (%var1%==1 (AND var2>29)) var1 2 ENDIF ENDON ON Power1#State = 0 DO IF (%var1%==2) var1 1 ENDIF ENDON ON Analog#Illuminance<30 DO IF(%var1%==1) Power1 ON ENDIF ENDON ON Analog#Illuminance>29 DO IF(%var1%==1) Power1 OFF ENDIF ENDON ein und drücke die Taste Enter
  4. zusätzlich muss nun der Grundwert der lichtabhängigen Steuerung also von var1 gesetzt werden, gebe hierzu var1 1 in die Kommandozeile ein und drücke die Taste Enter
  5. gebe in die Kommandozeile Rule2 1 ein und drücke die Taste Enter um die Rule2 zu aktivieren. Nachdem die Rule2 aktiviert wurde, wird in der Konsole fortlaufend die Rule2 ausgeführt und der LDR Sensor  aktualisiert

Dunkelt man nun die Sensorfläche des LDR ab, schalten sich die LED’s eigenständig an, bzw. fällt Licht auf die LDR Sensorfläche werden die LED’s eigenständig abgeschaltet.

Um die lichtabhängige Steuerung zu deaktivieren muss entweder var1 0 oder Rule2 0 in die Kommandozeile eingegeben werden und mittels Enter Taste bestätigt werden.

Light Sensor Rule

As already mentioned, the LDR serves as a light sensor to differentiate between light and dark. A threshold value is used for this in detail

  • when is it dark / LED light switched on
  • when is bright / LED light switched off

The tasmota rule is based on

  • Threshold Dark < 30
  • Threshold light > 29
  • var1 is the variable that defines the operating mode
    0 = automatic (light-dependent) control is deactivated
    1 = automatic (light-dependent) control is activated
    2 = automatic (light-dependent) control is temporarily deactivated
  • var2 the current value / lux is temporarily stored here

Note:
If the LED light is switched on manually while var1 ==1 (during light-dependent control is active), the LED light switches off again because var2, i.e. the brightness value is too high. In this regard, the value in var1 is set to 2 (light-dependent control temporarily deactivated) when switching manually. If the LED light is switched off again manually, var1 is set to 1 again so that the light-dependent control is active again

Tasmota rule: Rule2 ON Analog#Illuminance DO var2 %value% ENDON ON Power1#State = 1 DO IF (%var1%==1 (AND var2>29)) var1 2 ENDIF ENDON ON Power1#State = 0 DO IF (%var1%==2) var1 1 ENDIF ENDON ON Analog#Illuminance<30 DO IF(%var1%==1) Power1 ON ENDIF ENDON ON Analog#Illuminance>29 DO IF(%var1%==1) Power1 OFF ENDIF ENDON

Tasmota Rule configuration:

  1. click on Consoles
  2. in the ESP-OS Consoles Menu click on Console
  3. type Rule2 ON Analog#Illuminance DO var2 %value% ENDON ON Power1#State = 1 DO IF (%var1%==1 (AND var2>29)) var1 2 ENDIF ENDON ON Power1#State = 0 DO IF (%var1%==2) var1 1 ENDIF ENDON ON Analog#Illuminance<30 DO IF(%var1%==1) Power1 ON ENDIF ENDON ON Analog#Illuminance>29 DO IF(%var1%==1) Power1 OFF ENDIF ENDON in the command line and press Enter Key
  4. also, the basic value of the light-dependent control must now be set by var1. To do this, enter var1 1 in the command line and press the Enter key
  5. type Rule2 1 in the command line and press Enter key to activate Rule2. After Rule2 has been activated, Rule2 is continuously executed in the console and the LDR sensor is updated

If you now darken the sensor surface of the LDR, the LEDs switch on, or if light falls on the LDR sensor surface, the LEDs are switched off.

To deactivate the light-dependent control, either var1 0 or Rule2 0 must be entered in the command line and confirmed by pressing the Enter key.