You are on page 1of 76

Outline

Basic Movements of Robot


Motor Interfacing on Firebird

Motion Control Of Firebird-V Robot

e-Yantra Team
Embedded Real-Time Systems Lab
Indian Institute of Technology-Bombay

IIT Bombay
January 12, 2016

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 1/14


Outline
Basic Movements of Robot
Motor Interfacing on Firebird

Agenda for Discussion

1 Basic Movements of Robot


Motion of Robot
Understanding L293D IC

2 Motor Interfacing on Firebird


Pin connections
Logic Table
Writing C-Code

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 2/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 3/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions
Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 3/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions

Forward

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 3/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions

Forward
Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions

Forward

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 3/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions

Forward

Backward

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 3/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions

Forward

Backward
Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions

Forward

Backward
Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions

Forward Left

Backward

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 3/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions

Forward Left

Backward
Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions

Forward Left

Backward

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 3/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions

Forward Left

Backward Right

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 3/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions

Forward Left

Backward Right

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 3/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions (Contd..)


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions (Contd..)


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions (Contd..)

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 4/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions (Contd..)

Soft-Right

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 4/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions (Contd..)

Soft-Right
Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions (Contd..)

Soft-Right

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 4/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions (Contd..)

Soft-Right

Soft-Left
Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions (Contd..)

Soft-Right

Soft-Left
Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions (Contd..)

Soft-Right

Soft-Left
Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions (Contd..)

Soft-Right Backward Left

Soft-Left

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 4/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions (Contd..)

Soft-Right Backward Left

Soft-Left
Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions (Contd..)

Soft-Right Backward Left

Soft-Left

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 4/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions (Contd..)

Soft-Right Backward Left

Soft-Left Backward Right

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 4/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Various Motions (Contd..)

Soft-Right Backward Left

Soft-Left Backward Right

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 4/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Direction Control of DC Motor

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 5/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Direction Control of DC Motor

Anti-Clockwise Motion

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 5/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Direction Control of DC Motor

Anti-Clockwise Motion

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 5/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

Direction Control of DC Motor

Anti-Clockwise Motion
Clockwise Motion

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 5/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

L293D IC

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 6/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

L293D IC

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 6/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

L293D IC (Contd..)

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 7/14


Outline
Motion of Robot
Basic Movements of Robot
Understanding L293D IC
Motor Interfacing on Firebird

L293D IC (Contd..)

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 8/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Motor Pin Connection

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 9/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Motor Pin Connection

1 Four Pins for Direction control is connected at PORT A

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 9/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Motor Pin Connection

1 Four Pins for Direction control is connected at PORT A

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 9/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Motor Pin Connection

1 Four Pins for Direction control is connected at PORT A

a. PA0 - Left Motor Control

b. PA1 - Left Motor Control

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 9/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Motor Pin Connection

1 Four Pins for Direction control is connected at PORT A

a. PA0 - Left Motor Control

b. PA1 - Left Motor Control

c. PA2 - Right Motor Control

d. PA3 - Right Motor Control

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 9/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Motor Pin Connection

1 Four Pins for Direction control is connected at PORT A

a. PA0 - Left Motor Control

b. PA1 - Left Motor Control

c. PA2 - Right Motor Control

d. PA3 - Right Motor Control

2 Two Pins for Enabling Motor Driver IC is connected at PORT L

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 9/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Motor Pin Connection

1 Four Pins for Direction control is connected at PORT A

a. PA0 - Left Motor Control

b. PA1 - Left Motor Control

c. PA2 - Right Motor Control

d. PA3 - Right Motor Control

2 Two Pins for Enabling Motor Driver IC is connected at PORT L

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 9/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Motor Pin Connection

1 Four Pins for Direction control is connected at PORT A

a. PA0 - Left Motor Control

b. PA1 - Left Motor Control

c. PA2 - Right Motor Control

d. PA3 - Right Motor Control

2 Two Pins for Enabling Motor Driver IC is connected at PORT L

a. PL3 - Left Channel Enable

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 9/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Motor Pin Connection

1 Four Pins for Direction control is connected at PORT A

a. PA0 - Left Motor Control

b. PA1 - Left Motor Control

c. PA2 - Right Motor Control

d. PA3 - Right Motor Control

2 Two Pins for Enabling Motor Driver IC is connected at PORT L

a. PL3 - Left Channel Enable

b. PL4 - Right Channel Enable

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 9/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Motor Pin Connection

1 Four Pins for Direction control is connected at PORT A

a. PA0 - Left Motor Control

b. PA1 - Left Motor Control

c. PA2 - Right Motor Control

d. PA3 - Right Motor Control

