Академический Документы
Профессиональный Документы
Культура Документы
connected to GPIO24 will change to Logic HIGH. When the ultrasonic wave reflected
back to the sensor, the Echo pin will change to Logic LOW again. The time it takes the
Echo pin to change HIGH to LOW is used to calculate the distance between the car and
the obstacle. Here, the output of the Echo pin is 5V but the GPIO pin can only accept
3.3V. A simple solution to solve this problem is to use a voltage divider circuit. It
contains two resistors (1kΩ and 2kΩ) connected in series, with the input voltage of 5V
applied across the resistor pair and the output voltage of approximately 3.3333V across
the 2kΩ. This 3.3333V is now applied to the GPIO24 confidently.
The four IR Reflective Sensors are attached to the four corner of the car facing
the ground to detect the edge. IR Reflective Sensors have three pins, Signal, Power
Supply, and Ground. All of the Power Supply pins and Ground pins are connected to
the 3.3V output and Ground of the Raspberry Pi respectively. The signal pins of the IR
Sensor are connected to the GPIO pins, 17(front-left), 27(front-right), 22(back-left),
and 10(back-right).
To capture the video along the track, a Pi Camera module which is compatible
with the Raspberry Pi is connected with the CSI (Camera Serial Interface) from the
Raspberry Pi using a 15-pin ribbon cable. Since the viewing angle of the camera is
limited, a Servo Motor is needed to improve it.
A Servo Motor is used to rotate the elevation angle of the Pi Camera. It has three
pins, Power Supply, Control and Ground. The 5V Power Supply for the Servo Motor
is connected with the Enable pin of the DC Motor Driver. The Control and Ground pins
are connected with the GPIO25 and Ground pins of the Raspberry Pi respectively.
The main component of the robot car is the Raspberry Pi, it is used as a single
board computer. It control all the other parts of the robot car and also used to connect
with the Client’s Browser using wireless connection Wi-Fi. The Micro USB power
supply pin of the Raspberry Pi supply by using 5V-2A power bank.
3.2. Operation
The operation can be divided into two parts. One is for the server and other is
for the client. The server also performs the process of acquisition of sensor’s data and
controlling the motors.
Client Server
SYN
SYN-ACK
ACK
grey background. At the same time, every user command will be transmitted to the
server. When the user touches or presses on a button, the corresponding command such
as ‘forward’, ‘reverse’, ‘left’ and ‘right’ will be send at once but the ‘stop’ command
will be sent after the user release the button.
between the obstacle and the sensor. To calculate the distance, equation 2.2 is used.
Then the result representing the distance in cm will be saved as a floating point number.
1 0 1 0 Forward 45%
(1.49 V)
0 1 0 1 Backward 35%
(1.16V)
0 1 1 0 Left 80%
(2.64V)
1 0 0 1 Right 80%
(2.64V)
0 0 0 0 Stop 0%
(0V)
If the command is “Forward”, the car will go forward and all of the motors will
turn in forward direction. To make Motors 1 and 2 go forward, set IN1=HIGH and
IN2=LOW. To make Motors 3 and 4 go forward, set IN3=HIGH and IN4=LOW. In
fact, a PWM signal with a 45% duty cycle is generated by the Raspberry PI instead of
giving a constant 3.3 V output when the input pin IN1 and IN3 needed to go HIGH.
Therefore, the average voltage at these input pins drop to 1.49 V and the motor turning
at a moderate speed a human can handle. Likewise, an equivalent of Logic LOW output
(0 V) is obtained by changing the duty cycle to 0%.
47
If the command is “Down”, the servo angle will decrease by 10 degrees and the
duty cycle decrease by 0.7%.