Grove - Light Sensor

enter image description here

The Grove - Light sensor integrates a photo-resistor(light dependent resistor) to detect the intensity of light. The resistance of photo-resistor decreases when the intensity of light increases. A dual OpAmp chip LM358 on board produces voltage corresponding to intensity of light(i.e. based on resistance value). The output signal is analog value, the brighter the light is, the larger the value.

This module can be used to build a light controlled switch i.e. switch off lights during day time and switch on lights during night time.


The light sensor value only reflects the approximated trend of the intensity of light, it DOES NOT represent the exact Lumen.


Product Version Changes Released Date
Grove - Light Sensor 1.0 Initial Apr 28 2013
Grove - Light Sensor(P) Move Grove connector to back side May 15 2014
Grove - Light Sensor(P) V1.1 Replace photoresistor-5528 with LS06-S Vs.Grove - Light Sensor(P) Dec 31 2015
Grove - Light Sensor 1.2 Replace photoresistor-5528 with LS06-S Vs.Grove - Light Sensor 1.0 Jan 20 2016


  • Analog value output
  • High reliability and sensibility
  • Small footprint
  • Recognize wider spectrum


More details about Grove modules please refer to Grove System

Platform Support

Arduino Raspberry Pi BeagleBone Wio LinkIt ONE


The platforms mentioned above as supported is/are an indication of the module's hardware or theoritical compatibility. We only provide software library or code examples for Arduino platform in most cases. It is not possible to provide software library / demo code for all possible MCU platforms. Hence, users have to write their own software library.


Item Value
Operating voltage 3~5V
Operating current 0.5~3 mA
Response time 20-30 milliseconds
Peak Wavelength 540 nm
Weight 4 g

Getting Started

Play With Arduino


  • Step 1. Prepare the below stuffs:
Seeeduino V4 Base Shield Grove - Light Sensor Grove - LED Bar
enter image description here enter image description here enter image description here enter image description here
Get One Now Get One Now Get One Now Get One Now
  • Step 2. Connect Grove-Light Sensor to port A0 of Grove-Base Shield.
  • Step 3. Connect Grove-Led Bar to port D2 of Grove-Base Shield.
  • Step 4. Plug Grove - Base Shield into Seeeduino.
  • Step 5. Connect Seeeduino to PC through a USB cable.


If we don't have Grove Base Shield, We also can directly connect Grove-Light Sensor to Seeeduino as below.

Seeeduino Grove-Light Sensor
5V Red
GND Black
Not Conencted White
A0 Yellow
Seeeduino Grove-Led Bar
5V Red
GND Black
D3 White
D2 Yellow


#include <Grove_LED_Bar.h>

Grove_LED_Bar bar(3, 2, 0);  // Clock pin, Data pin, Orientation

void setup()
  // nothing to initialize

void loop()

  int value = analogRead(A0);
  value = map(value, 0, 800, 0, 10);

  • Step 2. The Led bar will change base on light.

Play With Raspberry Pi


  • Step 1. Prepare the below stuffs:
Raspberry pi GrovePi_Plus Grove - Light Sensor Grove - Red LED
enter image description here enter image description here enter image description here enter image description here
Get One Now Get One Now Get One Now Get One Now
  • Step 2. Plug the GrovePi_Plus into Raspberry.
  • Step 3. Connect Grove-light sensor to A0 port of GrovePi_Plus.
  • Step 4. Connect Grove-Red Led to D4 port of GrovePi_Plus.
  • Step 5. Connect the Raspberry to PC through USB cable.


  • Step 1. Follow Setting Software to configure the development environment.
  • Step 2. Git clone the Github repository.
cd ~
git clone https://github.com/DexterInd/GrovePi.git
  • Step 3. Excute below commands.
cd ~/GrovePi/Software/Python
python grove_light_sensor.py

Here is the grove_light_sensor.py code.

import time
import grovepi

# Connect the Grove Light Sensor to analog port A0
light_sensor = 0

# Connect the LED to digital port D4
led = 4

# Turn on LED once sensor exceeds threshold resistance
threshold = 10


while True:
        # Get sensor value
        sensor_value = grovepi.analogRead(light_sensor)

        # Calculate resistance of sensor in K
        resistance = (float)(1023 - sensor_value) * 10 / sensor_value

        if resistance > threshold:
            # Send HIGH to switch on LED
            # Send LOW to switch off LED

        print("sensor_value = %d resistance = %.2f" %(sensor_value,  resistance))

    except IOError:
        print ("Error")
  • Step 4. The led will turn on when the light sensor gets covered.
pi@raspberrypi:~/GrovePi/Software/Python $ python grove_light_sensor.py
sensor_value = 754 resistance = 3.57
sensor_value = 754 resistance = 3.57
sensor_value = 752 resistance = 3.60
sensor_value = 752 resistance = 3.60
sensor_value = 752 resistance = 3.60
sensor_value = 313 resistance = 22.68
sensor_value = 155 resistance = 56.00
sensor_value = 753 resistance = 3.59


enter image description here

Here we will show you a project made with Grove - Light Sensor - Secret Box. First you need a box, a paper box, wooden box, any box is ok. Put something in the box, because we named it secret box, that means we don't want anybody to open it, otherwise there will be an alarm to inform you.

Here we use LinkIt ONE as the controller, which is an Arduino compatible board and consist of rich function. And you need things below:

  • LinkIt ONE
  • Grove - Light Sensor
  • Grove - Base Shield
  • A Sim Card

Let's connect Grove - Light Sensor to A0 or Base Shield, and open Arduino IDE, copy below code and upload the example to LinkIt ONE. Then someone open the box, the light will detect it, and send you a SMS.

// demo of Grove Starter kit for LinkIt ONE
// Secret box

#include <LGSM.h>

char num[20] = "13425171053";           // your number write here
char text[100] = "Warning: Your box had been opened!!";    // what do you want to send

const int pinLight = A0;                // light sensor connect to A0

bool isLightInBox()
    return (analogRead(pinLight)<50);   // when get data less than 50, means light sensor was in box

void setup()

    while(!isLightInBox());             // until put in box

void loop()
    if(!isLightInBox())                 // box is open
        Serial.println("box had been opened");


        Serial.println("SIM ready for work!");

            Serial.println("SMS is sent");
            Serial.println("SMS send fail");

        while(!isLightInBox());             // until put in box


Have fun.

Tech Support

Please do not hesitate to contact techsupport@seeed.cc if you have any technical issue. Or submit the issue into our forum.