Arduino Light Following Robot With LDR

by mideas.monalisa in Circuits > Arduino

1931 Views, 2 Favorites, 0 Comments

Arduino Light Following Robot With LDR

How to make a Light Following Robot Car

Hey there, here in this article, I’m going to guide you to make an Arduino Light Following Robot. This is very easy to make (for beginners)

WHY ARDUINO UNO

Here in this project, I have made an Arduino Based Light Tracking Robot. I have used Arduino UNO as a Brain of this robot. I have enclosed an Arduino Code with this article which will help you to instruct the robot to follow the light source and move towards it.

WHY L293D MOTOR DRIVER SHIELD

I have used the L293d motor driver module to control the speed of the motor. There are several motor drivers available on the market but I personally like this one because this is easy to install with Arduino UNO, has 4 individual ports for 4 motors, and also there are many extra extended ports like 5v pins, GND pins, and analog pins, etc.

WHY LDR SENSOR MODULE

As it's a Light tracking robot so, our basic requirement is to track the light, right? and I have found LDR is the best solution for this. But we can't connect the LDR resistor directly with the Arduino or the motor driver. We need to make a compatible circuit for that, and in this state, I have found my solution on LDR sensor Module which is very low in price and also very easy to connect with the Arduino board.

Things Used in This Project

Hardware components

  • ARDUINO UNO
  • L293D MOTOR DRIVER
  • LDR Sensor Module
  • DC MOTOR
  • 18650 LI-ION BATTERY
  • 18650 LI-ION BATTERY HOLDER
  • CHASSIS FOR BODY
  • PCB BOARD BY JLCPCB JUMPER WIRES

SOFTWARE COMPONENTS

  • ARDUINO IDE
  • EASYEDA
  • JLCPCB

Hand tools

  • Soldering iron
  • Drill Machine
  • Glue Gun

Before Starting Let’s See First What You Will Learn From This Intractable

  1. Making the right hardware selection for your project depending on its functionalities.
  2. Assemble all the project parts (mechanical and electronic assembly).
  3. Finally designing your own ARDUINO-based Light Tracking Robot.
  4. Prepare the circuit diagram to connect all the chosen components.

Mechanical Part

Screenshot (233).png
Screenshot (230).png

Our first step will be to make the robot body. so, here we have to make a DIY chassis and assemble the TT gear Motor with the robot chassis. Here is how it looks like in my case…

Electronics Part

Screenshot (234).png
Screenshot (236).png
Screenshot (238).png

Now we are going to assemble all the components with the PCB. I have made a PCB file to make it easy to assemble and ordered my PCB from JLCPCB. They are very professional in PCB making and the build time was short. I received my item within 7 working days.

After getting the PCB it was just a less than 2 minutes job to assemble all the components properly.

Arduino Coding

Screenshot (243).png
Screenshot (244).png
Screenshot (246).png

Now I had to upload the code to the Arduino UNO.So I have attached the USB cable that comes with the Arduino UNO board and follows the steps mentioned below

· Open Arduino IDE on your PC

· Connect ARDUINO with PC via USB Cable

· Go to Tools > manage libraries > Search for AF Motor driver and download

· Go to Tools > Board > and select Arduino\Genuino UNO

· Go to Tools > Port > Select proper COM port

· Now Verify the code and then upload it

***Please don’t forget to remove/detach remove the yellow jumper cap from the motor driver before uploading the sketch/code. Re-Connect it after the code has been uploaded successfully.

Assemble All Parts

Screenshot (247).png
7.jpg

Here in this part, I am going to assemble all the parts like wheels, chassis encloser together and insert the 18650 li-ion battery on the battery holder.

And here is how it finally looks like…

Now the Robot Is Ready to Go…

Screenshot (248).png
Screenshot (249).png

Now the robot is ready to move by following the light source.

Turn Right when LDR module 1 (right-sided module) & LDR module 2 (middle one) get input signal

Turn Left when LDR module 3 (left-sided module) & LDR module 2 (middle one) get input signal

Move Forward when both 3 Modules get an input signal

About JLCPCB

JLCPCB (Shenzhen JIALICHUANG Electronic Technology Development Co., Ltd.), is the largest PCB prototype enterprise in China and a high-tech manufacturer specializing in quick PCB prototype and small-batch PCB production. With over 10 years of experience in PCB manufacturing, JLCPCB has more than 200, 000 customers at home and abroad, with over 8, 000 online orders of PCB prototyping and small quantity PCB production per day. The annual production capacity is 200, 000 sq.m. for various 1-layer, 2-layer or multi-layer PCBs. JLCPCB is a professional PCB manufacturer featured of large scale, well equipment, strict management, and superior quality.

Troubleshoot:

A. The programmer is not responding: If you face this error, it may be because of the Motor Driver. Make sure that you have removed or detached the yellow cap of the motor driver before uploading the code & attach it again once you have done uploading.

B. The motor is not rotating in the right direction: If you face this issue, you don’t need to modify any code. You just have to Interchange the motor wires. Simply, I can say just connect the Motor to the Motor driver

C. Not following the light or running before you have applied the light: This will happen when the LDR sensor modules are not calibrated properly. Put lights on the sensor & Calibrate them by rotating the potentiometer attached with them.

Arduino Code & Circuit Diagram

CKT diagram.jpg