Skip to content

ali-ghazi78/line_follower_robot_competition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ATmega64 Line-Following Robot

Firmware for a line-following robot based on the ATmega64 microcontroller.
The robot uses an array of 24 infrared (IR) sensors to detect the track, processes sensor data to calculate error, and controls the left and right motors using PWM for stable navigation.

This project was auto-generated with CodeWizardAVR V3.12 and then extended with custom control algorithms.


📌 Features

  • 24-channel IR sensor array for line detection
  • Digitalization of sensor values with configurable threshold
  • Motor control via Timer1 PWM outputs
  • PID-like control using proportional error (kp) for smooth turns
  • LCD support (alcd.h) for debugging and sensor monitoring
  • Utility functions for:
    • Move forward, backward, left, right, stop
    • Sensor calibration (optional, disabled in code)
    • LCD output of sensor states

⚙️ Hardware Requirements

  • Microcontroller: ATmega64 running at 8 MHz
  • IR sensors: 24 arranged in left/right groups
  • Motor driver: Controlled via IN1, IN2, PWM outputs (OCR1A, OCR1B)
  • LCD (16x2 alphanumeric) for debugging
  • Power stage: H-bridge or motor driver IC (e.g., L298/L293D)

📂 Project Structure

  • Main Loop
    • Continuously reads sensor data
    • Calls controller() to compute error and adjust motor speeds
  • Functions
    • ReadMp() → Reads 24 sensors through a multiplexer and ADC
    • controller() → Calculates error from sensor weights, applies proportional control
    • Move() → Drives motors with appropriate PWM values
    • Go(), Left(), Right(), Back(), Stop() → Motor primitives
    • lcd_show_sensor() → Prints raw sensor values for debugging

🖥️ Control Algorithm

  • Each sensor has a weight (E_L_i, E_R_i) indicating its position relative to the line.
  • The controller computes:

About

_barman_2018

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published