You are on page 1of 49

Introduction Does not cover microcontroller Demo Body design Physics Sensor & Alignment PID control -- Speed

Speed Profile DC Motor sizing DC Motor driver Battery Search Algorithm???

Ng Beng Kiat Taiwan2009

Photo of top and bottom of Min5

Ng Beng Kiat Taiwan2009

Minimum mechanical design & construction PCB used as robot body () PCB is tough and strong Good soldering to withstand crash Sensors must be well supported (hot glue )

Ng Beng Kiat Taiwan2009

DEMO

Ng Beng Kiat Taiwan2009

1.0 Body Design Physics ()( )


Centre of gravity & weight transfer Moment of inertia () Robot weight () heavier or lighter? Robot wheel () bigger or smaller?

Ng Beng Kiat Taiwan2009

1.1 Centre of gravity & weight transfer (&)


() High c.g. Acceleration () Reaction () Resultant force

Mouse weight

d weight transferred here

Weight on tire = (robot weight)(d-x)/d

Fig 1: Weight transfer when accelerating


When Robot is not accelerating/decelerating, all weight is on tires If there is no weight on tires -> no grip
6

Ng Beng Kiat Taiwan2009

acceleration() Lower c.g. reaction Resultant force

d x is smaller

Weight on tire = (robot weight)(d-x)/d

Fig 2: Weight transfer when accelerating (low cg)


Lighter or slimmer motors to lower c.g. More weight on tires, hence more grip for acceleration Resultant force acts through c.g.
7

Ng Beng Kiat Taiwan2009

Centrifugal force = (vv)/(2r)

Resultant force

Fig 3 : Weight transfer when cornering()


Stepper motor based micromouse has high c.g. Has a higher tendency to roll over if cornering at high speed.
()

Always keep the robot c.g. as low as possible Make robot as wide as possible () Make your robot like F1 car

Ng Beng Kiat Taiwan2009

1.2 Moment of inertia ()


motor motor

High moment of inertia

Low moment of inertia

I = mr2 m = motor weight

Ng Beng Kiat Taiwan2009

When moment of inertia is high, rotational acceleration () is reduced for the same torque . Torque = I (F = ma)
() = ()

Keep heavy parts like motors, battery etc as close to robot centre as possible
()()

If moment of inertia is high, stronger motor is required, -> bigger battery too!

10

Ng Beng Kiat Taiwan2009

1.3 Robot weight ()


Question : Does a heavier mouse provides more acceleration (has more grip )? Question: ()? Force (Newton) = mass(kg) acceleration(m/s2)

11

Ng Beng Kiat Taiwan2009

tire

FN = mass g g = 9.8 m/s2

Friction force = FN u u = coefficient of friction

Force available to propel the robot forward depends on motor power and friction force . If motor is powerful enough, then friction is the limiting factor ()

12

Ng Beng Kiat Taiwan2009

If motor exerts a force greater than friction force, tires will skid (). To prevent skidding, driving force < friction force

o Friction

= FN u = mass g u o Therefore acceleration limit = gu


o If u=0.7, then acceleration limit is about 7m/s2.


u = 0.7 7m/s2

Acceleration is independent of mass. Limited by tires.

Keep robot weight low -> reduce motor size -> reduce battery capacity.

13

Ng Beng Kiat Taiwan2009

1.4 Robot wheel


Question : A bigger wheel or a smaller wheel? Tire friction is reduced by dirt () Clean tires before run A smaller wheel would need to rotate more times for the same distance o Pick up more dirt() o If maze if dirty, performance will be affected Bigger wheels raise the c.g. ()

14

Ng Beng Kiat Taiwan2009

Lower c.g.

higher c.g.

Smaller wheel, lower c.g.

Bigger wheel, lower c.g.

Weight of wheels and shaft affect the robots c.g. Keep wheels & shaft as light as possible Use light and thin material if possible

15

Ng Beng Kiat Taiwan2009

Hump or step

Hump or step

Big wheel will roll easily over steps or humps( )


16

Ng Beng Kiat Taiwan2009

A bigger surface allows the wheel to ride over unevenness

Wider wheel will also be less affected by unevenness. ( ) On a flat and clean surface, tire diameter and width has negligible impact on performance. ( ) Too wide and its hard to turn
17

Ng Beng Kiat Taiwan2009

1.5 Four wheel drive ?


acceleration c.g.

x
More weight Less weight

During acceleration, weight is transferred to back wheels ( ) During deceleration, weight is transferred to front wheels Good for straight acceleration/deceleration () Complex and hard to build () My dream mouse !!!

18

Ng Beng Kiat Taiwan2009

1.6 Skid Pads


Skid pad (Teflon) Must be rocking 1mm

Wheels on floor

Wheels hanging in the air