2 Two Pins for Enabling Motor Driver IC is connected at PORT L

a. PL3 - Left Channel Enable

b. PL4 - Right Channel Enable

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 9/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Logic Table

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 10/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Logic Table

Direction

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 10/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Logic Table

Direction PA(3) PA(2) PA(1) PA(0) HEX Value


RB RF LF LB
Forward

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 10/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Logic Table

Direction PA(3) PA(2) PA(1) PA(0) HEX Value


RB RF LF LB
Forward 0 1 1 0 0x06
Backward

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 10/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Logic Table

Direction PA(3) PA(2) PA(1) PA(0) HEX Value


RB RF LF LB
Forward 0 1 1 0 0x06
Backward 1 0 0 1 0x09
Left

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 10/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Logic Table

Direction PA(3) PA(2) PA(1) PA(0) HEX Value


RB RF LF LB
Forward 0 1 1 0 0x06
Backward 1 0 0 1 0x09
Left 0 1 0 1 0x05
Right

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 10/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Logic Table

Direction PA(3) PA(2) PA(1) PA(0) HEX Value


RB RF LF LB
Forward 0 1 1 0 0x06
Backward 1 0 0 1 0x09
Left 0 1 0 1 0x05
Right 1 0 1 0 0x0A
Soft Left

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 10/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Logic Table

Direction PA(3) PA(2) PA(1) PA(0) HEX Value


RB RF LF LB
Forward 0 1 1 0 0x06
Backward 1 0 0 1 0x09
Left 0 1 0 1 0x05
Right 1 0 1 0 0x0A
Soft Left 0 1 0 0 0x04
Soft Right

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 10/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Logic Table

Direction PA(3) PA(2) PA(1) PA(0) HEX Value


RB RF LF LB
Forward 0 1 1 0 0x06
Backward 1 0 0 1 0x09
Left 0 1 0 1 0x05
Right 1 0 1 0 0x0A
Soft Left 0 1 0 0 0x04
Soft Right 0 0 1 0 0x02
Stop

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 10/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Logic Table

Direction PA(3) PA(2) PA(1) PA(0) HEX Value


RB RF LF LB
Forward 0 1 1 0 0x06
Backward 1 0 0 1 0x09
Left 0 1 0 1 0x05
Right 1 0 1 0 0x0A
Soft Left 0 1 0 0 0x04
Soft Right 0 0 1 0 0x02
Stop 0 0 0 0 0x00

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 10/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 11/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program


#include

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 11/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program


#include
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 11/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program


#include
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>

Main-Program

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 11/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program


#include
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>

Main-Program
int main (void)
{
motion_pin_config ();
while(1)
{
forward();
_delay_ms();
stop();
_delay_ms();
}
}
www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 11/14
Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program (Contd..)

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 12/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program (Contd..)


Pin Configuration

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 12/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program (Contd..)


Pin Configuration
void motion_pin_config (void)
{
DDRA = 0x0F; // Output Port
PORTA = 0x00; // Initially motor stop
DDRL = // Enable Pin
PORTL = // Initially low
}

Functions

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 12/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program (Contd..)


Pin Configuration
void motion_pin_config (void)
{
DDRA = 0x0F; // Output Port
PORTA = 0x00; // Initially motor stop
DDRL = // Enable Pin
PORTL = // Initially low
}

Functions
void forward (void)
{
PORTA = 0x06;
}

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 12/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program (Contd..)


Pin Configuration
void motion_pin_config (void)
{
DDRA = 0x0F; // Output Port
PORTA = 0x00; // Initially motor stop
DDRL = // Enable Pin
PORTL = // Initially low
}

Functions
void forward (void)
{
PORTA = 0x06;
}

void stop (void)


{
PORTA = 0x00;
}

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 12/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program (Contd..)

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 13/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program (Contd..)

Define All related motion functions and include in main function

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 13/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program (Contd..)

Define All related motion functions and include in main function

1 Backward();

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 13/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program (Contd..)

Define All related motion functions and include in main function

1 Backward();

2 Right();

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 13/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program (Contd..)

Define All related motion functions and include in main function

1 Backward();

2 Right();

3 Left();

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 13/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program (Contd..)

Define All related motion functions and include in main function

1 Backward();

2 Right();

3 Left();

4 Soft Right();

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 13/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Syntax for C-Program (Contd..)

Define All related motion functions and include in main function

1 Backward();

2 Right();

3 Left();

4 Soft Right();

5 Soft Left();

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 13/14


Outline Pin connections
Basic Movements of Robot Logic Table
Motor Interfacing on Firebird Writing C-Code

Thank You!

www.e-yantra.org Firebird ATmega2560 Robotics Research Platform 14/14

You might also like