ATmega8 Line Follower Robot (LFR) Project – Part 2/2

Now that the mechanical assembly part is over,and we have completed the construction of left and right (L&R) infrared sensor cards. Since the MCU (ATmega8) cannot drive the dc motors directly, a dedicated motor driver circuit is used. The motor driver circuit here is based on a simple 16-pin IC (L293D) which can drive two dc motors independently.
ATmega8 Line Follower Robot (LFR) Project
As can be seen in the circuit diagram, pins 4, 5, 13 and 12 of LM293 (U2) are connected to GND and the pin 16 (VSS) is connected to 5V. The ‘chip inhibit’ pins (1&9) act as the enable pins for the input-output pairs on left side and right side of the motor driver, respectively. Pin 8 (VC) receives the unregulated input supply (Vcc) from the LFR power supply circuit. It is noteworthy that this motor driver chip is PWM supporting, means that if you apply some voltage in the range 0V to 5V at any input, then it will be scaled up by a factor and will be available at the corresponding output.
The four input pins (2-7-10-15) receives motor drive instructions from the MCU. In short, U2 acts as the interface between the microcontroller (U3) and the dc motors (M1&M2) in which instructions from the microcontroller go into its input pins and the outputs are used to drive the robot motors.
LFR-Microcon-
troller Unit (MCU) Circuit Diagram

Here is the circuit of the MCU,wired around our favorite ATmega8 chip (U3). The first task is to resolve which pins of the MCU will be used for taking inputs from the infrared sensor cards and giving outputs to the motor driver circuit. As an exercise, I went for PC0 (left) and PC3 (right) of PORT C for the two inputs from two infrared sensor cards, and pins PB1 to PB4 of PORT B as outputs to motor driver circuit (actually only PB1 and PB4 are important at this time). The code is written using the C language so you need to be comfortable with the syntax of C language, concept of libraries, compiler, etc (IDE used is the AVR Studio 4). The final code (hex code) can be burned into the MCU using a suitable programmer (refer previous chapters of this avr tutorial).
ATmega8 Line Follower Robot (LFR) Project Schematic
Read More: ATmega8 Line Follower Robot (LFR) Project – Part 2/2


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top