Skip to content
Free Delivery on Orders Above Rs 999/- Pan-India
Cash on Delivery Available for Orders above Rs.500/- and Upto Rs 3000/-
SAVE more when you BUY more. Upto 30% Off on BULK PURCHASE
GST Invoices for Your Business
Dedicated Technical Support Team
Safely Delivering Genuine Products PAN INDIA

I Built a Light Following Robot in One Day

I Built a Light Following Robot in One Day
-
Written By - Robocraze -
📅 Updated on 24 Aug 2026
Summarize with AI
✅ Prompt copied

Summary

Building a robot that can respond to its surroundings is one of the most exciting milestones for anyone learning Arduino. A light-following robot is an excellent beginner project because it combines sensors, motor control, and basic programming into a single build. Instead of following a predefined path, the robot continuously detects the brightest light source and steers towards it. 

This project introduces several core robotics concepts, including analog sensor readings, differential motor control, and decision-making using Arduino. The best part is that it can be assembled in just a few hours using commonly available components, making it an ideal weekend project for students, hobbyists, and STEM learners. 

In this tutorial, we'll build a simple two-wheel light-following robot using an Arduino Uno, two Light Dependent Resistors (LDRs), an L298N motor driver, and two DC geared motors. 

I Built a Light Following Robot in One Day - Cover Image

How Does a Light Following Robot Work?

A light-following robot uses two LDR sensors mounted on the front of the robot.

Each sensor continuously measures the amount of light falling on it.

The Arduino compares the values from both sensors and adjusts the motors accordingly.

The decision-making process is simple:

  • If both sensors receive equal light, the robot moves forward.

  • If the left sensor detects more light, the robot turns left.

  • If the right sensor detects more light, the robot turns right.

  • If both sensors detect very little light, the robot stops or continues searching.

This method is known as differential steering and is widely used in beginner robotics.

Components and Supplies

LDR Sensor Module - Light-dependent resistor for brightness detection. -LDR Sensor -RobocrazeLDR Sensor Module - Light-dependent resistor for brightness detection. -LDR Sensor -Robocraze

LDR Sensor Module

