Professional Documents
Culture Documents
Making of Micromouse
Making of Micromouse
MICROMOUSE
Amit Raj
2nd Yr ECE
SASTRA University
www.amitraj.webs.com
INTRODUCTION
www.amitraj.webs.com
M
I
C
R
O
LEFT
MOTOR
MOTOR
DRIVER
RIGHT
MOTOR
C
O
N
T
R
O
L
L
E
R
SENSOR
ELECTRONI
CS
SESNSO
RS
www.amitraj.webs.com
www.amitraj.webs.com
SENSORS
Your mouse is going to need sensors to tell it
about itself and its environment.
These are used to detect the presence or absence
of walls and to verify your position in the maze.
They will also be important in ensuring that the
mouse maintains an appropriate path without
hitting any walls
www.amitraj.webs.com
Sensors
Commonly used sensors in the field of robotics
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 :
Use IC 555 in Astable mode
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
ADC
of
Microcontrol
ler
Peak
Detector
Transmitter
IR led
High pass
filter , Cutoff freq
more than
300Hz
Receiver
IR Photodiode
obstacle
www.amitraj.webs.com
High-Pass filter :
www.amitraj.webs.com
Peak Detector:
www.amitraj.webs.com
www.amitraj.webs.com
www.amitraj.webs.com
www.amitraj.webs.com
Top Down
Side Looking
SENSORS
www.amitraj.webs.com
Top Down
www.amitraj.webs.com
www.amitraj.webs.com
Initialize ADC
Select ADC
channel
Start ADC
N0
ADC
convers
ion
comple
te
Yes
Read ADC
value
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
Error
PD
controller
Motors
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
If wall is only on leftside
err = left_adc reff_value;
If err is +ve
Mouse is near to left wall and as a correction it has to move
towards right wall
If wall is only on rightside
err = right_adc reff_value;
If err is +ve
Mouse is near to right wall and as a correction it has to move
towards left wall
www.amitraj.webs.com
Implementing PD controller:
DC Motor
DC Motors are small, inexpensive and powerful
motors used widely.
Choosing a DC Motor
DC Motor with Gear
head
Operating voltage 12V
Speed
Depends on our
application
Some available speeds in
market
30 RPM
60 RPM
100 RPM
150 RPM
350 RPM
1000 RPM
www.amitraj.webs.com
Black wire
Positive
Negative
Negative
Logic
1
0
Positive
Logic
0
1
Direction of
rotation
Clock wise
Anti clock wise
Directio
n
Clock
Anti
clock
www.amitraj.webs.com
Pulse to
Clock wise
A and C
B and D
www.amitraj.webs.com
PWM
STEPPER
MOTOR
www.amitraj.webs.com
4 Lead stepper
6 Lead stepper
5 Lead stepper
8 Lead stepper
www.amitraj.webs.com
www.amitraj.webs.com
www.amitraj.webs.com
www.amitraj.webs.com
www.amitraj.webs.com
www.amitraj.webs.com
ULN2803
www.amitraj.webs.com
www.amitraj.webs.com
4 Lead stepper
6 Lead stepper
5 Lead stepper
8 Lead stepper
www.amitraj.webs.com
Sample program
for(p=0;p<=20;p+
+)
{
PORTD=0xA9;
delay(65);
PORTD=0x65;
delay(65);
PORTD=0x56;
delay(65);
PORTD=0x9A;
delay(65);
}
With this
SW Steppers cant
be controlled individually
www.amitraj.webs.com
SW for steppers :
Use timers to create delay.
Use Clear Timer on Compare match
or
Normal Mode
www.amitraj.webs.com
Initialize
timer
Interrupt routine
Give Pulse to
stepper
Start Timer
Is
Stepp
er
target
reach
ed
Update Output
compare
register
No
Wait
Reti
Yes
Stop
timer
www.amitraj.webs.com
Chopper Driving:
For better performance of Steppers they should be
over driven and current should be limited .
For example a 5 V 500ma motor can be driven at
more than 15V but current in the coil should be
limited to approximately 500ma .
www.amitraj.webs.com
www.amitraj.webs.com
www.amitraj.webs.com
Microcontroller:
Choose the controller that has sufficient
Amount of FLASH memory to store your program
Amount of RAM memory for variables
Number of Timers
Min of TWO 16 bit timers or ONE 16 bit timer with
TWO output compare channels
and ONE 8 bit
timer
Number of ADC channels
Good operating speed
ATMEGA32 of Amtel made is one that is suitable
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
Ni-MH & Ni-Cds
Can provides high current at 1.2 V
Can be charged by Constant Current or Constant Voltage chargers
Li Ion
Can provide high current at 3.6v
Should be charged using CCCV charger .
www.amitraj.webs.com
www.amitraj.webs.com