Professional Documents
Culture Documents
SeguidorLinea FSM Inglestecnico
SeguidorLinea FSM Inglestecnico
Electronic circuits IV
Private University of Tacna Alvarado. State Machines with System Generator 2
Electronic circuits IV
Private University of Tacna Alvarado. State Machines with System Generator 3
III. DESIGN OF THE STATE MACHINE We present the table of all possible combinations that will
To begin to work we must clarify that all will work in co- exist with the 8 sensors.
simulation mode we will have as an 8-bit digital sensor QTR-8A Infrared Sensor (inputs)
where 1 means that you are on a black surface and 0 that S1 S2 S3 S4 S5 S6 S7 S8
is on a white surface, as we will have 2 signals
PWM that Iran to the motors.
Left OUTMotor
IN (0:7)Digital
Sensors
State Machine
OUTMotor
Right
Fig.5"Combinations that you will never be able to give a The painted boxes are the sensors that will be within the
real follower" black line, for 1 sensor active means that the robot is on
For this reason there are combinations that shall not be the verge of derailed and go on the other hand the opposite
taken into account we will proceed to identify only the motor PWM output must be greater to return to the
possible combinations that will exist, it can be said that in environment and be able to correct that error.
the skills of this type of robot the line to follow is 2.00 +/- When the sensors S4 and S5 are enabled (high value 5v)
0.05 cm which in our 3 sensors sensor cover exactly, but means that the robot is in the middle will come to be our
for practical values will be taken into account set point, it's almost impossible to always be in that
combinations 2 sensors. position as in the test tracks are full of curves, were also
taken into account 3 combinations of activated sensors ,
this in practice is when the robot makes closed curves to
make these curves the robot is placed with an inclination
of 45 and 3 sensors fit into these 2 cm, you can also take
into account that 4 sensors are activated, but was not taken
into account in the work that would have to be extremely
curves Closed and according to the rules of only 45
curves.
Fig.6"Size of the regulatory black line is 2 cm aprox." Then once defined the combinations are defined the states
that will be the same, more 2 states that will be: When any
sensor is activated and when for some reason is to
generate another combination that don't take into
account. See Table 5.
Electronic circuits IV
Private University of Tacna Alvarado. State Machines with System Generator 4
13 State 80 20 114
14 State 70 10 97
Decimal value 15 State 0 0 0
Input Column State 16 State 30 30 51
B-00000001 1 State 0
B-00000011 3 State 1 Table 6 "PWM outputs the system"
B-00000110 6 State 2 In table 6 we define the PWM signal in percentage values
B-00001100 12 State 3 and also we have a column which speaks to us of the
B-00011000 24 State 4 output values, these values are for the array that asks us to
block Melay State Machine.
B-00110000 48 State 5 The outlet of the machine of Mealy will be defined
B-01100000 96 State 6 according to the 10 types of speeds, but at the exit of the
B-11000000 192 State 7 block of Mealy we will have only a decimal number and
B-10000000 128 State 8 we need to divide it in some way to control the two motors
B-11100000 224 State 9 in a different way, we have the solution to divide this
number with the blocks "Slice" that allow us to separate
B-01110000 112 10 State
the most significant bits (MSB) and the less
B-00111000 56 11 State significant (LSB) With this we give solution to the
B-00011100 28 12 State problem.
B-00001110 14 13 State
B-00000111 7 14 State
B-00000000 0 15 State
Other Another 16 State
Now that we have the States need to have the Fig.7"Block Slice that separates MSB to LSB"
corresponding outputs, we define 10 types of PWM
outputs where only the size of the pulse, we do this Now How many bits do we need? Although for 10 types
because there are cases such as the state 0 where the robot of speeds we may use 4-bit that gives us the possibility of
is about to get out of the black line, then you need greater 16 speeds but as we are separating the most significant
speed in the opposite direction. bits and 2-bit would be less significant for each engine
which gives us only 4 speeds for each one, given the
Output clarification we need 4-bit but for each one that makes a
Outputs (%) Values total of 8 bits.
United Engine Left Engine Right Matrix Value Vel. % # Of Speed Binary
State 0 60 20 82 0 0 B-0000
State 1 70 40 116 10 1 B-0001
State 2 90 60 133 20 2 B-0010
State 3 100 80 151 30 3 B-0011
State 4 100 100 153 40 4 B-0100
State 5 80 100 121 60 5 B-0101
State 6 60 90 88 70 6 B-0110
State 7 40 70 70 80 7 B-0111
State 8 20 60 37 90 8 B-1000
State 9 20 70 38 100 9 B-1001
10 State 30 80 55
11 State 40 90 72 Table 7 "Summary of Velocity"
12 State 90 40 132
Electronic circuits IV
Private University of Tacna Alvarado. State Machines with System Generator 5
Now as the Mealy gives us output values of output in IV. FINAL RESULT
decimal we need to find the speed in decimal to place it in
the output array.
E.j. In the state 4 the two engines have to run to the 100%
that means that the number of speed will be 9 and 1001 is
represented in binary.
Array of states:
[15 116 016 162 1616 1416 1613 163 1616 1616 1616 164 1616
1612 1616 1616 1616 1616 1616 1616 1616 1616 1616 1616
1616 165 1616 1616 1616 1611 1616 1616 1616 1616 1616
1616 1616 1616 1616 1616 1616 1616 1616 1616 1616 1616
1616 1616 1616 166 1616 1616 1616 1616 1616 1616 1616
1610 1616 1616 16 16 16 16 16 16 16 16 16 16 16 16 816 1616
1616 1616 1616 1616 1616 1616 1616 1616 1616 1616 1616
1616 1616 1616 1616 1616 1616 1616 1616 1616 1616 1616
1616 1616 1616 1616 1616 1616 1616 167 1616 1616 1616
1616 1616 1616 1616 1616 1616 1616 1616 1616 1616 1616
1616 169 1616 1616 1616 1616 1616 1616 16 16 16 16 16 16
16 16 16 16 16 16 16 16 16 16 16 ;
Output Array:
[51 082 133 116 9751 5151 5151 114 151 51 51 51 51 51 51 51
51 51 51 51 51 51 51 132 153 5151 5151 5151 5151 5151 5151
5151 5151 5151 5151 121 51 51 72 51 51 51 51 51 51 51 51 51 Fig.9"End Result of the machine,Simulation"
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
51 51 51 51 51 51 51 51 51 51 51 88 51 51 51 51 51 51 51 51
It was tested with a value entry the 56 that seeing the table
51 51 51 51 51 51 51 51 51 55 51 51 51 51 51 51 51 51 51 51
51 51 51 51 51 51 51 37 51 51 51 51 51 51 51 51 51 51 51 51 would be in the state 56 and would have an output of 40
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 and 90 % , it was confirmed at the time to simulate.
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
51 51 51 51 51 51 51 70 51 51 51 51 51 51 51 51 51 51 51 51
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
51 51 38 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
51 51 51 51 51 51 51 51 51 51 51 51 51 51;
These values are only for the first state but if we realize
the following states will have the same number of values,
therefore it is the same for the 16 states.
Electronic circuits IV
Private University of Tacna Alvarado. State Machines with System Generator 6
VI. BIBLIOGRAPHY
IEEE Xplore Digital Library - Design and
Implementation of PID Control-based
Wsf Algorithm on Line Following Robot. Adnan
Rafi al Tahtawi, Yoyo Haritman Somantri, Erik.
Xilinx System Generator v2.1 for Simulink
Electronic circuits IV