MQTT | Light Sensor

Had a JeeNode Lux Plug on a breadboard for a couple of weeks now. Jumper wires sticking out all over. So it was in due time to mount it in a more permanent manner.

The Lux Plug is a small board containing a TSL2561 chip, which connects to the I²C bus and measures incident light levels.

Two sensors are included, one is sensitive to infrared. An algorithm is used to calculate the light levels in lux, by combining the readings from both sensor types. The total measurable dynamic range is 1 : 1,000,000.

An I²C bus running at 3.3V is used for I/O, with all the power and signal lines brought out to both sides of the board to allow daisy-chaining with other I²C-boards. 3.3V almost screams ESP-8266 so an ESP-01 was selected for the microcontroller.htu21d

Found a nice plastic box and added a BMP180 barometric pressure sensor and an HTU21d temperature and humidity sensor just for fun. Both are happy to run I²C at 3.3v.

IMG_1504-compressedThe box was originally a water resistant enclosure for a single UTP connector.

IMG_1505-compressedI removed the lid and internals.

IMG_1507-compressedThe mounting plate for the UTP connector was reused to mount the Lux Plug.

IMG_1509-compressed

A DC step-down converter was added to convert the 12v from the power bus running through the house down to 3.3v

IMG_1511-compressedAll components mounted and placed.

IMG_1515-compressedTime to close it up and write some code.

IMG_1517-compressed

 

lightsensor001-compressedSince the ESP has a ton of memory and a SPIFFS file system why not add an HTML5 and CSS web page to the design. The data is updated real-time over a WebSockets connection.

lightsensor002-compressedAlso, a nice popup for the MQTT topics I always seem to forget.

The code is on my GitHub for the folks who want to hack away on their own version. This sensor also feeds real-time data to the status page.

Leave a Reply

Your email address will not be published.