Professional Documents
Culture Documents
www.raghu.co.nr
INTRODUCTION
Micromouse is an autonomous robot designed to reach p the center of an unknown maze in shortest possible time and distance .
www.raghu.co.nr
M I C R O C O N T R O L L E R
SENSOR ELECTRONICS
SESNSORS
www.raghu.co.nr
www.raghu.conr
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.raghu.co.nr
Sensors
Commonly used sensors in the field of robotics IR Di i l sensors Digital IR analog sensors
www.raghu.co.nr
Receiver
TSOP1738
Advantages
Detects an obstacle at a distance more than 1meter if tuned perfectly. No ambient light effect. Easy to use.
www.raghu.co.nr
Designing a transmitter :
Use IC 555 in Astable mode
www.raghu.co.nr
Receiver :
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.raghu.co.nr
IR Analog sensor
www.raghu.co.nr
ADC of Microcontroller
Peak ea Detector
obstacle
www.raghu.co.nr
High-Pass filter : g
www.raghu.co.nr
Peak Detector:
www.raghu.co.nr
Forward errors begins when a mouse is either too close or too far from the wall ahead
www.raghu.co.nr
Offset errors, which happens often, is caused by being too far to the left or to the right as you pass through a cell
www.raghu.co.nr
Heading error is known as pointing at walls rather than down the middle of the cell
www.raghu.co.nr
SENSORS
www.raghu.co.nr
Top Down
www.raghu.co.nr
www.raghu.co.nr
Initialize ADC
Start ADC
N0
Yes
Stop
www.raghu.co.nr
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; | 0 40 //starts ADC // t t while(conversion_not_over()); //waits till ADC conversion completes ADCSRA |= 0x10; // clears ADIF flag return(ADCH); return(ADCH) // returns ADC result } int conversion not over(void) conversion_not_over(void) { unsigned int temp; temp = ADCSRA; p ; temp = temp & 0x10; // checks for ADIF flag return(!temp); }
www.raghu.co.nr
Error
PD controller
Motors
www.raghu.co.nr
Error calculating:
If wall is on both sides err = left adc right adc 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.raghu.co.nr
Implementing PD controller:
err_d = err err_past; adj = err * kp + err_d * kd ; kp is proportional controller constant kd is derivative controller constant The value of adj is used to either speed up or speed down one of the wheel .
www.raghu.co.nr
DC Motor
DC Motors are small, inexpensive and powerful motors used widely. These are widely used in robotics for their small size and high energy out. t A typical DC motor operates at speeds that are far too high speed to be useful, and torque that are far too low. Gear reduction is the standard method by which a motor is made useful . Gears reduce the speed of motor and increases the torque
www.raghu.co.nr
Choosing a DC Motor g
DC M t with G Motor ith Gear head h d 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.raghu.co.nr
Logic 1 0
Logic 0 1
www.raghu.co.nr
www.raghu.co.nr
H-Bridges IC s H Bridges in ICs to reduce the drive circuit complexity The most commonly used H-Bridges are L293D and 9 L298 L293D has maximum current rating of 600ma g L298 has maximum current rating of 2A Both has 2 H-Bridges in them g These are designed to drive inductive loads such as relays, solenoids pp Can be used to drive 2 DC motors or 1 stepper motor
www.raghu.co.nr
PWM
STEPPER MOTOR
STEPPER MOTOR is a brushless DC motor whose rotor rotates in discrete angular increments when its stator windings are g g 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 poles.
www.raghu.co.nr
4 Lead stepper
5 Lead stepper
6 Lead stepper
8 Lead stepper
www.raghu.co.nr
4 1 0 0 0
3 0 1 0 0
2 0 0 1 0
1 0 0 0 1
www.raghu.co.in
4 1 0 0 1
3 1 1 0 0
2 0 1 1 0
1 0 0 1 1
www.raghu.co.in
4 1 1 0 0 0 0 0 1
3 0 1 1 1 0 0 0 0
2 0 0 0 1 1 1 0 0
1 0 0 0 0 0 1 1 1
www.raghu.co.nr
www.raghu.co.nr
Commonly used ICs for driving Stepper motor IC s ULN2803 It has 8 channels It channel has maximum current rating of 500ma can be used to drive 2 unipolar stepper motors L293d L297 & L298 UDN2916
www.raghu.co.nr
ULN2803
www.raghu.co.nr
A 1 0 0 1
B 1 1 0 0
C 0 1 1 0
D 0 0 1 1
www.raghu.co.nr
4 Lead stepper
5 Lead stepper
6 Lead stepper
8 Lead stepper
www.raghu.co.nr
Sample program
for(p=0;p<=20;p++) { PORTD=0xA9; delay(65); PORTD=0x65; delay(65); PORTD=0x56; PORTD 0 56 delay(65); PORTD 0x9A; PORTD=0x9A; delay(65); }
www.raghu.co.nr
SW for steppers :
Use timers to create delay. Use Clear Timer on Compare match or Normal Mode
www.raghu.co.nr
Initialize timer
Start Timer
No Wait
www.raghu.co.nr
Chopper Driving:
For better performance of Steppers they should be over driven p pp y 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.raghu.co.nr
Methods of current limiting : Traditional method of using a resistor of appropriate power in g pp p p series with common terminal.
This method is not recommended as there will be huge power wasted in the series resistor resistor.
www.raghu.co.nr
www.raghu.co.nr
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.raghu.co.nr
Batteries:
Choose batteries that can provide high voltage and high power with low weight Should have current capacity more th 700 mah Sh ld h t it than h
Ni-MH Ni-Cds 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.raghu.co.nr
www.raghu.co.nr