HowTo: pxlBlck – Automatic setting of the display brightness via LDR

If you not only want to stay informed about events with your pxlBlck and also use it to display the current time, then it might be you noticed that a fixed display brightness doesn’t always match to every situation.

Especially if you have your pxlBlck near a window, you have to set the display brightness relatively high to be able to read the time properly during the day. Unfortunately, the same brightness setting for twilight or night is again too bright.

But this problem can be solved easily. Everything you need is described in this article.

Safety instructions

I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance.

Affiliate links / advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and shop via this link, receives a commission from the online shop or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support in being able to offer further useful projects in the future. 🙂


For the construction you have to master soldering tasks. The following articles provide tips on how to do this.

You should also have already set up and programmed your pxlBlck. You can find information about this in the following articles.

Required tools:

Required material:

In the following list you will find all the parts you need to assemble.

Connect an LDR to the ESP8266

So that the ESP8266, which is built into your pxlBlck, can sense the ambient brightness, you must first connect an LDR. This is a light-dependent resistor, the resistance of this kind of resistor depends on the ambient brightness of the LDR.

If the brightness changes, the resistance of the LDR also changes. If the LDR is connected to the ESP8266 via a voltage divider, this resistance and thus the brightness can be measured indirectly using the ADC.

The connection of the LDR is described in detail in the following articles on the various pxlBlck platforms.

You can also see the basic circuit diagram for connecting a LDR to an ESP8266 on the following circuit diagram.

Basically, a LDR is connected to an ESP8266 according to the following circuit diagram.

Configure the ADC of the ESP8266

So that the brightness values of the connected LDR can be sensed, you must first configure the analog digital converter of the ESP8266. Thanks to ESPEasy, this is done quickly.

To do this, switch to the web interface of your ESPEasy device. To do this, enter the IP address of the device in the address line of your browser.

How to find the IP address of devices in your network is also described in the article Displaying/Finding out the IP address of the devices in the network.

Then switch to the “Devices” area.

All configured devices are now listed in the table shown.

Now click on the “Edit” button in the first empty line.

You will now be redirected to a page where you can configure a device.

In order to configure the analog digital converter you have to choose the entry

Analog input – external


Now you should configure the device “Analog input – external” as indicated in the picture on the left.

You then have to confirm the settings by clicking on “Submit”.

Activate and configure rules

After configuring the analog digital converter, you only have to configure the correct “rules” so that changes in the ambient brightness also lead to changes in the set display brightness.

To do this, click on the button (marked in red) for the “Tools” tab

Now you have to switch to the “Advanced” page. To do this, click on the button marked in red.

Activates the ability to configure rules by activating the checkbox in the “Rules” section.

Confirm these settings by clicking on “Submit”

After you have pressed the button, you may have to reload the page again so that …

… the button for the “Rules” becomes visible.

Now click on it to open the “Rules” tab.

Now enter the following rule in the Rules text field (highlighted in red).

On ADC#Analog do

This rule means that the current display brightness is adapted to the ambient brightness every second.

You can find more information about this command in the article pxlBlck – Commands for configuring the pxlBlck

You can also see whether the automatic setting of the brightness is working correctly in the device tab.

There (in the red marked area) the currently read brightness of the LDR and the resulting display brightness are displayed and updated.

I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂


P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂

Buy Me a Coffee at


  1. Hallo Fabian,

    könntest du mir bitte die Werte aus der Two Point Calibration erläutern.
    Ich hätte nämlich gerne die LEDs 1 – 2 Stufen heller, als bei der jetzigen Einstellung.


    1. Hey Anke,
      die Two-Point-Calibration ist eigentlich eine Skalierung. (Der Name ist etwas unglücklich gewählt finde ich.) Damit wird der Wertebereich des ADCs auf einen neuen Wertebereit skaliert. Im Fall des ESPs kann der ADC Werte zwischen 0 und 1023 annehmen. Da der LDR über einen Spannungsteiler angeschlossen ist bewegt sich dieser Bereich (je nach Helligkeit) zwischen 0 und 400. Dies variiert natürlich etwas nach Aufstellort. Wenn du es genau “einmessen” willst könntest du den Haken bei “Calibration enabled” entfernen und dir dann die Werte des ADCs bei Dunkelheit und maximaler Beleuchtung (zum Beispiel Tagsüber oder Zimmerbeleuchtung an) aufschreiben. Die Werte trägst du dann unter Point 1 (Wert bei Dunkelheit) und Point 2 (Wert bei maximaler Helligkeit) ein.
      Nun zu der eigentlichen Skalierung:
      Da das pxlBlck plugin die Helligkeit mit einem Wertebereich von 1-15 einstellt, muss der Wertebereich des ADCs nun noch auf den Wertebereich des pxlBlck plugins skaliert werden. In dem im Beitrag gezeigten Beispiel wird also der Wertebereich 0-400 auf den Wertebereich 0-10 skaliert. Das heißt der ADC Wert 0 wird zu einer 0 skaliert, der ADC Wert 200 wird zu einer 5 skaliert und der ADC Wert 400 wird zu einer 10 skaliert. Auch Werte über oder unter 400 bzw. 0 werden so skaliert. Ein ADC von 600 ergibt so zum Beispiel einen skalierten Wert von 15. 🙂
      Ich hoffe ich habe es verständlich erklärt. Ansonsten gib gerne nochmal bescheid. 🙂
      Beste Grüße

Leave a Reply

Your email address will not be published.