Line Follower Robot Using Micro-controllers

37
LINE FOLLOWER ROBOT USING Micro-Controllers WALCHAND INSTITUTE OF TECHNOLOGY,SOLAPUR Robo Club BY WASI QAZI

description

Presentation by WASI QAZI on line following bots at RoboClub in WIT Solapur.

Transcript of Line Follower Robot Using Micro-controllers

Page 1: Line Follower Robot Using Micro-controllers

LINE FOLLOWER ROBOTUSING

Micro-Controllers

WALCHAND INSTITUTE OF TECHNOLOGY,SOLAPUR

Robo Club

BY

WASI QAZI

Page 2: Line Follower Robot Using Micro-controllers

What is a uC ?

In simple words -- a single chip Computer

Introduction

Page 3: Line Follower Robot Using Micro-controllers

Computer

• uP• RAM• HDD• Clock• Ports (Serial/USB)• Ports (Parallel)• Mic/Headphone Jack (ADC/ DAC)• Power Supply Unit• Reset• Mother-board

uC

• uP• Flash Memory• EEPROM• Clock Unit• SPI / UART Controllers• Digital I/O Ports• ADC• Power Supply Unit• Reset• IC

Introduction

Page 4: Line Follower Robot Using Micro-controllers

THE BLOCK DIAGRAM

Microcontroller H - BridgeDC Motor Control

LeftMotor

Right Motor

Clock12Mhz Main Power

SupplyMotor Power

Supply

HEX Inverter

Sensor Array

Analog Comparators

Threshold Voltage

Priority Encoder

NOR Gate

Page 5: Line Follower Robot Using Micro-controllers

Sensors

• A sensor is a device which measures a physical quantity and converts it into a signal which can be read by an observer or by an instrument.

• They are used to provide feedback from the external environment

Page 6: Line Follower Robot Using Micro-controllers

IR Sensor Pair

Transmitter (Tx)

Receiver (Rx)

IR sensor PairObject / Line

Transmitter = LED( Light Emitting Diode)

Receiver = Photodiode

Page 7: Line Follower Robot Using Micro-controllers
Page 8: Line Follower Robot Using Micro-controllers

Principle of Operation

R1< R2

WHITE surfaceMaximum reflectionT1 is turned ONVout is LOW

BLACK surfaceMinimum or No ReflectionT1 is turned OFFVout is HIGH

Page 9: Line Follower Robot Using Micro-controllers
Page 10: Line Follower Robot Using Micro-controllers
Page 11: Line Follower Robot Using Micro-controllers

ADC BY OP-AMP:

GND

+5v

Page 12: Line Follower Robot Using Micro-controllers

Line Follower : Design

The bot has two IR sensors facing downwards (towards the floor).

The separation between the sensors is such that in normal (correct) position of the bot , both the sensors are on white surface. ie separation > strip width

The bot is driven by two wheel differential drive ie the two back wheels are driven by independent motors.

SleftSright

Page 13: Line Follower Robot Using Micro-controllers

Line Follower : Algo

When the bot is in correct pos, both sensors are on white & read LOW. The robot should move forward in this case.

Sleft Sright Movement

LOW LOW Forward

SleftSright

Page 14: Line Follower Robot Using Micro-controllers

Line Follower : Algo

When the bot is over line from right side, left sensor is on white & reads LOW whereas right sensor is on black & reads HIGH The robot should take a right turn in this case to come back in correct pos.

Sleft Sright Movement

LOW HIGH Right Turn

SleftSright

Page 15: Line Follower Robot Using Micro-controllers

Line Follower : Algo

When the bot is over line from left side, right sensor is on white & reads LOW whereas left sensor is on black & reads HIGH The robot should take a left turn in this case to come back in correct pos.

Sleft Sright Movement

HIGH LOW Left Turn

Sleft

Sright

Page 16: Line Follower Robot Using Micro-controllers

Line Follower

Sleft Sright Movement Left Motor Right Motor

LOW LOW Forward Forward Forward

LOW HIGH Right Turn Forward Back

HIGH LOW Left Turn Back Forward

Page 17: Line Follower Robot Using Micro-controllers

Atmega16L : An Overview

8-bit Micro-cotroller

40-pin DIP

32 Programmable I/O Lines

