Multiple BH1750 on i2c bus Digital Light Sensor + Arduino (16xBH1750)


This project was made with the collobaration of my brother who is proffessor at the faclty of architecture at Selcuk University Konya Turkey. He asked me

for a system which could  measure  light intensity in 16 different points in a house. And then I started to  make search and decided to do the job with

  • Arduino mega.
  • We purchased 20 pcs BH1750 light sensors from eBay at a very good prices.

– Two pieces CD74HC4067 Analog/Digital MUX Breakout 

I started to build the shield on a protoboard

Wiring was’nt easy though with patience everything can be done

2x CD74HC4067 Analog/Digital was used to multiplexe  SDA and SCL channel of the arduino board.

and th socket was soldered for each light sensor. The sensor cable was prepared.

Here in this picture about 12 sensor connection had been done.

First test with the PC software. All sensor data are directed to the serial port of the arduino. And the data was collected with a RS232 software

I used Realterm for that purpose.

Here in this picture we may see 12 Bh1750 sensor measurement every 10 seconds.

And the source code for this project open to further development.

// Driver Written By : Mohannad Rawashdeh
// Inspired from
// Merged and programmed by Suleyman Canan for 16xBH1750 light sensors

#include <Wire.h>
#include <BH1750FVI.h>

BH1750FVI LightSensor;
//Mux control pins
int s0 = 7;
int s1 = 6;
int s2 = 5;
int s3 = 4;

void setup() {   // put your setup code here, to run once:
  pinMode(s0, OUTPUT);
  pinMode(s1, OUTPUT);
  pinMode(s2, OUTPUT);
  pinMode(s3, OUTPUT);
  pinMode(13, OUTPUT); 

  digitalWrite(s0, LOW);
  digitalWrite(s1, LOW);
  digitalWrite(s2, LOW);
  digitalWrite(s3, LOW);
   set the Working Mode for this sensor 
   Select the following Mode:
    The data sheet recommanded To use Continuous_H_resolution_Mode



void loop() {

digitalWrite(13, LOW);
for(int i = 0; i < 12; i ++){

  uint16_t lux = LightSensor.GetLightIntensity();// Get Lux value
  Serial.print(": ");
  Serial.print("   ");
  Serial.println(" lux");

int readMux(int channel){

int controlPin[] = {s0, s1, s2, s3};

  int muxChannel[16][4]={
    {0,0,0,0}, //channel 0
    {1,0,0,0}, //channel 1
    {0,1,0,0}, //channel 2
    {1,1,0,0}, //channel 3
    {0,0,1,0}, //channel 4
    {1,0,1,0}, //channel 5
    {0,1,1,0}, //channel 6
    {1,1,1,0}, //channel 7
    {0,0,0,1}, //channel 8
    {1,0,0,1}, //channel 9
    {0,1,0,1}, //channel 10
    {1,1,0,1}, //channel 11
    {0,0,1,1}, //channel 12
    {1,0,1,1}, //channel 13
    {0,1,1,1}, //channel 14
    {1,1,1,1}  //channel 15

  for(int i = 0; i < 4; i ++){
    digitalWrite(controlPin[i], muxChannel[channel][i]);

3 thoughts on “Multiple BH1750 on i2c bus Digital Light Sensor + Arduino (16xBH1750)”

  1. Hi,i need your help for a project.i leave here my email for contacto. The project consiste in conectados 4 of this sensores to make a solar tracker. Can you contacto me please.
    Best regards.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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