Professional Documents
Culture Documents
MICROMOUSE
Amit Raj
2nd Yr ECE
SASTRA University
www.amitraj.webs.com
INTRODUCTION
www.amitraj.webs.com
M
I
C
R
LEFT O
MOTOR
C SENSOR
MOTOR O ELECTRONI SESNSO
DRIVER N CS RS
T
RIGHT R
MOTOR O
L
L
E
R
www.amitraj.webs.com
Basic components of Micromouse:
Sensors
Motors
Microcontroller
Batteries
www.amitraj.webs.com
SENSORS
www.amitraj.webs.com
Sensors
IR Digital sensors
IR analog sensors
www.amitraj.webs.com
IR Digital sensors
Transmitter
IR led connected to 38KHz oscillator
Receiver
TSOP1738
Advantages
Detects an obstacle at a distance more than
1meter if tuned perfectly.
No ambient light effect.
Easy to use.
www.amitraj.webs.com
Designing a transmitter :
www.amitraj.webs.com
Receiver :
www.amitraj.webs.com
IR Analog sensors
Transmitter
IR LED
Receiver
IR Photodiode
Advantages:
Can measure distance up to 15 cm.
Disadvantages:
Responds to IR rays present in ambient light.
Intensity of reflected rays is non-linear with respect to
distance of obstacle
www.amitraj.webs.com
IR Analog sensor
www.amitraj.webs.com
Modulate IR rays to avoid Ambient light effect :
Astable oscillator at
Transmitter
frequency greater
IR led
than 1KHz
www.amitraj.webs.com
High-Pass filter :
www.amitraj.webs.com
Peak Detector:
www.amitraj.webs.com
Errors involved in mouse movement :
Forward error:
www.amitraj.webs.com
Errors involved in mouse movement :
Offset error :
www.amitraj.webs.com
Errors involved in mouse movement :
Heading error:
www.amitraj.webs.com
Commonly used Sensor arrangement :
Top Down
Side Looking
SENSORS www.amitraj.webs.com
Top Down
www.amitraj.webs.com
Side looking sensors :
www.amitraj.webs.com
Initialize ADC
Select ADC
channel
Start ADC
ADC
convers
N0 Yes Read ADC
ion
comple value
te
Stop
www.amitraj.webs.com
Side looking
Sample code for ADC conversion in AVR controllers :
Unsigned int left_adc;
left_adc = adc(0xE0);
unsigned int adc(unsigned int temp)
{
ADMUX = temp; //selects ADC channel
ADCSRA |= 0x40; //starts ADC
while(conversion_not_over()); //waits till ADC conversion
completes
ADCSRA |= 0x10; // clears ADIF flag
return(ADCH); // returns ADC result
}
int conversion_not_over(void)
{
unsigned int temp;
temp = ADCSRA;
temp = temp & 0x10; // checks for ADIF
flag
return(!temp);
}
www.amitraj.webs.com
Reducing error using PD controller :
Error PD
Motors
controller
www.amitraj.webs.com
Error calculating:
If wall is on both sides
err = left_adc – right_adc;
If err is +ve
• Mouse is near to left wall and as a correction it has to move
towards right wall
www.amitraj.webs.com
Bi-Direction control of DC Motor
H-Bridge Ckt using transistors for
bidirectional driving of DC motor
Direction Pulse to
Clock wise A and C
Anti Clock wise B and D
www.amitraj.webs.com
H-Bridges in IC’s to reduce the drive circuit
complexity
The most commonly used H-Bridges are
L293D and
L298
L293D has maximum current rating of
600ma
L298 has maximum current rating of 2A
Both has 2 H-Bridges in them
These are designed to drive inductive loads
such as
relays, solenoids
Can be used to drive 2 DC motors or 1
www.amitraj.webs.com
stepper motor
PWM
STEPPER
MOTOR
STEPPER MOTOR is a brushless DC motor whose
rotor rotates in discrete angular increments when
its stator windings are energized in a programmed
manner.
Rotation occurs because of magnetic interaction
between rotor poles and poles of sequentially
energized stator windings.
The rotor has no electrical windings, but has
salient and/or magnetized poles.
www.amitraj.webs.com
4 – Lead stepper 5 – Lead stepper
www.amitraj.webs.com
Full Step driving of Stepper Motor
4 3 2 1
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
www.amitraj.webs.com
Full Step driving of Stepper Motor
4 3 2 1
1 1 0 0
0 1 1 0
0 0 1 1
1 0 0 1
www.amitraj.webs.com
Half Step driving of stepper motor
4 3 2 1
1 0 0 0
1 1 0 0
0 1 0 0
0 1 1 0
0 0 1 0
0 0 1 1
0 0 0 1
1 0 0 1
www.amitraj.webs.com
Choosing a Stepper motor
12 V or 5 V operating voltage
1.8 degree step
6 Lead
250 to 500 ma of current
or
Coil resistance of 20 ohms to 40 ohms
Size and shape depends on application
In most of the robotics cube shaped
motors are preferred with frame size of 3.9
to 4 cm
www.amitraj.webs.com
Commonly used IC’s for driving Stepper motor
ULN2803
• It has 8 channels
• It channel has maximum current rating of
500ma
• can be used to drive 2 unipolar stepper motors
L293d
UDN2916
www.amitraj.webs.com
ULN2803
www.amitraj.webs.com
Bi – Polar driving of Stepper Motor
A B C D
1 1 0 0
0 1 1 0
0 0 1 1
1 0 0 1
www.amitraj.webs.com
4 – Lead stepper 5 – Lead stepper
www.amitraj.webs.com
Sample program
for(p=0;p<=20;p+
+)
{ void delay(unsigned int
PORTD=0xA9; m)
delay(65); {
PORTD=0x65; unsigned int n;
delay(65); while(m--)
PORTD=0x56; for(n=0;n<=100;n++);
delay(65); }
PORTD=0x9A;
delay(65);
}
With this SW Steppers can’t be controlled individually
www.amitraj.webs.com
SW for steppers :
www.amitraj.webs.com
Initialize
Interrupt routine
timer
Give Pulse to
Start Timer stepper
Update Output
Is compare
Stepp register
No
er
target Wait
Reti
reach
ed
Yes
Stop
timer
www.amitraj.webs.com
Chopper Driving:
www.amitraj.webs.com
Methods of current limiting :
www.amitraj.webs.com
Best method of current limiting :
www.amitraj.webs.com
Microcontroller:
www.amitraj.webs.com
Batteries:
Choose batteries that can provide high voltage and high power with
low weight
Should have current capacity more than 700 mah
Li – Ion
Can provide high current at 3.6v
Should be charged using CCCV charger .
www.amitraj.webs.com
You can download this
presentation at
www.amitraj.webs.com
www.amitraj.webs.com