In this project we’ll be building a light sensitivity-based Arduino project that will trigger various sensors depending upon the light intensity in the room. You may also use sound sensor instead of light sensor.
Things used in this project,
Hardware Components
- Arduino Uno with Cable
- Arduino Sensor Kit Base
- Arduino IDE
- An active internet connection to download the package
If you would not like to download the Arduino IDE and prefer to run the project online then you may refer Arduino Web Editor.
Before we get started let’s quickly look at all the components on Arduino Sensor Base Kit.

Image Reference: https://www.seeedstudio.com/Arduino-Sensor-Kit-Base-p-4743.html
In this project we’ll use a light sensor, buzzer, temperature & humidity sensor, LED and an OLED Screen.
Step 1 - Setting up your environment.
Since Arduino Sensor Base kit base has 10 sensors embedded just on board so instead of downloading and installing the libraries for each sensor, we can use Arduino_Sensorkit library. Go to Manage Library under Tools and search for Arduino_Sensorkit.

Please make sure you have an active internet connection for this step.
Step 2 - Writing the code for the project.
We’ll first import the Arduino Sensor kit library and declare the variables for buzzer, light sensor and the LED. Since we have the entire library loaded, we don’t need to declare the pin number for OLED and temperature & humidity sensor. If you wish you may also avoid declaring pin numbers for other components too.
- #include "Arduino_SensorKit.h"
- int buzzer = 5;
- int light_sensor = A3;
- int LED = 6;
In the following setup() function we declare the serial communication, OLED and Environment library for temperature and humidity sensor. The setFlipMode() function is used to rotate your display on the OLED screen. We then set the pin mode for buzzer and LED as output.
- void setup() {
- Serial.begin(9600);
- Oled.begin();
- Environment.begin();
- Oled.setFlipMode(true);
- pinMode(buzzer, OUTPUT);
- pinMode(LED, OUTPUT);
- }
Inside the void loop function let us understand the code briefly. We start by making the buzzer off with noTone() and switching off the LED with Low input using digitalWrite() function.
- noTone(buzzer);
- digitalWrite(LED, LOW);
For the light sensor we read the raw value from pin (A3), assign it to raw_light variable and then map the value from 0, 1023 to 0, 100 to store in the light variable.
- int raw_light = analogRead(light_sensor); // read the raw value from light_sensor pin (A3);
- int light = map(raw_light, 0, 1023, 0, 100); // map the value from 0, 1023 to 0, 100;


Join the conversation! Your thoughts help the community grow.