LDR Sensor Module The LDR Sensor Module is a compact and easy-to-use light detection module designed to sense changes in ambient brightness and trigger digital control signals in electronics, Arduino, robotics, and automation projects. Built around an LDR (Light Dependent Resistor) and an LM393...
Rs 31/-
Rs 31/-
Rs 54/-
Save Rs 23/-
Jumper Wire Set - M2M, M2F, F2F (40 pcs each) – Ideal for Arduino & prototyping. Electronic Components - RobocrazeJumper Wire Set - M2M, M2F, F2F (40 pcs each) – Ideal for Arduino & prototyping. Electronic Components - Robocraze

    Jumper Wire Set - M2M, M2F, F2F (40 pcs each)

    Jumper Wire Set - M2M, M2F, F2F (40 pcs each) These DuPont jumper wires for electronics is a premium quality wire manufactured by using quality assured material and advanced techniques, which make them up to the standard in this highly challenging field. This 120pcs...
    Rs 139/-
    Rs 139/-
    Rs 169/-
    Save Rs 30/-
    1660 Tie-Point Solderless Breadboard – Large breadboard for circuit prototyping. Electronic Components - Robocraze1660 Tie-Point Solderless Breadboard – Large breadboard for circuit prototyping. Electronic Components - Robocraze

      1660 tie-point Solderless Breadboard

      1660 tie-point Solderless Breadboard The 1660 Points Solderless Breadboard is an excellent size with more than enough room for more advanced prototyping. There are two terminal strips with 1260 tie-points and 4 distribution strips with 400 tie-points.  The breadboards accept a variety of wire sizes from 20 to...
      Rs 676/-
      Rs 676/-
      Rs 699/-
      Save Rs 23/-
      170 Points Mini Breadboard – Compact solderless breadboard for quick prototyping. Electronic Components - Robocraze170 Points Mini Breadboard – Compact solderless breadboard for quick prototyping. Electronic Components - Robocraze

      170 Points Mini Breadboard

      170 Points Mini Breadboard This 170 Points Mini Breadboard is the ideal companion for seamless electronics prototyping, designed to provide a hassle-free experience. With a 2x17 row layout and a total of 170 pins, this prototyping breadboard offers abundant space to create and test...
      Rs 16/-
      Rs 16/-
      Rs 29/-
      Save Rs 13/-
      CC3000 Wifi Shield for Arduino Uno-RobocrazeCC3000 Wifi Shield for Arduino Uno-Robocraze

      Arduino Uno CC3000 Wifi Shield

      This is a shield for the CC3000 WiFi Module. The CC3000 from TI (Texas Instruments) is a self-contained wireless network processor that makes incorporating internet connectivity into your project simple. Supply Voltage: 4.5V - 12V Host Interface: SPI @ 16MHZ Throughput (TCP): ~4Mbps IEEE...
      Rs 3,548/-
      Rs 3,548/-
      Rs 4,109/-
      Save Rs 561/-
      Arduino UNO Prototyping Shield – Expand Arduino projects with this prototyping shield. Electronic Components - RobocrazeArduino UNO Prototyping Shield – Expand Arduino projects with this prototyping shield. Electronic Components - Robocraze

        Arduino UNO Prototyping Shield

        UNO Prototyping Shield for Arduino UNO Prototype Shield is used in the cases where you want to build more applications without using any external Breadboard. This prototyping shield for Arduino helps in expanding the functionalities of UNO board and create extra connections for embedded...
        Rs 99/-
        Rs 99/-
        Rs 114/-
        Save Rs 15/-
        Dual L298N Motor Driver Module with PWM Control – Powerful motor driver for robotic applications – RobocrazeDual L298N Motor Driver Module with PWM Control – Powerful motor driver for robotic applications – Robocraze

          2A Dual L298N Motor Driver Module with PWM Control

          2A Dual L298N Motor Driver Module with PWM Control The L298N Motor Driver Module is a great choice for controlling motors! It contains a double H bridge L298N chip, which has a maximum voltage of 46V and a current of 2A. This L298N dual...
          Rs 166/-
          Rs 166/-
          Rs 179/-
          Save Rs 13/-

          Components Required

          You'll need the following components.

          Electronics

          Understanding the Components

          Arduino Uno

          The Arduino reads the sensor values and decides how the motors should move.

          It acts as the brain of the robot.

          LDR Sensors

          An LDR (Light Dependent Resistor) changes its resistance depending on light intensity.

          • Bright light → Lower resistance

          • Darkness → Higher resistance

          Since the Arduino cannot directly measure resistance, each LDR is connected as a voltage divider using a 10kΩ resistor.

          The Arduino then reads the voltage using its analog inputs.

          L298N Motor Driver

          Arduino GPIO pins cannot directly drive DC motors.

          The L298N motor driver receives low-power control signals from Arduino and supplies sufficient current to the motors.

          It allows each motor to:

          • Rotate forward

          • Rotate backward

          • Stop

          Circuit Connections

          Circuit Connections

          Left LDR

          • One terminal → 5V

          • Other terminal → A0

          • 10kΩ resistor between A0 and GND

          Right LDR

          • One terminal → 5V

          • Other terminal → A1

          • 10kΩ resistor between A1 and GND

          L298N Connections

          Arduino to Motor Driver

          • IN1 → Pin 8

          • IN2 → Pin 9

          • IN3 → Pin 10

          • IN4 → Pin 11

          • ENA → Pin 5 (PWM)

          • ENB → Pin 6 (PWM)

          Motors

          • Motor A → Left motor

          • Motor B → Right motor

          Power

          • Battery Positive → 12V terminal

          • Battery Negative → GND

          • Connect Arduino GND to Motor Driver GND.

          This common ground is essential for proper operation.

          Building the Robot

          Step 1: Assemble the Chassis

          Mount the two DC motors onto the robot chassis.

          Attach both wheels.

          Install the castor wheel at the front or rear depending on your chassis design.

          Ensure the wheels rotate freely.

          Step 2: Mount the Arduino

          Fix the Arduino onto the top of the chassis using spacers or double-sided tape.

          Leave enough room for the battery pack and motor driver.

          Step 3: Install the Motor Driver

          Place the L298N close to the motors.

          Shorter motor wires reduce electrical noise.

          Step 4: Install the LDR Sensors

          Position the two LDRs approximately 6–8 cm apart at the front of the robot.

          To improve directional sensing, place a small divider between the sensors using black cardboard or plastic.

          This prevents one sensor from receiving light intended for the other.

          Programming Logic

          The Arduino repeatedly performs four simple steps.

          Step 1

          Read both analog sensors.

          Left Sensor

          Analog Value

          Right Sensor

          Analog Value

          Step 2

          Compare the readings.

          If:

          Left > Right

          Turn Left

          If:

          Right > Left

          Turn Right

          If:

          Both Nearly Equal

          Move Forward

          Step 3

          Drive the motors.

          Motor directions determine the robot's movement.

          Forward

          • Left Motor → Forward

          • Right Motor → Forward

          Turn Left

          • Left Motor → Slow

          • Right Motor → Fast

          Turn Right

          • Left Motor → Fast

          • Right Motor → Slow

          Step 4

          Repeat continuously.

          The robot constantly adjusts its direction as the light source moves.

          Here's the full code for the Project on Github: Line Following Robot

          Calibrating the Robot

          Calibration is important because different LDRs rarely produce identical readings.

          Open the Serial Monitor and observe both analog values.

          Example:

          Left : 540

          Right : 520

          Instead of comparing exact values, introduce a small tolerance.

          For example:

          Difference < 20

          Move Straight

          Difference > 20

          Turn

          This prevents unnecessary steering caused by minor fluctuations.

          Testing the Robot

          Place the robot on a smooth floor.

          Turn on the battery.

          Use a flashlight as the light source.

          Light in Front

          Expected result:

          Robot moves forward.

          Light on Left

          Expected result:

          Robot turns left until both sensors receive similar light.

          Light on Right

          Expected result:

          Robot turns right.

          No Light

          Expected result:

          Robot either stops or continues searching depending on your program.

          Common Problems

          Robot Spins in Circles

          Usually caused by:

          • Motor polarity reversed

          • Incorrect motor driver wiring

          Swap the motor terminals if necessary.

          Robot Moves Away from Light

          The LDR logic is reversed.

          Simply swap the comparison conditions inside the Arduino program.

          Motors Do Not Move

          Check:

          • Battery voltage

          • Common ground

          • Motor driver enable pins

          • Motor driver wiring

          Robot Oscillates Continuously

          Reduce sensor sensitivity by increasing the comparison threshold.

          This produces smoother movement.

          LDR Line Follower

          Where to Buy Components in India

          Most of the components required for this project are readily available.

          Robocraze offers Arduino Uno Boards, L298N Motor Drivers, LDR Sensors, DC geared motors, robot chassis kits, batteries, jumper wires, breadboards, and other robotics components required to build this project. Purchasing compatible components from a single supplier makes assembly much easier and reduces compatibility issues.

          Final Thoughts

          Building a light-following robot is an excellent introduction to practical robotics because it combines sensing, motor control, and real-time decision-making into a single project. The robot reacts to changes in its environment without requiring complicated algorithms, making it an ideal learning platform for beginners.

          For anyone interested in building a light follower robot India project, this tutorial provides a solid foundation in Arduino programming and robotics. Once you've mastered this build, you can confidently move on to more advanced projects such as obstacle-avoiding robots, Bluetooth-controlled vehicles, and autonomous navigation systems.

          Excerpt

          Follow my experience building a light-following robot in one day using Arduino, sensors, and motors, with practical lessons and tips for beginners starting robotics projects.
          Prev Post
          Next Post

          Leave a comment

          Please note, comments need to be approved before they are published.

          Thanks for subscribing!

          This email has been registered!

          Shop the look

          Choose Options

          Edit Option
          Back In Stock Notification
          Compare
          Product SKU Description Collection Availability Product Type Other Details

          Choose Options

          this is just a warning
          Login
          Shopping Cart
          0 items
          FREE SHIPPING!
          ₹100 OFF
          ₹200 OFF
          ₹999
          ₹2500
          ₹4900
          WhatsApp Chat Chat