Operating Voltages 2.7 - 5.5V

Speed Grades 0 - 8 MHz

16K Bytes of In-System Self-programmable Flash program memory

512 Bytes EEPROM

Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes

One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode

8-channel, 10-bit ADC

Programmable Serial USART

Master/Slave SPI Serial Interface

Programmable Watchdog Timer with Separate On-chip Oscillator

On-chip Analog Comparator

Page 18: Line Follower Robot Using Micro-controllers

Pin diagram

Page 19: Line Follower Robot Using Micro-controllers

Block Daigram

Page 20: Line Follower Robot Using Micro-controllers

Simplified Diagram

4 8bit Parallel Input-Output ports through which you can i/p or o/p digital data.

Page 21: Line Follower Robot Using Micro-controllers

Power Supply

Page 22: Line Follower Robot Using Micro-controllers

Port Architecture

PORTA

DDRA

PINA

uC External world

Page 23: Line Follower Robot Using Micro-controllers

Complete Program

A program to o/p 33 (hex) on PortD and configure and read pins 2 and 7 of Port A

#include <mega16.h>

void main( ){unsigned int x,y;

DDRD=0xFF; // all pins o/pDDRA=0b01111011; // pin 7 & 2 i/p rest immaterial

PORTD=0x33;x=PINA.2;y=PINA.7;}

Page 24: Line Follower Robot Using Micro-controllers

L298N Motor Driver

Page 25: Line Follower Robot Using Micro-controllers

Similarly other 2 o/p are connected /disconnected by I/p 3 & I/P 4

All the O/p’s operate independently, ie if all I/p 1-I/p 4 are 1, all O/p1 – O/p4 will be connected to +VPP

L298 can provide 1A current / Output channel , therefore total of 4A. But heat sinks should be installed for such high currents .

VPP can be anything in the range 2V- 46V , therefore any motor can be driven even though Atmega provides only 0/5 V.

Page 26: Line Follower Robot Using Micro-controllers

ATMEGA

MOTORDRIVER

MOTOR

4 Inputs 4 Outputs

Page 27: Line Follower Robot Using Micro-controllers

I/p 1 ( O/p from uC)

I/p 2

I/p 3

I/p 4O/p 4

O/p 3

O/p 2

O/p 1

If uC send ‘1’ to I/p 1, O/p is conn to + VPPGND

+VPP

If uC send ‘0’ to I/p 1, O/p is conn to GND

Working of Motor Driver

Page 28: Line Follower Robot Using Micro-controllers

I/p 1 ( O/p from uC)

I/p 2

I/p 3

I/p 4O/p 4

O/p 3

O/p 2

O/p 1

If uC send ‘1’ to I/p 2, O/p is conn to + VPPGND

+VPP

If uC send ‘0’ to I/p 1, O/p is conn to GND

Working of Motor Driver

Page 29: Line Follower Robot Using Micro-controllers

Working of Motor

Page 30: Line Follower Robot Using Micro-controllers

H-BRIDGE MOTOR CONTROL

Page 31: Line Follower Robot Using Micro-controllers

H-BRIDGE MOTOR CONTROL

Page 32: Line Follower Robot Using Micro-controllers

H-BRIDGE MOTOR CONTROL

Page 33: Line Follower Robot Using Micro-controllers

H-BRIDGE USING TRANSISTOR

Page 34: Line Follower Robot Using Micro-controllers

I/p 1 ( O/p from uC)

I/p 2

I/p 3

I/p 4O/p 4

O/p 3

O/p 2

O/p 1

If uC send ‘1’ to I/p 2, O/p is conn to + VPPGND

+VPP

If uC send ‘0’ to I/p 1, O/p is conn to GND

Motor Connection for Clockwise:

Page 35: Line Follower Robot Using Micro-controllers

I/p 1 ( O/p from uC)

I/p 2

I/p 3

I/p 4O/p 4

O/p 3

O/p 2

O/p 1

If uC send ‘1’ to I/p 2, O/p is conn to + VPPGND

+VPP

If uC send ‘0’ to I/p 1, O/p is conn to GND

Motor Connection for Anti-Clockwise:

Page 36: Line Follower Robot Using Micro-controllers

SPEED CONTROL BY PWM

Page 37: Line Follower Robot Using Micro-controllers