Ambient2 Click: an Arduino tutorial


Ambient 2 click is a breakout board for the OPT3001 Ambient Light sensor from Texas Instruments, a single-chip lux meter that measures the intensity of light, as seen by the human eye. It has a strong IR rejection and a spectral response that matches the human vision.

This blog post is more than two years old.

This blog post is inspired from a project I had to complete last week, involving some measurements of the ambient light over an extended period. As the project was focused mainly on the changes in light intensity, I came with the idea of building an ambient light data logger. My approach was to use the Ambient2 click, one microSD card click and one (3.3V) Arduino Pro. Something like this:

Measuring ambient light with Arduino and Ambient2 Click

Measuring ambient light with Arduino and Ambient2 Click

The hardware was just a matter of minutes to complete. But the software proved to be a big, nasty issue. A major headache came from the OPT3001 sensor: none of the libraries I found on the Internet worked fine…

While testing my data logger, I had two other devices to compare against: one Mastech MS6610 light meter, and my Sekonic flash meter, which is also able to measure light intensity.

The Mastech is more than ten years old, so it’s probably a bit decalibrated. The newer Sekonic is build mainly to measure short pulses of light, and it’s not so precise on measuring ambient light in lux. Anyway, both instruments have provided measurements that are reasonably close to each other (somewhere in a 20% margin). That was expected, as each instrument has a different spectral sensitivity. The angle of incidence of the light was also different for each instrument. Moreover, the Sekonic has two settings for the incidence angle (I used the wide-angle setting).


And then came the surprise: with several code libraries for OPT3001 the measurements were way off. And when I say way off I mean at least one order of magnitude. Even the code example provided by MikroElektronika didn’t provide the expected results – there’s a mistake in the code that messes up the computation of lux values. Other code libraries had even bigger isues – like computing the lux values as uint16_t instead of casting to float.

So, I had to start from zero – and I wrote my own code. But this time I decided to do a little bit more, and I released the code as a library so that anyone can include it easily into their projects.

I can confirm that my library works fine on Arduino Pro (3.3V version) and the ChipKIT Uno32. It doesn’t with the Arduino Due or the Flip & Click, the reason being the flawed I2C library on SAM3X8E microcontrollers.

The download link is

1 2

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.