19

Ng Beng Kiat Taiwan2009

2.0 Sensors & Alignment


Diagonal sensor

Side sensor

transmitter

Front sensor

Figure: Mouse sensors layout


receiver
20

shield
Ng Beng Kiat Taiwan2009

2.1 Sensor circuit and operation

LeftFront side diagonal rightFront IR LED


Figure : Transmitter circuit diagram

Left and right front sensors pulsed separately to avoid interference


21

Ng Beng Kiat Taiwan2009

Figure : Receiver circuit diagram

22

Ng Beng Kiat Taiwan2009

Tx1 From Tx2 Rx1

Tx2

Rx2

Figure : Timing diagram of sensors signals()

23

Ng Beng Kiat Taiwan2009

IR LED
Pulsing allows higher current to swarm interference

() LED on < 10% of time only -> can stand higher current Pulsing minimize interference from neighbouring sensors Receiver should be less sensitive -> allows high transmitter output () Improve signal noise ratio

24

Ng Beng Kiat Taiwan2009

2.2 Alignment
Lateral offset

Direction offset

Centre of cell

Longitudinal offset

Figure: Types of positional error

25

Ng Beng Kiat Taiwan2009

LALIGN_SEN_VALUE

RALIGN_SEN_VALUE

if( (LALIGN_SEN_VALUE > laSenV3) && (RALIGN_SEN_VALUE < raSenV3)) { //Too left, adjust right alignSpeed= (LALIGN_SEN_VALUE - laSenV3)*maxAlignSpeed/laNearLeftRange ; } else if( (RALIGN_SEN_VALUE > raSenV3) && (LALIGN_SEN_VALUE < laSenV3) ) { // Too right, adjust left alignSpeed = -(RALIGN_SEN_VALUE - raSenV3)*maxAlignSpeed/raNearRightRange); }

Figure: Correcting direction & lateral offset with diagonal sensor


( 45 )
26

Ng Beng Kiat Taiwan2009

Assumption : Lateral and angular offset is small.

Readjust position Threshold eve

Figure: Correcting longitudinal offset with pole detection


()

*Almost all turns are preceded by a pole to no-pole transisition


27

Ng Beng Kiat Taiwan2009

Use front sensors to adjust position before turn

Start of turn

end of turn

Calibrate sensor here

Figure: Correcting longitudinal offset with front wall (exploration)


()
28

Ng Beng Kiat Taiwan2009

Not use in diagonal run

Detect pole to adjust position()

Collision avoidance

Figure: Diagonal run. Collision avoidance and position adjustment

29

Ng Beng Kiat Taiwan2009

3.0 Speed Profile


Rotational speed(wSpeed)

Translational speed (xSpeed)

leftWheelSpeed = xSpeed wSpeed; rightWheelSpeed = xSpeed + wSpeed;

Figure : Speed components of a 2 wheels robot

30

Ng Beng Kiat Taiwan2009

3.1 Two basic speed profiles Translational speed


Speed (m/s) Top speed

Acceleration/ deceleration

end speed

Time(s)

Parameters Top speed Acceleration/deceleration End speed (= curve turn speed) Distance

31

Ng Beng Kiat Taiwan2009

Rotational speed ()
Speed (deg/s) Top speed

Acceleration/ deceleration

Time(s)

3.2 Basic movements


Diagonal & non-diagonal straight runs (wSpeed=0) Pivot turns (xSpeed=0) () Curve turns 90, 180(U), 135(J), 45,V(xSpeed=constant, + wSpeed)

32

Ng Beng Kiat Taiwan2009

90 degrees(x4)

45 degrees (x4)

180 degrees(x2)

135 degrees (x4)

33

Ng Beng Kiat Taiwan2009

V turn (x2)

34

Ng Beng Kiat Taiwan2009

Speed(m/s) Outer wheel end

start

Inner wheel

Time(s) Figure : Curve turn speed profile

35

Ng Beng Kiat Taiwan2009

3.3 Profile generator and PD loop


Profile Generator

speed

error
+-

PWM PD - motor

encoder signals
Set topSpeed, endSpeed, acceleration, distance

Figure : Profile generator and PD loop

No integral term PD control & Profile generator is executed every msec PWM frequency is 10kHz PWM duty cycle = kp errorn + kd (errorn-errorn-1)
36

Ng Beng Kiat Taiwan2009

3.4 Straight speed profile C code


// At the beginning of profile, targetSpeed = topSpeed; // Keep checking for deceleration condition void SpeedProfile() { decelerationRequired = (curSpeed2 endSpeed2)/(2distance); if (decelerationRequired>deceleration) targetSpeed = endSpeed; if (curSpeed<targetSpeed) curSpeed += acceleration; if (curSpeed>targetSpeed) curSpeed -= deceleration; distance += curSpeed; } distance - ; curSpeed -; endSpeed - ; acceleration - ; deceleration -

37

Ng Beng Kiat Taiwan2009

Speed(m/s)

s1 d

Calculating deceleration: A+B = (S1t2)/2 B = S2(t2 - t1)/2 d = S1/t2 = S2/( t2 - t1) o t2 = S1/d o (t2 - t1) = S2/d A = (S1t2 )/2 -B = (S1t2)/2 - S2(t2 - t1)/2 = (S12- S22)/2d = (S12- S22)/2A

s2 A B t1 Figure : Speed profile t2 Time(s)

38

Ng Beng Kiat Taiwan2009

3.5 PD loop and gyroscope


Straight xSpeed +Profile gen

xError

PD

+-

left L

(R+L)/2

Curve turn Profile gen

wSpeed

+-

wError

PD

right R

alignSpeed

(R-L)/2 or gyro

Figure : rotational and translation control loop

leftSpeed = xSpeed wSpeed; rightSpeed = xSpeed + wSpeed; xSpeed = (rightSpeed+leftSpeed)/2 wSpeed = (rightSpeed-leftSpeed)/2

39

Ng Beng Kiat Taiwan2009

Gyro is fast in response Accurate for fast curve turn (not for very slow turn) / opposite of optical encoder Need to calibrate before run due to DC drift ? Not affected by tires size change

40

Ng Beng Kiat Taiwan2009

4.0 DC motor sizing


Speed (m/s) Maximum power

7 m/s2

7 m/s2

Time(s)

Step 1 : Calculate maximum power required Force(N) = mass(kg) acceleration(m/s2) = o Desired acceleration = 7 m/s2 // experience required
41

Ng Beng Kiat Taiwan2009

Force = 0.12kg 7m/s2 = 0.84N Power (W) = force(N) speed(m/s) ( = ) Maximum power is required when robot is accelerating at 7 m/s2 near top speed = 3m/s. Max power required = 0.84N3 m/s = 2.52 watt. Since there are 2 motors, power required per motor = 1.26 W. Step 2 : Select motor (Faulhaber 1717SR) Choose a motor with maximum Power 1.5 times to 2 times 1.26W = 1.89W to 2.52 W, Which is less than the Pmax of 1.96 W (Faulhaber 1717SR).

42

Ng Beng Kiat Taiwan2009

Note that I also overdrive the motor. 2x Lithium Polymer = 8.4V. Average around 7.8 volts Maximum power out at 7.8 V = (7.8/6)2 1.96 = 3.3 watts Step 3 : Select gear ratio Calculate torque and speed o Tires diameter is 24mm o Torque required = Forceradius ( = )

43

Ng Beng Kiat Taiwan2009

= 0.84N 12mm = 10.08 mNm o Torque required per motor = 5.04mNm. o Wheel circumference = Pidiameter = 0.0754m o At 3m/s, wheel revolution = speed/circumference = 3/0.0754m = 39.8 rps = 2387 rpm Therefore, near top speed, motor must be able to provide torque output of 5.04mNm at speed of 2387 rpm.

44

Ng Beng Kiat Taiwan2009

Speed rpm 14000 Max power 1.96W Speed (m/s)

7 m/s2

7 m/s2

Top speed 2387 rpm 5 10 15 Torque mNm

Accelerating 5.04mNm Figure : DC motor speed-torque characteristic

45

Ng Beng Kiat Taiwan2009

Speed rpm 14000 Max power 1.96W

32

1:1

Gear ratio 2:1

12

7000 4667 Top speed 2387 rpm 5 10

3:1 15 Torque mNm

Accelerating 5.04mNm Figure : DC motor speed-torque characteristic

46

Ng Beng Kiat Taiwan2009

There is a range of gear ratio to select from The higher the gear ratio, the more energy efficient the motor is. Allows spare power for alignment

Prefer long & slim motors to short and fat motor. Lower c.g.

47

Ng Beng Kiat Taiwan2009

4.1 DC motor driver

Pull up

MOSFET driver

motor driver

Figure : Min5 motor driver circuit

-Choose low turn-On resistance MOSFET -Pull up input to prevent conduction

48

Ng Beng Kiat Taiwan2009

User interface
Need feedback to tell what the mouse is doing LED lights Sound Menu driven (dotmatrix display & input switch)

Websites
Visit my website at www.np.edu.sg/alpha/nbk (A* Pathfinding ) http://www.policyalmanac.org/games/aStarTutorial.htm (Nakashima website) http://homepage1.nifty.com/hfd01577/index.html (Pete Harrison) http://micromouse.cannock.ac.uk

Good Luck!

49

Ng Beng Kiat Taiwan2009

You might also like