Line Follower Using LM324N with Backup Arduino Nano

Line Follower Using LM324N with Backup Arduino Nano

Build a line follower using an LM324N with a backup Arduino Nano.

  • 1,744 views
  • 8 comments
  • 12 respects

Components and supplies

Apps and online services

About this project

I have been a very big fan of line following robot since my high school and I wanted to make one as simple as possible for someone who wants to learn robotics. I have another similar project in my profile just using Arduino uno and L293D motor driver. This one is little different and maybe unique as well because I have designed this combining two circuit boards together. One can switch between analog circuit and Arduino Nano with a jumper cap. I have used LM324N comparator for any beginner to start learning analog circuit whereas by using arduino, he/she will be learning digital electronics (including some programming). Combining these two circuits together might also help to take control of situation if things go south in analog circuit, you can still use this robot and continue your participation and vice versa.


It has all the files you need. The board is designed in KiCad.

P.S. Some of the other 3d models are obtained from GrabCad itself and other website. Comment if you need help or if you have any questions.

All files are in my GrabCad account: GrabCAD

Code

sketch_mar20a.inoC/C++
/*Author: Ajaya Dahal
 * created on: 08/20/2018
*/


/*-------definning Inputs------*/
#define leftSensor 2      // left sensor
#define rightSensor 3      // right sensor

/*-------definning Outputs------*/
#define leftMotor 4       // left motor
#define leftMotor2 5       // left motor
#define rightMotor1 6       // right motor
#define rightMotor2 7       // right motor

void setup()
{
  pinMode(leftSensor, INPUT);
  pinMode(rightSensor, INPUT);
  pinMode(leftMotor, OUTPUT);
  pinMode(leftMotor2, OUTPUT);
  pinMode(rightMotor1, OUTPUT);
  pinMode(rightMotor2, OUTPUT);
}

void loop()
{
  if(digitalRead(leftSensor) && digitalRead(rightSensor))     // Move Forward
  {
    digitalWrite(leftMotor, HIGH);
    digitalWrite(leftMotor2, LOW);
    digitalWrite(rightMotor1, HIGH);
    digitalWrite(rightMotor2, LOW);
  }
  
  if(!(digitalRead(leftSensor)) && digitalRead(rightSensor))     // Turn right
  {
    digitalWrite(leftMotor, LOW);
    digitalWrite(leftMotor2, LOW);
    digitalWrite(rightMotor1, HIGH);
    digitalWrite(rightMotor2, LOW);
  }
  
  if(digitalRead(leftSensor) && !(digitalRead(rightSensor)))     // turn left
  {
    digitalWrite(leftMotor, HIGH);
    digitalWrite(leftMotor2, LOW);
    digitalWrite(rightMotor1, LOW);
    digitalWrite(rightMotor2, LOW);
  }
  
  if(!(digitalRead(leftSensor)) && !(digitalRead(rightSensor)))     // stop
  {
    digitalWrite(leftMotor, LOW);
    digitalWrite(leftMotor2, LOW);
    digitalWrite(rightMotor1, LOW);
    digitalWrite(rightMotor2, LOW);
  }
}

Custom parts and enclosures

3D model
lm324n_with_backup_arduino_nano_line_follower_754rBdhI3n.step

Schematics

3D view picture
Lm324n with backup arduino nano line follower osmajs4wjd
Schematics

Comments

Similar projects you might like

Line Follower Robot

Project tutorial by Shubham Shinganapure

  • 9,879 views
  • 3 comments
  • 22 respects

Line Follower Robot (PICTO 92)

Project tutorial by MEGA DAS

  • 3,948 views
  • 0 comments
  • 9 respects

Automatic Servo Tester with Arduino Nano

Project tutorial by Bekir Bilge

  • 3,761 views
  • 0 comments
  • 12 respects

Nano IR Remote for DC Motors

Project showcase by Boaz Lawnce

  • 2,974 views
  • 2 comments
  • 7 respects

Line Follower Robot - PID Control - Android Setup

Project tutorial by MJRoBot

  • 37,951 views
  • 10 comments
  • 46 respects
Add projectSign up / Login