Ambient Light Sensor


There are 2 possible solutions, based on how much effort you're willing to put into the sensor and how much you care about the price and looks.

No-solder sensor


  1. Clean
  2. Easy to make
  3. Readily available parts
  4. Expensive
  5. A bit bulky



  1. Connect one end of the Stemma QT cable to the QT connector of the Metro ESP32-S2 board
  2. Connect the other end of the Stemma QT cable to any of the QT connectors of the TSL2591 sensor

no solder sensor metro esp32 s2 stemma qt tsl2591

Solder or wire-through-hole


  1. Cheap
  2. Compact
  3. Not so clean looking
  4. Needs a bit more manual work
  5. Parts are not always in stock



  1. Connect one end of the Stemma QT cable to any of the QT connectors of the TSL2591 sensor
  2. Route the wires as the following:
    • Black wire to ground (the pin marked with G right between the Li-Poly connector and the pin 12)
    • Red wire to 3 volts (the pin marked with 3V right between the antenna and the pin 22)
    • Blue wire to pin 19
    • Yellow wire to pin 23
  3. Insert the male header of each wire into the pin hole and:
    • either solder the pin to the hole
    • ...or bend the pin around the hole so that it always makes contact with the metal around the hole and stays in place

solder sensor lolin32 stemma qt tsl2591 solder sensor nodemcu stemma qt tsl2591


Lunar has an automated process for installing the firmware on ESP32 boards.

Click on Install firmware on Ambient Light Sensor in the Lunar menu to start the process: lunar menu bar icon lunar install firmware menu item


A small window with firmware parameters will appear.

ambient light sensor firmware installer credentials


After clicking the Start button, Lunar will begin a three step process:

ambient light sensor firmware installing

Installation done

If the installation finished successfully, you will see a message as in the image below.

You can click on the Done button to close the window and let Lunar search for the sensor on the local network.

ambient light sensor firmware install done

Sensor Mode Detection

If the sensor booted into the new firmware and connected to the local network, you will notice that Lunar has made Sensor Mode available in the mode dropdown from the top-right part of the Lunar window.

You can click on it to activate it, or choose Auto Mode if you want Lunar to automatically fallback to other modes if the sensor becomes unavailable. sensor mode menu item

Lux value

When Sensor Mode is activated, you can also see the current ambient light around the sensor in the Lunar menu. lunar menu bar icon lunar menu lux


Error on flashing the firmware

If you get an error on the firmware installation process, you should see a View logs button. Click it to open the logs in a log viewer.

You can also view the logs manually by opening /tmp/lunar-sensor-install.log in any text editor.

If you don't understand the error from the logs, you can upload them on Lunar's Discord community and I'll take a look.

If you understand the error, you may try to tweak the firmware:

Lunar doesn't detect the sensor

First check if the sensor booted and connected to the local network: