news and interesting stuff from the codebender team

Main menu

[tutorial] How to Measure LUX With Arduino

Introduction

In this tutorial we will use the Adafruit TSL2561 sensor to measure LUX with Arduino.

The TSL2561 luminosity sensor is an advanced digital light sensor, ideal for use in a wide range of light situations. Compared to low cost CdS cells, this sensor is more precise, allowing for exact lux calculations and can be configured for different gain/timing ranges to detect light ranges from up to 0.1 – 40,000+ Lux on the fly.

The best part of this sensor is that it contains both infrared and full spectrum diodes! That means you can separately measure infrared, full-spectrum or human-visible light. Most sensors can only detect one or the other, which does not accurately represent what human eyes see (since we cannot perceive the IR light that is detected by most photo diodes)

So, let’s get started!

What you will need

For this tutorial you will need:

Arduino uno

Breadboard

Adafruit TSL2561 module

some breadboard cables

and a flashlight

Breadboard Circuit Schematic

The connections are pretty easy, see the above image with the breadboard circuit schematic.

The Code

Here’s the code, embedded using Codebender!

Try downloading the Codebender plugin and clicking on the “Run on Arduino” button to program your Arduino board. And that’s it, you’ve programmed your Arduino with this sketch!

Serial Monitor- Testing

Press the connect button to start the serial communication.

Well done!

You have successfully completed one more “How to” tutorial and you learned how to use the Adafruit TSL2561 Luminosity sensor with Arduino.