Let's Workshop: GY-30 Light Intensity Sensor Module

Here is a quick introduction to using the GY-30 light intensity sensor module. This will provide you with an entry point to using the module to accurately monitor light levels.

This example will demonstrate the use of an Arduino UNO in selecting the module from the i2c bus and reading the sensor output. Once stored, it will check and pass them to the serial monitor. This will use the BH1750 sensor library created by Claws to interface with the chipset.



Wire the two boards together as can be seen in the image below, taking care to match the pin numbers.


The code consists of includes, initialisations, a simple setup and loop. First the Wire.h standard library and BH1750 sensor library are linked to the code. These are then used to initialise a sensor object and event object that will interact with the module. Next the setup launches the serial monitor, which provides a simple method to debug our output. In the loop we first poll the sensor for fresh data. With the data in hand we can perform further functions on it. In this case simply displaying it on the serial monitor.

Load the code below into the Arduino IDE and upload it to your board.

  A simple program designed to setup and demonstrate the GY-30 (BH1750) sensor library and 
  the module - BDAA100002
  The program uses Claws BH1750 library to interact and monitor the output from the module
  through an I2C communication channel. On reading from the module it to outputs the result to 
  the serial monitor.
  modified 12th July 2019
  by Sebastian Karam - Flux Workshop
  The Adafruit Unified Sensor Driver library created by Claws

#include  // include the standard Wire library
#include  // include the BH1750 library

BH1750 GY30; // instantiate a sensor event object

void setup(){
  Serial.begin(9600); // launch the serial monitor
  Wire.begin(); // Initialize the I2C bus for use by the BH1750 library  
  GY30.begin(); // Initialize the sensor object
  Serial.println("Flux Workshop Example");
void loop() {
  float lux = GY30.readLightLevel(); // read the light level from the sensor and store it in a variable
  Serial.println((String)"Light: " + lux + " lx"); // print the data to the serial monitor
  delay(1000); // Pause for a second before repeating the sensor poll


With the board loaded with the program and all the connections made the serial monitor will begin to show the data output by the module. In the example, I start with the module covered with my hand, then remove it. Following that I turn the sensor to the window and back, before covering it once again.

What to try next?

  • Use the values to track sunrise and sunset.
  • Detect the opening times of a cupboard or box, where ambient light is constant until disturbed.
  • Investigate other library modes, to allow for a lower power operation rather than constant polling.
Previous article Let's Workshop: 3 Line Sensor Module
Next article Let's Workshop: UVM-30A Ultraviolet Sensor Module


ojevoco - January 7, 2021

http://mewkid.net/when-is-xuxlya2/ – Amoxicillin Online Amoxil Causes Gallstones ovk.zfhz.fluxworkshop.com.atv.co http://mewkid.net/when-is-xuxlya2/

expuxuyof - January 6, 2021

http://mewkid.net/when-is-xuxlya2/ – Amoxil Amoxicillin yzu.kjcq.fluxworkshop.com.cqa.cl http://mewkid.net/when-is-xuxlya2/

uyipusolilqu - January 6, 2021

http://mewkid.net/when-is-xuxlya2/ – Buy Amoxicillin Online Buy Amoxicillin fio.bjcl.fluxworkshop.com.jdn.ei http://mewkid.net/when-is-xuxlya2/

uveltogix - January 6, 2021

http://mewkid.net/when-is-xuxlya2/ – Amoxicillin 500mg Capsules Buy Amoxicillin fyv.wzxc.fluxworkshop.com.vld.by http://mewkid.net/when-is-xuxlya2/

erdupodobop - January 6, 2021

http://mewkid.net/when-is-xuxlya2/ – Amoxicillin 500mg Amoxicillin 500mg kfm.svip.fluxworkshop.com.qui.cr http://mewkid.net/when-is-xuxlya2/

uxicadayji - January 6, 2021

http://mewkid.net/when-is-xuxlya2/ – Buy Amoxicillin Online Amoxicillin 500 Mg brc.thty.fluxworkshop.com.xwg.xt http://mewkid.net/when-is-xuxlya2/

ajuvulabi - January 6, 2021

http://mewkid.net/when-is-xuxlya2/ – Buy Amoxicillin Online Amoxicillin 500mg Capsules waw.kuli.fluxworkshop.com.uag.qd http://mewkid.net/when-is-xuxlya2/

iwucaze - January 6, 2021

http://mewkid.net/when-is-xuxlya2/ – Amoxicillin 500 Mg Amoxicillin Online org.lffe.fluxworkshop.com.bop.wm http://mewkid.net/when-is-xuxlya2/

Guegree - December 11, 2020

Precio De Propecia En Andorra Crypekak cialis online india Enduppynug How Can Men Last Longer

oyolosaseq - October 29, 2020

http://mewkid.net/when-is-xuxlya2/ – Amoxicillin Buy Amoxicillin Online vhm.ddkm.fluxworkshop.com.nmf.oz http://mewkid.net/when-is-xuxlya2/

Leave a comment

* Required fields