Skip to main content

Grove - Light Sensor

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.

Upgradable to Industrial Sensors

With the SenseCAP S2110 controller and S2100 data logger, you can easily turn the Grove into a LoRaWAN® sensor. Seeed not only helps you with prototyping but also offers you the possibility to expand your project with the SenseCAP series of robust industrial sensors.

SenseCAP S210x series industrial sensors provide an out-of-box experience for environmental sensing. Please refer to the S2102 Wireless Light Intensity Sensor with higher performance and robustness for light intensity detection. The series includes sensors for soil moisture, air temperature and humidity, light intensity, CO2, EC, and an 8-in-1 weather station. Try the latest SenseCAP S210x for your next successful industrial project.

SenseCAP Industrial Sensor
S2102 Light


Product VersionChangesReleased Date
Grove - Light Sensor 1.0InitialApr 28 2013
Grove - Light Sensor(P)Move Grove connector to back sideMay 15 2014
Grove - Light Sensor(P) V1.1Replace photoresistor-5528 with LS06-S Vs.Grove - Light Sensor(P)Dec 31 2015
Grove - Light Sensor 1.2Replace photoresistor-5528 with LS06-S Vs.Grove - Light Sensor 1.0Jan 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

ArduinoRaspberry Pi

The platforms mentioned above as supported is/are an indication of the module's software 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.


Operating voltage3~5V
Operating current0.5~3 mA
Response time20-30 milliseconds
Peak Wavelength540 nm
Weight4 g

Getting Started

Play With Arduino


  • Step 1. Prepare the below stuffs:
Seeeduino V4Base ShieldGrove - Light SensorGrove - LED Bar
Get One NowGet One NowGet One NowGet 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.

SeeeduinoGrove-Light Sensor
Not ConenctedWhite
SeeeduinoGrove-Led Bar


#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 Codecraft


Step 1. Connect a Grove - Light Sensor to port A0 of a Base Shield.

Step 2. Plug the Base Shield to your Seeeduino/Arduino.

Step 3. Link Seeeduino/Arduino to your PC via an USB cable.


Step 1. Open Codecraft, add Arduino support, and drag a main procedure to working area.


If this is your first time using Codecraft, see also Guide for Codecraft using Arduino.

Step 2. Drag blocks as picture below or open the cdc file which can be downloaded at the end of this page.

Upload the program to your Arduino/Seeeduino.


When the code finishes uploaded, you will see the brightnedd value displayed in the Serial Monitor.

Play With Raspberry Pi (With Grove Base Hat for Raspberry Pi)


  • Step 1. Things used in this project:
Raspberry piGrove Base Hat for RasPiGrove - Light Sensor
Get ONE NowGet ONE NowGet ONE Now
  • Step 2. Plug the Grove Base Hat into Raspberry.
  • Step 3. Connect the light sensor to port A0 of the Base Hat.
  • Step 4. Connect the Raspberry Pi to PC through USB cable.

For step 3 you are able to connect the light sensor to any Analog Port but make sure you change the command with the corresponding port number.



If you are using Raspberry Pi with Raspberrypi OS >= Bullseye, you have to use this command line only with Python3.

  • Step 1. Follow Setting Software to configure the development environment.
  • Step 2. Download the source file by cloning the library.
cd ~
git clone

  • Step 3. Excute below commands to run the code.
python3 0

Following is the code.

import math
import sys
import time
from grove.adc import ADC

class GroveLightSensor:

def __init__(self, channel): = channel
self.adc = ADC()

def light(self):
value =
return value

Grove = GroveLightSensor

def main():
if len(sys.argv) < 2:
print('Usage: {} adc_channel'.format(sys.argv[0]))

sensor = GroveLightSensor(int(sys.argv[1]))

print('Detecting light...')
while True:
print('Light value: {0}'.format(sensor.light))

if __name__ == '__main__':


If everything goes well, you will be able to see the following result corresponding to the surrounding light

pi@raspberrypi:~/ $ python3 0
Detecting light...
Light value: 600
Light value: 448
Light value: 267
Light value: 311
Light value: 102
Light value: 82
Light value: 63
Light value: 54
Light value: 49
Light value: 45
Light value: 545
^CTraceback (most recent call last):
File "", line 67, in <module>
File "", line 64, in main

You can quit this program by simply press ++ctrl+c++.


You may have noticed that for the analog port, the silkscreen pin number is something like A1, A0, however in the command we use parameter 0 and 1, just the same as digital port. So please make sure you plug the module into the correct port, otherwise there may be pin conflicts.

Play With Raspberry Pi (with GrovePi_Plus)


  • Step 1. Prepare the below stuffs:
Raspberry piGrovePi_PlusGrove - Light SensorGrove - Red LED
Get One NowGet One NowGet One NowGet 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.



If you are using Raspberry Pi with Raspberrypi OS >= Bullseye, you have to use this command line only with Python3.

  • Step 1. Follow Setting Software to configure the development environment.
  • Step 2. Git clone the Github repository.
cd ~
git clone

  • Step 3. Excute below commands.
cd ~/GrovePi/Software/Python

Here is the 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 $ python3
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

Eagle File for Grove - Light Sensor V1.0

Eagle File for Grove - Light Sensor(P) V1.0

Eagle File for Grove - Light Sensor(P) V1.1


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.


Grove - Introduction in a Light Sensor:

The Environment Cube! Know the Land Beneath You using Sigfox: A cube with all the necessary sensors, suitable for a wide range of applications like agriculture, monitoring, ,etc.

Light sensor Grove module:

Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...