Arduino Nano - BH1715 Digital Ambient Light Sensor Tutorial

Introduction: Arduino Nano - BH1715 Digital Ambient Light Sensor Tutorial

About: We are a group of makers. We work in IoT, IOS app, android app, embedded design, sensor design, raspberry pi, arduino, beaglebone, particle electron, particle photon, Bluetooth.

The BH1715 is a digital Ambient Light Sensor with an I²C bus interface. The BH1715 is commonly used to obtain the ambient light data for adjusting LCD and Keypad backlight power for mobile devices. This device offers a 16-bit resolution and an adjustable measurement range, allowing detection from .23 to 100,000 lux. Here is its demonstration with Arduino nano.

Step 1: What You Need..!!

Step 2: Connections:

Take an I2C shield for Arduino Nano and gently push it over the pins of Nano.

Then connect the one end of I2C cable to BH1715 sensor and the other end to the I2C shield.

Connections are shown in the picture above.

Step 3: Code:

The Arduino code for BH1715 can be downloaded from our GitHub repository-Dcube Store.

Here is the link for the same :

We include library Wire.h to facilitate the I2c communication of the sensor with the Arduino board.

You can also copy the code from here, it is given as follows:

// Distributed with a free-will license.

// Use it any way you want, profit or free, provided it fits in the licenses of its associated works.

// BH1715

// This code is designed to work with the BH1715_I2CS I2C Mini Module available in Dcube Store.


// BH1715 I2C address is 0x23(35)

#define Addr 0x23

void setup()


// Initialise I2C communication as MASTER


// Initialise Serial Communication, set baud rate = 9600


// Start I2C Transmission


// Send power on command


// Stop I2C Transmission


// Start I2C Transmission


// Send continuous measurement command


// Stop I2C Transmission




void loop()


unsigned int data[2];

// Request 2 byte of data

Wire.requestFrom(Addr, 2);

// Read 2 bytes of data

// ALS msb, ALS lsb

if(Wire.available() == 2)


data[0] =;

data[1] =;



//convert the data

float luminance = ((data[0] * 256) + data[1]) / 1.20;

// Output data to serial monitor

Serial.print("Ambient Light Luminance :");


Serial.println(" lux");


Step 4: Applications:

BH1715 is a digital output ambient light sensor which can be incorporated in Mobile phone, LCD TV, NOTE PC etc. It can also be employed in Portable game machine, Digital camera, Digital video camera, PDA, LCD display and many more devices which require efficient light sensing applications.

Be the First to Share


    • Make it Glow Contest

      Make it Glow Contest
    • Clocks Contest

      Clocks Contest
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge