Self-Balancing Robot
User Guide
21
www.terasic.com
July 12, 2018
1
1
.
.
4
4
D
D
e
e
t
t
e
e
c
c
t
t
O
O
b
b
s
s
t
t
a
a
c
c
l
l
e
e
D
D
i
i
s
s
t
t
a
a
n
n
c
c
e
e
This section describes how to detect the obstacle distance in front of the robot by using the
Ultrasonic module.
◼
◼
P
P
r
r
i
i
n
n
c
c
i
i
p
p
l
l
e
e
As shown in
Figure 1- 16
, the robot assembled HC-SR04 Ultrasonic module. Besides VCC and
GND pin, the module is controlled mainly by TRIG and ECHO signal.
The detection process is described as below:
⚫
To start detecting the distance, input High-level logic signal to the TRIG I/O for at least 10us.
⚫
The Module automatically sends eight 40 kHz and detect where there is pulse signal return.
⚫
The echo port will automatically output a high-level logic when detecting a rebound signal. The
duration of the high-level logic is the timing for the ultrasonic wave to be reflected back to the
module after the ultrasonic wave is emitted from the module.
Figure 1- 16 Ultrasonic module working diagram