Вы находитесь на странице: 1из 16

29 maja 2012

Sterowniki robotw
Prowadzcy: mgr in. Jan Kdzierski
Temat projektu:
The EMEA Freescale Cup 2012
Pod temat:
Budowa Autonomicznego Robota Mobilnego
Podajcego Za Lini
Autor:
Damian Trzeciak 180453
Mateusz Piszczek 180497
Krystian liwa 180386
Contents
1 Overal Informations 2
2 Mechanical Design 3
3 Electronics design 7
4 Control Circuit 12
5 Control Software 14
6 Bibliography 15
1
1 Overal Informations
The Freescale Cup is competition where students from universities located all over the
world, make eort to designe, build, program and nally race a model of car around the track
outlined by black line on white surface. To assure equal chances for all competitors of this
competition, each of them must use same standard kit of parts1 delivered from Freescale.
The standard race kit contain car chassis with parts helpfull to develop mechanical aspects of
the model, servo motor for control wheels, camera sensor, power stage board with MC33932
H-bridges, battery and TRK-MPC5604B developement kit. It is not allowed to change DC
motors, transmission ratio of drive motors, interfer into chassis parameters which could inu-
ent onto driving parameters, type of steering servo motor, build additiona circuits to provide
more power to motors and use any additional programmable device or microcontroler besides
Freescale MPC5604B microcontroller included on development kit.
Figure 1: Parts included in starting kit: chassis with extra parts, power stage board, camera
sensor, developement kit with microcontroller
2
2 Mechanical Design
Figure 2: Developed car model.
Most importat thing in mechanical construction was suitable placement of microcontroller
board, power stage board and camera with extra light panel.
Figure 3: Microcontroller board placement.
The elements of sheet iron were used to mount the main board with microcontroller and the
3
drive board to the chassis. The sheet iron is easy to cut and shape, even after applaying onto
the chassis. It also sti enough to guarantee reliability of construction.
Figure 4: LED diodes panel.
Figure 5: Lighten up area.
Sheet iron was also used as a platform for LED diodes, in nal version there is 35 white LED
diodes placed in three rows and conected in circuit as two parrarel rows of 18 and 17 serial
conected diodes. Sheet iron allowed to bend platform for lighten up directly surface area seen by
the camera. Camera and LED platform were mounted on the construction made from universal
modelling parts which allow easy adjust the area before car seen by camera sensor.
Final camera position was determined by need to own knowledge about line position a moment
before car reach that point of the road.
Figure 6: Motors and transmission.
4
Each part not allowed to change was not changed and stayed in custom conguration. Car
chassis was not specically modicated. Installed suspension was adjusted to get the hardest
possibly conguration. Servo motor was installed in refernece to guide included to model chassis
kit.
Figure 7: Servo motor placement.
Servo motor was installed in refernece to guide included to model chassis kit. No extra motors,
servos and sensors were used.
Figure 8: Developed model dimensions.
To improve reability of construction battery were connected to chassis by two hose clips. Wires
supplying microcontroller board from power stage board were soldered to microcontroller board.
5
Figure 9: Battery placement and protection of power supply.
For supply regulated current source of LED panel and power stage board, suitable conecting
wire was developed. For better control of regulated power source of LED panel, swich alow to
easy connect and disconect power supply .
Figure 10: Developed model dimensions.
Overal weight of developed model is 1250 5g, so standard motors have not problems with
move model rapidly and easy reach demanded velocity.
6
3 Electronics design
Figure 11: TRK-MPC5604B developement board description.
Development board with MPC5604B microcontroller is a brain of autonomus car model. In
developed model we used:
LEDs to signalize states of machine;
switches to create simple interface of program;
potentiometer to set velocity in debug mode;
input/output pins congurated as pulse wide modulated signals for drive motors and
servo motor control;
input/output pins congurated as inputs of Analog/Digital Converter for data aquisition
fram potentiometer and camera sensor;
input/output pins congurated as outputs for control signals to H-bridges and camera.
7
Figure 12: Standard power stage board conguration.
Recongured standard power stage board circuit allowed change direction of motor rotation
using microcontroller output assigned to PB(16) pin. Output state on PB(16) pin determine
direction of rotation both motors. It is used to break after nishing race.
Figure 13: Standard power stage board conguration.
8
Output state on PB(16) pin determine direction of rotation both motors. Used to break af-
ter nishing race. To control speed of rotation, signal delivered to H-bridge is pulse width
Figure 14: H-bridge posible states.
modulated. Puls wide modulation with 20ms period is also used to control servo motor. This
features are available in eMIOS module of MPC5604B microcontroller. The LM358 low power
amplier device was used to provide correct LED diodes work. Developed light drive board
realized function of regulated current source which translate control signal from 0 to 5 [V] into
source current regulated from 5 mA to 350 mA. Solution based on current source protect LED
diodes of overvoltage and greatfully increase the performance of light drive power consump-
tion in comparasion to regulated voltage power supply, based on LM318 device. It allowed to
decrease overal model power consumption for 390 mA.
9
Figure 15: LED diodes circuit.
Potentiometer which was integral part of light drive circuit and allow to change light power,
has been used as free value seter. Volteg on it is sensed by ADC module and we could use it
in debug modes to set any value, i.e. motors PWM duty, light drive cintrol PWM duty, max
speed value, etc.
Figure 16: Potentiometer.
Developed model has not had troubles with noises on data sensed from camera while motors
were in run from rst tests. In some tests after local qualications our team discovered that
wire connecting GND to camera was originally broken down, and only thanks to that, noises
from motors had no impact on sensed data. Futher tests show that camera sensor provide
full functionality even without connection to ground. To ensure that noises would be totally
removed from sensed data independent of wire used to connect camera to power stage board,
GND pin was removed.
10
Figure 17: Pin removed from camera sensor connection socket on power stage board.
Power consumption of the constructed car:
only light panel minimum power: 5 0.1mA
only light panel average power: 170 10mA
only light panel with maximum power: 350 10mA
only microcontroler board: 96 0.1mA
microcontroler board and servo: 200 10mA
mcrocontroler board and motors without load and on maximum allowed voltage: 250
10mA
average power consumption with maximum light power, maximum motor speed and with-
out load: 710 10mA
averege power consumption with maximum light power, middle motor speed and load
made by forward movement of model: 1140 10mA
11
4 Control Circuit
Figure 18: One control cycle
Autonomus control of the model is realized by innite loop of control cycles. Cycle starts
with ADC data aquisition from 128 pixels of camera sensor. Based on that data the line posi-
tion and nish line recognition is realized and translated into signal for line position regulation
in closed loop with PD regulator with saturation. Basing on regulation signals control function
set value for PWM outputs controling drive motors and servo motor. Control cycle is realized
Figure 19: Cycle generation with usage of STM.
in interrupts triggered by System Timer Module of microcontroller. It allows to optimalize
usage of microcontroller with time required for camera sensor pixels radiation. Event number 2
on timer value chart trigger ADC data conversion to read values of camera sensor pixels. When
all pixels have been read timer value is set to 0 for wait 8 ms to another conversion. Moment
later other chanel of STM trigger interrupt in wich all processes required to control the car, as
PD algorithm, decision function realizing dierential motor drive and adjustment of speed are
included. Always two cycles are nished before PWM cycle for servo motor is complited and
new duty for it is set.
In case of best adjustment of camera lens position, and pixel charge transfer time, data aquisited
by camera were transfered to computer by UART protocol and visualized in computing envi-
ronment MATLAB. It also allowed fast development and testing line determining algorithm.
TAOS TSL1401CL camera light sensor is the only one sensor used in the project.
12
Figure 20: Camera sensor data visualization in MATLAB.
Figure 21: Line and nish recognition algoritms on data in MATLAB.
Data visualization give many useful information as:
how camera sensor react on changing light conditions;
what is inuence of external lighting panel on aquisited data;
how adjust camera lens for best focus without oscilloscope;
what is inuence of pixel charge time on received data.
It was also helpful in proces of adjusting gains for PD regulator parts, when you see what is
position of race line determined by algorithm and how control function set the servo for this
situation.
Line position determining function return the number of pixel in camera sensor, on which algo-
rithm found middle point of recognized track line. PD algorithm has proportional gain 6 which
allow to transfer dierence from input signal, the value returned from line position detection
function, and number 64 symbolizing the middle point of camera sensor array, into value which
is easy to implement to drive servo motor.
The most of logic of the model is realized in fourth step of control cycle, aplicating results of
regulation to the PWM modules control motors and drirection servo. Basing on the choosen
type of racing function the inuence control algorithms on the PWMs is dierent. The simplest
algoritm change servo PWM frequency depending on the information from PD regulator.
Next aglorithm add dierential motor driving. To develop dierential implemetation , measur-
ments of dependence between servo PWM value and radius of circles traced by left and right
rear wheels of model. Knowledge of that dependence allowed to compute ratio of velocities
for wheels in dependance of how model change direction of movement which is equal to servo
13
control PWM value. If assume that load on motors is constant, the dependance between motor
control PWM value, higher than some constant, and velocity of motor wheel is linear. This
constant value of motor control PWM is equal to the smallest motor control PWM value in
which model is still moving forward and do not stop. Developed algorithm is based on linear
function of regulation signal from PWM, adjusting ratio of set motor control PWM values for
left and right motor.
Last algorithm to add maximum motor speed regulation in dependence of regulation signal
from PD regulator. Linear function simillar to this in dierential motor drive algorithm de-
crease maximum motor PWM value for both wheels if model do not have to go stright.
All those algoritms can work as onlyone algorithm as well as cooperate for better performance.
All logic part of control cycle like: line position determinning, evaluate PD regulation result
and realize motor control algorithm, are computed in interrupt handled after reading data from
camera is done. In this part also engine current is measured, and its value is used to determine
if car is on the slope. If current of both motors suddenly increase it is recognized as slope and
max speed of both motor is set for short time to faster get out from slope.
5 Control Software
Control software was developed with help of CodeWarrior IDE and RAppID application
customized for MPC5604 series microcontrolers.
Figure 22: Main function.
14
Figure 23: Race function.
6 Bibliography
source of usefull information http://thefreescalecup.wikidot.com/
microcontroller board http://www.freescale.com/webapp/sps/site/prod summary.jsp?code=TRK-
MPC5604B
power stage board http://thefreescalecup.wikidot.com/en:hints-and-notes-to-chassis-assembly
mechanic parts, servo placement, motors placement and transmition on wheels http://thefreescalecup.wdles.com/local
les/en%3Aassembly-of-car-chassis/TheFreescaleCupCarModelAssemblyManual.pdf
line scan camera http://www.taosinc.com/ProductDetails.aspx?id=186
regulated current source LM358 datasheet
15

Вам также может понравиться