Home LCD Projects TSL2561 based lux meter

TSL2561 based lux meter

by shedboy71

Another project – this time were building another lux meter, we will use a TSL2561 sensor and display the readings on an LCD keypad shield

Lets recap some information regarding the sensor

This TSL2561 is an I2C light-to-digital converter TSL2561 that transforms light intensity to a digital signal. The TSL2561 features a selectable light spectrum range due to its dual light sensitive diodes: infrared and full spectrum. You can switch among three detection modes to take your readings. They are infrared mode, full spectrum and human visible mode.

When running under the human visible mode, this sensor will give you readings just close to your eye feelings.


Selectable detection modes
High resolution 16-Bit digital output at 400 kHz I2C Fast-Mode
Wide dynamic range: 0.1 – 40,000 LUX
Wide operating temperature range: -40°C to 85°C
Programmable interrupt function with User-Defined Upper and lower threshold settings

Here is a typical module that makes it easier to work with the sensor


Parts List

Description Product links
Arduino Uno 1pcs UNO R3 CH340G+MEGA328P for Arduino UNO R3 (NO USB CABLE)
LCD Keypad shield 1PCS LCD Keypad Shield LCD 1602 Module Display For Arduino
TSL2561 module 1pcs GY-2561 TSL2561 Luminosity Sensor Breakout infrared Light Sensor module
Connecting wire 40pcs Dupont jumper wire cable 30cm male to male,female to female,male to female Dupont jump wire line 2.54mm breadboard cable


lcd keypad and tsl2561

lcd keypad and tsl2561



You need to install the Adafruit TSL2561 and unified sensor libraries in the Arduino library manager

[codesyntax lang=”cpp”]

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_TSL2561_U.h>
#include <LiquidCrystal.h>

//setup for the LCD keypad shield
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

Adafruit_TSL2561_Unified tsl = Adafruit_TSL2561_Unified(TSL2561_ADDR_FLOAT, 12345);

void setup() 
  //init serial for some debug
  Serial.println("Light Sensor Test"); 
  // setup sensor and configure
    Serial.print("no TSL2561 detected!");
  //init LCD
  //line 1 - temperature
  lcd.print("Lux: ");

void loop() 
  // put your main code here, to run repeatedly:
  /* Get a new sensor event */ 
  sensors_event_t event;
  /* Display the results (light is measured in lux) */
  if (event.light)
    Serial.println("Sensor overload");

void configureSensor(void)
  tsl.enableAutoRange(true);            /* Auto-gain ... switches automatically between 1x and 16x */
  tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_13MS);      /* fast but low resolution */



You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More