Illustration: on a child's nightstand, a Grove shield on an Arduino with a light sensor, a knob and a lit LED module.Lights and displays
Illustration (made with AI): roughly what the finished project looks like.

A Smart Night Light with Grove

When the room gets dark the LED switches itself on, and a knob sets the brightness. Grove modules simply plug into the shield: no soldering, no breadboard.

Difficulty
Beginner
Time
20 min
Age
8+
Parts
5, 5 on the site

Written by the RoboHub team. A question? Write to us.

Variations

Choose a variation and the parts list updates.

Instructions

  1. The shield

    Fit the Grove Base Shield onto the Arduino.

  2. The modules

    Plug the light sensor into A0, the knob into A1 and the LED into D3.

    The shield sits on top of the Arduino. Each module takes one Grove cable: power, ground and signal are in one plug.

    • Light sensor GROVE → Grove Shield A0
    • Rotary knob GROVE → Grove Shield A1
    • LED module GROVE → Grove Shield D3
  3. The code

    The program reads the light sensor: when it is dark the LED comes on, and the knob sets its brightness.

    Illustration: a Grove shield on an Arduino with a light sensor, a knob and a lit LED module.

    Illustration, made with AI

    Arduino C++
    const int LIGHT = A0, KNOB = A1, LED = 3;
    const int DARK = 300;                  // tune for your room
    
    void setup() {
      pinMode(LED, OUTPUT);
      Serial.begin(9600);
    }
    
    void loop() {
      int light = analogRead(LIGHT);
      int level = map(analogRead(KNOB), 0, 1023, 0, 255);
      Serial.println(light);
      analogWrite(LED, light < DARK ? level : 0);
      delay(100);
    }
  • Lights and displays
    Beginner45 min10+

    Pedestrian Crossing with a Button

    Cars have green until a pedestrian presses the button. Then the cars get red, the pedestrians get green and a buzzer ticks, just like at a real crossing.

    6/6 parts on the site
  • Sensors
    Beginner1 h10+

    Parking Sensor with Sound and Lights

    An ultrasonic sensor measures the distance. Three LEDs show how close the obstacle is, and the buzzer beeps faster the closer you get.

    6/6 parts on the site
  • Games
    Beginner45 min10+

    A Two-Player Reaction Game

    An LED lights at a random moment. Whoever presses their button first wins. Built from Student Kit parts in 45 minutes.

    6/6 parts on the site