An open API service indexing awesome lists of open source software.

https://github.com/nathancordeiro/line-follower-robot

Arduino Uno-powered line follower robot: Seamlessly follows lines with precision sensors and intelligent algorithms. Ideal for exploring robotics fundamentals and automation.
https://github.com/nathancordeiro/line-follower-robot

arduino cpp line-follower robotics

Last synced: 6 months ago
JSON representation

Arduino Uno-powered line follower robot: Seamlessly follows lines with precision sensors and intelligent algorithms. Ideal for exploring robotics fundamentals and automation.

Awesome Lists containing this project

README

          

---

Line Follower Robot 🏎️

---

# Line Follower Robot using Arduino Uno

This project demonstrates a line follower robot powered by an Arduino Uno. The robot uses infrared (IR) sensors to detect the line and adjust its path accordingly by controlling the motors.

## Table of Contents
- [Introduction](#introduction)
- [Components](#components)
- [Circuit Diagram](#circuit-diagram)
- [Code Explanation](#code-explanation)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)
- [Contacts](#contacts)

## Introduction
The line follower robot is designed to follow a black line on a white surface. It uses five IR sensors to detect the line's position and adjusts its movements by controlling the left and right motors accordingly.

## Components
- Arduino Uno R3
- 2 DC Motors with motor driver
- 5 IR Sensors (individual or array chanel works)
- Motor driver (L298N or similar)
- Chassis, wheels, and other mechanical components
- Jumper wires (breadboard is optional)

## Circuit Diagram
![Circuit Diagram](./LFR%20circuit%20diagram.png)

## Code Explanation
The code is designed to:
- Read the values from five IR sensors.
- Determine the position of the line based on the sensor values.
- Adjust the motor speeds to follow the line correctly.

### Motor Control
- `motorRPin1`, `motorRPin2`, and `motorREnable` control the right motor.
- `motorLPin1`, `motorLPin2`, and `motorLEnable` control the left motor.

### IR Sensors
- The IR sensors are connected to analog pins A0 to A4.

### Functions
- `scanD()`: Reads the IR sensor values.
- `check()`: Determines the robot's movement based on the sensor values.
- `rightS()`, `leftS()`, `go()`, `stopme()`: Control the motors to turn right, turn left, move forward, and stop respectively.

### Inbuilt Functions
- `analogWrite()`: Allows you to write a an analog value (a pulse-width-modulation wave) to a specific pin.
```INO
Syntax:
analogWrite(pin, value)
Parameters:
Pin - Pin to write to allowed to be an int only
value - The duty cycle, ranging from 0 to 255
```
- `digitalWrite()`: Allows you to control the state of a digital pin, can be set to either HIGH(5v) or LOW(0v).
```INO
Syntax:
digitalWrite(pin, value)
Parameters:
Pin - The arduino pin number
value - Either HIGH or LOW
```
- `bitWrite()`: Allows you to modify a specific bit of a numeric variable.
```INO
Syntax:
bitWrite(x, n, b)
Parameters:
x - The numeric variable to which you want to write
n - The bit position
b - The value to write to the specified bit either 0 or 1
```

## Usage
1. **Assemble the Hardware**:
- Connect the IR sensors to the analog pins A0 to A4 on the Arduino.
- Connect the motor driver to the Arduino and the motors.
- Power the Arduino and motor driver.

2. **Upload the Code**:
- Upload the provided code to the Arduino Uno using the Arduino IDE.

3. **Run the Robot**:
- Place the robot on a track with a black line on a white surface.
- The robot will follow the line autonomously.

## Contributing
We welcome contributions to improve the project. Here’s how you can contribute:
- Fork the repository.
- Create a new branch (`git checkout -b feature-branch`).
- Commit your changes (`git commit -am 'Add new feature'`).
- Push to the branch (`git push origin feature-branch`).
- Create a new Pull Request.

## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Contacts
Nathan Cordeiro
```sh
https://github.com/NathanCordeiro
```

Sanika Naik
```sh
https://github.com/SanikaKNaik
```

Vaidehi Kolhatkar
```sh
https://github.com/VaidehiKolhatkar
```