SunFounder PiCar-4WD User manual

Preface
About SunFounder
SunFounder is a company focused on STEAM education with products like open source robots and smart
devices distributed globally. In SunFounder, we strive to help elementary and middle school students as
well as hobbyists, through STEAM education, strengthen their hands-on practices and problem-solving
abilities. In this way, we hope to disseminate knowledge and provide skill training in a full-of-joy way, thus
fostering your interest in programming and making, and exposing you to a fascinating world of science
and engineering. To embrace the future of artificial intelligence, it is urgent and meaningful to learn
abundant STEAM knowledge.
About This Kit
PiCar-4WD is a cost-effectively developmental smart car kit of Raspberry Pi, suitable for the Raspberry Pi 3
model B/B+ and 4 Model B. With the grayscale module, ultrasonic module, Photo-interrupter sensor
module, the car can realize obstacle avoidance, line following, object following, cliff detection, velocity
measurement, mileage calculation and so on.
Besides, the kits comes with operational examples of Web terminal, a rookie-friendly design. We also
provide the original python code for in-depth learning.

Quickly Support
Thanks for using the PiCar-4WD Smart Robot Car Kit for Raspberry Pi. You can contact us at the email
address below. Please don't hesitate to let us know if you need any support from us. We love helping our
customers to learn and play with our products.
If you have any TECHNICAL question, add a topic under FORUM section on our website and we'll
reply as soon as possible.
For NON-TECH questions like order and shipment issues, please send an email to
service@sunfounder.com. You're also welcomed to share your projects on FORUM.
Copyright Notice
All contents including but not limited to texts, images, and code in this manual are owned by the
SunFounder Company. You should only use it for personal study, investigation, enjoyment, or other
non-commercial or nonprofit purposes, under the related regulations and copyrights laws, without
infringing the legal rights of the author and relevant right holders. For any individual or organization that
uses these for commercial profit without permission, the Company reserves the right to take legal action.
V1.0.0 Mar. 2020

Warning
When you purchase or use this product, please note the following points:
This product contains many small parts. Swallowing or improper operation may cause serious
infections and death. Seek immediate medical attention once the accident happens.
Strictly prohibit use this product and its parts near any AC electrical outlet or other circuits in case of
the potential risk of electric shock.
Strictly prohibit use this product near any liquid or fire. Keep conductive materials away from this
product.
Do not allow children under 3 years old to use this product without adult supervision. Please place this
product in the position where children under 3 years old cannot reach.
Do not store or use this product in any extreme environments such as extreme hot or cold, high
humidity and etc.
Remember to break the circuit when it is not needed.
Some parts of this product may become warm to touch when used in certain circuit designs, which is
normal.
Using components not in accordance with the specification may cause damage to the product.

Contents
Component List......................................................................................................................................................................... 1
Structural Plates.................................................................................................................................................................1
Mechanical Parts............................................................................................................................................................... 2
Electronic Parts.................................................................................................................................................................. 3
Other Parts..........................................................................................................................................................................4
Driving Parts....................................................................................................................................................................... 6
Self- prepared Part............................................................................................................................................................6
Get Started with Raspberry Pi............................................................................................................................................... 7
If You Have A Screen........................................................................................................................................................8
Required Components.............................................................................................................................................8
Procedures.................................................................................................................................................................. 9
If You Have No Screen...................................................................................................................................................20
Required Components.......................................................................................................................................... 20
Burn System..............................................................................................................................................................20
Connect the Raspberry Pi to the Internet........................................................................................................22
Start SSH................................................................................................................................................................... 23
Power on the Raspberry Pi...................................................................................................................................23
Get the IP Address..................................................................................................................................................24
Use the SSH Remote Control.............................................................................................................................. 26
Download the Code............................................................................................................................................................... 30
Test the Modules.................................................................................................................................................................... 31

Initialize the Environment.............................................................................................................................................31
Module Testing................................................................................................................................................................33
Power Supply Detection............................................................................................................................................... 36
Reset Controller...............................................................................................................................................................36
Hardware Assembling........................................................................................................................................................... 37
Assembling Motor..........................................................................................................................................................37
Photo-interrupter Module + Encoding Disk........................................................................................................... 38
Assembling Grayscale Sensor Module......................................................................................................................39
Assembling Battery Holder..........................................................................................................................................40
Assembling Servo........................................................................................................................................................... 41
Assembling Nylon Standoffs....................................................................................................................................... 42
Assembling Top Plate and Bottom Plate..................................................................................................................43
Assembling Spoiler.........................................................................................................................................................44
Assembling Control Board........................................................................................................................................... 45
Connect Wires................................................................................................................................................................. 46
Assembling Radar Support.......................................................................................................................................... 47
Assembling Ultrasonic Sensor Module.....................................................................................................................48
Assembling Wheels(finished)...................................................................................................................................... 49
Web Control.............................................................................................................................................................................50
Boot Web Control...........................................................................................................................................................50
Setting Page..................................................................................................................................................................... 53
Python Program Control.......................................................................................................................................................60
Python Example Program.............................................................................................................................................60
Python Example Code Analysis...................................................................................................................................62

