User Manual

30
Step 2. Wiring
Connect the ultrasonic obstacle avoidance to Robot HATS with a 3-pin anti-reverse cable as
shown below.
Ultrasonic Obstacle Avoidance
Robot HATS
SIG
D0
5V
3.3V
GND
GND
Test for Ultrasonic Obstacle Avoidance
First, test the ultrasonic obstacle avoidance module before applying.
Get into the directory example:
cd ~/SunFounder_PiCar-S/example/
Run the test code:
python test_ultrasonic_module.py
pi@raspberrypi:~ $ cd ~/SunFounder_PiCar-S/example/
pi@raspberrypi:~/SunFounder_PiCar-S/example $ python test_ultrasonic_module.py
distance 32 cm Over 17
distance 32 cm Over 17
distance 29 cm Over 17
distance 29 cm Over 17
Read distance error
distance 21 cm Over 17
distance 21 cm Over 17
distance 18 cm Over 17
distance 18 cm Over 17
distance 16 cm less than 17
distance 15 cm less than 17