1
Component List
Structural Plates

2
Mechanical Parts

3
Electronic Parts

4
Other Parts

5

6
Driving Parts
Self- prepared Part
Note: After opening the package, please check whether the
quantity of components is compliance with product
description and whether all components are in good
condition.

7
Get Started with Raspberry Pi
Before you complete the assembly, you
need to test whether all the modules work
properly and keep the servo angle at 90
degrees. In this chapter, configure your
Raspberry Pi first.
For the Raspbian system, You are
recommend to install the version :
Raspbian Buster with desktop and
recommended software.
If you have installed the other two versions, you need to install the following softwares manually and then
skip this chapter.
sudo apt-get update
sudo apt-get install git-core
sudo apt-get install python3-pip
sudo pip3 install setuptools
If you are a beginner for Raspberry Pi, please follow this chapter to let your Raspberry Pi work.

8
Depending on the different devices you use, you can start up the Raspberry Pi in different methods. If you
have a separate screen for Raspberry Pi, follow the instructions in this chapter. Otherwise, please find the
corresponding steps in the following chapters.
If You Have A Screen
If you have a screen, you can use the NOOBS (New Out Of Box System) to install the Raspbian system.
Required Components
Any Raspberry Pi
1 * 2.5A Power Adapter
1 * Monitor
1 * Monitor Power Adapter
1 * HDMI cable
1 * Micro SD card
1 * Mouse
1 * Keyboard
1 * Personal Computer

9
Procedures
Step 1
To download NOOBS from your PC, you can choose NOOBS or NOOBS LITE - the only difference is that
there is a built-in offline Raspbian installer in NOOBS, while the NOOBS LITE can only be operated online.
Here, you are suggested to use the former. Here is the download address of Noobs:
https://www.raspberrypi.org/downloads/noobs/
Step 2
Plug in the Micro SD reader and format the Micro SD card with the SD Formatter
(https://www.sdcard.org/downloads/formatter/index.html). If there are some important files in the Micro
SD card, please backup them first.

10
Step 3
Next, you will need to extract the files from the NOOBS zip archive you downloaded from the Raspberry Pi
website.
Find the downloaded archive — by default, it should be in your Downloads folder.
Double-click on it to extract the files, and keep the resulting Explorer/Finder window open.
Finally select all the files in the NOOBS folder and copy them to the Micro SD card.
Step 4
All the files transferred, the Micro SD card pops up.

11
Step 5
Insert the Micro SD card into the Raspberry Pi. In addition, connect the screen, keyboard and mouse to it.
Finally switch on the 4WD-Hat board. Due to the long test time, you can also plug a 2.5A power adapter
into the Raspberry Pi.
Switch On/Off

12
Step 6
It will go to the NOOBS interface after starting up. If you use NOOBS LITE, you need to select Wi-Fi
networks (w) first. Tick the checkbox of the Raspbian and click Install in the top left corner. The NOOBS will
help to conduct the installation automatically. This process will take a few minutes.

13
Step 7
When the installation is done, the system will restart automatically and the desktop of the system will
appear.

14
Step 8
If you run Raspberry Pi for the first time, the application of “Welcome to Raspberry Pi” pops up and guides
you to perform the initial setup.

15
Step 9
Set country/region, language and time zone, and then click “next” again.
Table of contents
Other SunFounder Robotics manuals

SunFounder
SunFounder Pico-4wd car User manual

SunFounder
SunFounder PiDog User manual

SunFounder
SunFounder Rollarm User manual

SunFounder
SunFounder PiSloth User manual

SunFounder
SunFounder Sloth Learning Kit User manual

SunFounder
SunFounder PiCrawler Kit User manual

SunFounder
SunFounder Sloth:bit User manual

SunFounder
SunFounder Bionic Robot Lizard User manual

SunFounder
SunFounder RollbotMicro User manual

SunFounder
SunFounder PiDog User manual