I need code written in Python 3 for a car robot. Code needs to run without any errors. The function of the car robot is simple, to move forward and backwards.

1 answer below »
I need code written in Python 3 for a car robot. Code needs to run without any errors. The function of the car robot is simple, to move forward and backwards.
Answered 1 days AfterApr 28, 2021

Answer To: I need code written in Python 3 for a car robot. Code needs to run without any errors. The function...

Sandeep Kumar answered on Apr 29 2021
154 Votes
Tutorial.pdf
Welcome
Thank you for choosing Freenove products!
About Battery
First, read the document About_Battery.pdf in the unzipped folder.
If you did not download the zip file, please download it and unzip it via link below.
https://github.com/Freenove/Freenove_4WD_Smart_Car_Kit_for_Raspberry_Pi/archive/master.zip
Get Support and Offer Input
Freenove provides free and responsive product and technical support, including but not limited to:
 Product quality issues
 Product use and build issues
 Questions regarding the technology employed in our products for learning and education
 Your input and opinions are always welcome
 We also encourage your ideas and suggestions for new products and product improvements
For any of the above, you may send us an email to:
[email protected]

Safety and Precautions
Please follow the following safety precautions when using or storing this product:
 Keep this product out of the reach of children under 6 years old.
 This product should be used only when there is adult supervision present as young children lack necessary
judgment regarding safety and the consequences of product misuse.
 This product contains small parts and parts, which are sharp. This product contains electrically conductive
parts. Use caution with electrically conductive parts near or around power supplies, batteries and
powered (live) circuits.
 When the product is turned ON, activated or tested, some parts will move or rotate. To avoid injuries to
hands and fingers, keep them away from any moving parts!
 It is possible that an improperly connected or shorted circuit may cause overheating. Should this happen,
immediately disconnect the power supply or remove the batteries and do not touch anything until it
cools down! When everything is safe and cool, review the product tutorial to identify the cause.
 Only operate the product in accordance with the instructions and guidelines of this tutorial, otherwise
parts may be damaged or you could be injured.
 Store the product in a cool dry place and avoid exposing the product to direct sunlight.
 After use, always turn the power OFF and remove or unplug the batteries before storing.
https://github.com/Freenove/Freenove_4WD_Smart_Car_Kit_for_Raspberry_Pi/archive/master.zip
mailto:[email protected]
Need support?  support.freenove.com

About Freenove
Freenove provides open source electronic products and services worldwide.
Freenove is committed to assist customers in their education of robotics, programming and electronic circuits
so that they may transform their creative ideas into prototypes and new and innovative products. To this end,
our services include but are not limited to:
 Educational and Entertaining Project Kits for Robots, Smart Cars and Drones
 Educational Kits to Learn Robotic Software Systems for Arduino, Raspberry Pi and micro: bit
 Electronic Component Assortments, Electronic Modules and Specialized Tools
 Product Development and Customization Services
You can find more about Freenove and get our latest news and updates through our website:
http://www.freenove.com
Copyright
All the files, materials and instructional guides provided are released under Creative Commons Attribution-
NonCommercial-ShareAlike 3.0 Unported License. A copy of this license can be found in the folder containing
the Tutorial and software files associated with this product.
This means you can use these resource in your own derived works,
in part or completely, but NOT for the
intent or purpose of commercial use.
Freenove brand and logo are copyright of Freenove Creative Technology Co., Ltd. and cannot be used without
written permission.
Free your innovation
Raspberry Pi® is a trademark of Raspberry Pi Foundation (https://www.raspberrypi.org/).
○R
http://www.freenove.com/
http://creativecommons.org/licenses/by-nc-sa/3.0/
http://creativecommons.org/licenses/by-nc-sa/3.0/
https://www.raspberrypi.org/
Need support?  support.freenove.com
Contents
Welcome ................................................................................................................................................................................ 1
Contents................................................................................................................................................................................. 1
List ........................................................................................................................................................................................... 1
4WD Smart Car Board for Raspberry Pi .................................................................................................................. 1
Machinery Parts ........................................................................................................................................................... 2
Transmission Parts ....................................................................................................................................................... 3
Acrylic Parts .................................................................................................................................................................. 3
Electronic Parts ............................................................................................................................................................. 4
Tools ............................................................................................................................................................................... 4
Self-prepared Parts ..................................................................................................................................................... 5
Preface ................................................................................................................................................................................... 6
Raspberry Pi Introduction .......................................................................................................................................... 7
Chapter 0 Raspberry Pi Preparation ............................................................................................................................... 17
Install a System........................................................................................................................................................... 17
Remote desktop & VNC ............................................................................................................................................ 24
Chapter 1 Software installation and Test (necessary).................................................................................................. 39
Step 1 Obtain the Code............................................................................................................................................ 39
Step 2 Configure I2C and VNC ............................................................................................................................... 42
Step 3 Run the Libraries Installation Program ........................................................................................................ 45
Chapter 2 Assemble Smart Car ....................................................................................................................................... 46
Chapter 3 Module test (necessary) ................................................................................................................................ 59
Chapter 4 Light tracing Car .............................................................................................................................................. 83
Description .................................................................................................................................................................. 83
Run program .............................................................................................................................................................. 83
Chapter 5 Ultrasonic Obstacle Avoidance Car ............................................................................................................. 85
Description .................................................................................................................................................................. 85
Run program .............................................................................................................................................................. 85
Chapter 6 Infrared Line Tracking Car ............................................................................................................................. 87
Description .................................................................................................................................................................. 87
Run program .............................................................................................................................................................. 87
Chapter 7 Smart video car ............................................................................................................................................... 89
Server ........................................................................................................................................................................... 90
Client ............................................................................................................................................................................ 96
Android and iOS app .............................................................................................................................................. 117
Free innovation ........................................................................................................................................................ 119
What's next? ...................................................................................................................................................................... 126
Need support?  support.freenove.com
1 List █ www.freenove.com
List
If you have any concerns, please feel free to contact us via [email protected]
4WD Smart Car Board for Raspberry Pi
mailto:[email protected]

Need support?  support.freenove.com

2 List www.freenove.com █
Machinery Parts
Note: You may receive M1.4*4 or M1.4*5. Can be used normally
Need support?  support.freenove.com
3 List █ www.freenove.com
Transmission Parts
Servo package x2
Driven wheel x4
DC speed reduction motor x4
Motor bracket package x4
Acrylic Parts
For Pan Tilt
Need support?  support.freenove.com

4 List www.freenove.com █
Electronic Parts
Line tracking module x1
Camera x1


HC-SR04 Ultrasonic
Module x1

Connection board
Jumper Wire F/F(4) x1

XH-2.54-5Pin cable x1
Tools
Cross screwdriver (3mm) x1 Black tape x1
Cable Tidy x25cm
Need support?  support.freenove.com
5 List █ www.freenove.com
Self-prepared Parts
2X 3.7V 18650 lithium rechargeable batteries with continuous discharge current >3a.
It is easier to find proper battery on eBay than Amazon. Search “18650 high drain” on eBay.
Raspberry Pi (Recommended model: Raspberry 4B / 3B+ / 3B) x1
Need support?  support.freenove.com

6 Preface www.freenove.com █
Preface
Welcome to use Freenove 4WD Smart Car Kit for Raspberry Pi. Following this tutorial, you can make a very
cool smart car with many functions.
This kit is based on Pi Raspberry, a popular control panel, so you can share and exchange your experience
and design ideas with many enthusiasts all over the world. The parts in this kit include all electronic
components, modules, and mechanical components required for making the smart car. And all of them are
packaged individually. There are detailed assembly and commissioning instructions in this book.
And if you encounter any problems, please feel free to contact us for fast and free technical support.
[email protected]
The contents in this book can help enthusiasts with little technical knowledge to make a smart car. If you are
very interested in Raspberry Pi, and want to learn how to program and build the circuit, please visit our
website www.freenove.com or contact us to buy the kits designed for beginners:
Freenove Basic\LCD1602\Super\Ultrasonic\RFID\Ultimate Starter Kit for Raspberry Pi
http://www.freenove.com/

Need support?  support.freenove.com
7 Preface █ www.freenove.com
Raspberry Pi Introduction
Raspberry Pi (called RPi, RPI, RasPi, the text these words will be used alternately later), a micro-computer with
size of a card, quickly swept the world since its debut. It is widely used in desktop workstation, media center,
smart home, robots, and even the servers, etc. It can do almost anything, which continues to attract fans to
explore it. Raspberry Pi used to be running with Linux system and along with the release of windows 10 IoT.
We can also run it with Windows. Raspberry Pi (with interfaces USB, network, HDMI, camera, audio, display
and GPIO), as a microcomputer, can be running in command line mode and desktop system mode.
Additionally, it is easy to operate just like Arduino, and you can even directly operate the GPIO of CPU.
So far, Raspberry Pi has developed to the fourth generation. Changes in versions are accompanied by increase
and upgrades in hardware. A type and B type, the first generation of products, have been stopped due to
various reasons. Other versions are popular and active and the most important is that they are consistent in
the order and number of pins, which makes the compatibility of peripheral devices greatly enhanced between
different versions.
Below are the raspberry pi pictures and model pictures supported by this product.
Practicality picture of Raspberry Pi 4 Model B:
Model diagram of Raspberry Pi 4 Model B:

Need support?  support.freenove.com

8 Preface www.freenove.com █
Practicality picture of Raspberry Pi 3 Model B+:
Model diagram of Raspberry Pi 3 Model B+:
Practicality picture of Raspberry Pi 3 Model B:
Model diagram of Raspberry Pi 3 Model B:

Need support?  support.freenove.com
9 Preface █ www.freenove.com
Practicality picture of Raspberry Pi 2 Model B:
Model diagram of Raspberry Pi 2 Model B:

Practicality picture of Raspberry Pi 1 Model B+:
Model diagram of Raspberry Pi 1 Model B+:

Need support?  support.freenove.com

10 Preface www.freenove.com █
Practicality picture of Raspberry Pi 3 Model A+:
Model diagram of Raspberry Pi 3 Model A+:
Practicality picture of Raspberry Pi 1 Model A+:
Model diagram of Raspberry Pi 1 Model A+:
Need support?  support.freenove.com
11 Preface █ www.freenove.com
Practicality picture of Raspberry Pi Zero W:
Model diagram of Raspberry Pi Zero W:
Practicality picture of Raspberry Pi Zero:
Model diagram of Raspberry Pi Zero:
Need support?  support.freenove.com

12 Preface www.freenove.com █
Hardware interface diagram of RPi 4B is shown below:
Hardware interface diagram of RPi 3B+/3B/2B/1B+ are shown below:

GPIO
Connector
Display
Connector
Power
Connector
HDMI
Connector
Camera
Connector
Ethernet
Connector
GPIO
Connector
Display
Connector
Power
Connector
MINI HDMI
Connector x2
Camera
Connector
Ethernet
Connector
USB
Connector x4
Audio
Connector
USB
Connector
Audio
Connector
Need support?  support.freenove.com
13 Preface █ www.freenove.com
Hardware interface diagram of RPi 3A+/A+ is shown below:
Hardware interface diagram of RPi Zero/Zero W is shown below:
GPIO
Connector
Power
Connector
HDMI
Connector
Camera
Connector
USB
Connector
GPIO
Connector
Display
Connector
Power
Connector
HDMI
Connector
Camera
Connector
Audio
Connector
USB
Connector
Need support?  support.freenove.com

14 Preface www.freenove.com █
GPIO
GPIO: General purpose input/output. We will introduce the specific feature of the pins on the Raspberry Pi
and what you can do with them. You can use them for all sorts of purposes. Most of them can be used as
either inputs or outputs, depending on your program.
When programming the GPIO pins there are 3 different ways to refer to them: GPIO numbering, physical
numbering, WiringPi GPIO Numbering.
BCM GPIO Numbering
Raspberry Pi CPU use BCM2835/BCM2836/BCM2837of Broadcom. GPIO pin number is set by chip
manufacturer. These are the GPIO pins as that computer recognizes. The numbers are unordered and don't
make any sense to humans. You will need a printed reference or a reference board that fits over the pins.
Each pin is defined as below:
For more details about pin definition of GPIO, please refer to http://pinout.xyz/
http://pinout.xyz/

Need support?  support.freenove.com
15 Preface █ www.freenove.com
PHYSICAL Numbering
Another way to refer to the pins is by simply counting across and down from pin 1 at the top left (nearest to
the SD card). This is 'physical numbering', as shown below:
WiringPi GPIO Numbering
Different from the previous mentioned two kinds of GPIO serial numbers, RPi GPIO serial number of the
WiringPi was renumbered. Here we have three kinds of GPIO number mode: based on the number of BCM
chip, based on the physical sequence number and based on wiringPi. The correspondence between these
three GPIO numbers is shown below:

(For more details, please refer to https://projects.drogon.net/raspberry-pi/wiringpi/pins/ )
https://projects.drogon.net/raspberry-pi/wiringpi/pins/

Need support?  support.freenove.com

16 Preface www.freenove.com █
You can also use the following command to view their correspondence.
gpio readall
For more details about wiringPi, please refer to http://wiringpi.com/ .
http://wiringpi.com/

Need support?  support.freenove.com
17 Chapter 0 Raspberry Pi Preparation █ www.freenove.com
Chapter 0 Raspberry Pi Preparation
Install a System
Firstly, install a system for your RPi.
Component List
Required Components
Raspberry Pi 4B / 3B+/ 3B /3A+ (Recommended)
5V/3A Power Adapter. Different versions of
Raspberry Pi have different power requirements.
Micro USB Cable x1
Micro SD Card (TF Card) x1, Card Reader x1
This robot also supports the following versions of the Raspberry Pi, but additional accessories need to be
prepared by yourself.
Raspberry Additional accessories
Raspberry Pi Zero W Camera cable(>25cm) for zero w, 15 Pin 1.0mm Pitch to 22 Pin 0.5mm
https://www.amazon.com/dp/B076Q595HJ/
Raspberry Pi Zero 1.3 wireless network adapter,
Camera cable(>25cm) for zero w, 15 Pin 1.0mm Pitch to 22 Pin 0.5mm,
OTG cable (USB Type micro B to USB Type A)
Raspberry Pi 2 Model B wireless network adapter
Raspberry Pi 1 Model A+ wireless network adapter
Raspberry Pi 1 Model B+ wireless network adapter
https://www.amazon.com/dp/B076Q595HJ/

Need support?  support.freenove.com

18 Chapter 0 Raspberry Pi Preparation www.freenove.com █
Power requirement of different versions of Raspberry Pi is shown in following table:
Product Recommended
PSU current
capacity
Maximum total USB
peripheral current draw
Typical bare-board
active current
consumption
Raspberry Pi Model A 700mA 500mA 200mA
Raspberry Pi Model B 1.2A 500mA 500mA
Raspberry Pi Model A+ 700mA 500mA 180mA
Raspberry Pi Model B+ 1.8A 600mA/1.2A (switchable) 330mA
Raspberry Pi 2 Model B 1.8A 600mA/1.2A (switchable) 350mA
Raspberry Pi 3 Model B 2.5A 1.2A 400mA
Raspberry Pi 3 Model A+ 2.5A Limited by PSU, board, and
connector ratings only.
350mA
Raspberry Pi 3 Model B+ 2.5A 1.2A 500mA
Raspberry Pi 4 Model B 3.0A 1.2A 600mA
Raspberry Pi Zero W 1.2A Limited by PSU, board, and
connector ratings only.
150mA
Raspberry Pi Zero 1.2A Limited by PSU, board, and
connector ratings only
100mA
For more details, please refer to https://www.raspberrypi.org/help/faqs/#powerReqs
In addition, RPi also needs a network cable used to connect it to wide area network.
All of these components are necessary. Among them, the power supply is required at least 5V/2.5A, because
lack of power supply will lead to many abnormal problems, even damage to your RPi. So power supply with
5V/2.5A is highly recommend. SD Card Micro (recommended capacity 16GB or more) is a hard drive for RPi,
which is used to store the system and personal files. In later projects, the components list with a RPi will
contains these required components, using only RPi as a representative rather than presenting details.
https://www.raspberrypi.org/help/faqs/#powerReqs

Need support?  support.freenove.com
19 Chapter 0 Raspberry Pi Preparation █ www.freenove.com
Optional Components
Under normal circumstances, there are two ways to login to Raspberry Pi: using independent monitor, or
remote desktop to share a monitor with your PC.
Required Accessories for Monitor
If you want to use independent monitor, mouse and keyboard, you also need the following accessories.
1.Display with HDMI interface
2.Mouse and Keyboard with USB interface
As to Pi Zero and Pi Zero W, you also need the following accessories.
1. Micro-HDMI to HDMI converter wire.
2. Micro-USB to USB-A Receptacles converter wire (Micro USB OTG wire).
3. USB HUB.
4. USB transferring to Ethernet interface or USB Wi-Fi receiver.
For different Raspberry Pi, the optional items are slightly different. But all of their aims are to convert the
special interface to standard interface of standard Raspberry Pi.
Item Pi Zero Pi Zero W Pi A+ Pi 3A+ Pi B+/2B Pi 3B/3B+/4B
Monitor Yes Yes Yes Yes Yes Yes
Mouse Yes Yes Yes Yes Yes Yes
Keyboard Yes Yes Yes Yes Yes Yes
Micro-HDMI to
HDMI cable
Yes Yes No No No No
Micro-USB to USB-A
OTG cable
Yes Yes No No No No
USB HUB Yes Yes Yes Yes No No
USB transferring to
Ethernet interface
select
one from
two or
select
two from
two
optional select
one from
two or
select two
from two
optional Internal
Integration
Internal
Integration
USB Wi-Fi receiver
Internal
Integration
Internal
Integration
optional
Required Accessories for Remote Desktop
If you don't have an independent monitor, or you want to use a remote desktop, first you need to login to
Raspberry Pi through SSH, then open the VNC or RDP service. So you need the following accessories.
Item Pi Zero Pi Zero W Pi A+ Pi 3A+ Pi B+/2B Pi 3B/3B+/4B
Micro-USB to USB-A
OTG cable
Yes Yes No
NO
USB transferring to
Ethernet interface
Yes Yes Yes
Need support?  support.freenove.com

20 Chapter 0 Raspberry Pi Preparation www.freenove.com █
Raspberry Pi OS
Official Method
It is recommended to use this method.
You can follow the official method to install the system for raspberry pi
https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/2
In this way, the system will be download automatically via the application.
Download system manually (optional)
After installing the Imager Tool in link above. You can also download the system manually first.
Visit RPi official website (https://www.RaspberryPi.org/), click “Downloads” and choose to download
“Raspberry Pi OS”. Raspberry Pi OS supported by RPI is an operating system based on Linux, which contains
a number of contents required for RPi. We recommended Raspberry Pi OS to beginners. All projects in this
tutorial are operated under the Raspberry Pi OS.
https://www.raspberrypi.org/downloads
https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/2
https://www.raspberrypi.org/
https://www.raspberrypi.org/downloads/raspbian/

Need support?  support.freenove.com
21 Chapter 0 Raspberry Pi Preparation █ www.freenove.com
After the zip file is download.
Write System to Micro SD Card
First, put your Micro SD card into card reader and connect it to USB port of PC. Then open imager toll, choose
Choose system that you just download in Use custom.
Need support?  support.freenove.com

22 Chapter 0 Raspberry Pi Preparation www.freenove.com █
Choose the SD card. Then click “WRITE”.
Need support?  support.freenove.com
23 Chapter 0 Raspberry Pi Preparation █ www.freenove.com
Start Raspberry Pi
If you don’t have a spare monitor, please skip to next section. If you have a spare monitor, please follow
steps in this section.
After the system is written successfully, take out Micro SD Card and put it into the card slot of RPi. Then
connect RPi to screen through the HDMI, to mouse and keyboard through the USB port, to network cable
through the network card interface and to the power supply. Then your RPi starts initially. Later, you need to
enter the user name and password to login. The default user name: pi; password: raspberry. Enter and login.
After login, you can enter the following interface.
Now, you have successfully installed the Raspberry Pi OS for your RPi.
Then you can connect WiFi on the right corner.
Now you can skip to VNC Viewer.
Need support?  support.freenove.com

24 Chapter 0 Raspberry Pi Preparation www.freenove.com █
Remote desktop & VNC
After you log in Raspberry Pi, please use VNC Viewer to connect Raspberry Pi for this robot. Other
remote ways may not support GUI.
If you have logged in Raspberry Pi please skip to VNC Viewer.
If you don't have a spare display, mouse and keyboard for your RPi, you can use a remote desktop to share
a display, keyboard, and mouse with your PC. Below is how to use remote desktop under the Windows and
mac OS.
Enable SSH
If you don’t have a separate monitor, after the system is written successfully, create a folder named “ssh”
under generated boot disk of Micro SD Card.
Configure WiFi
Create a file named wpa_supplicant.conf in boot.
Open it with notepad. Add WiFi information. Input following content and save.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=CN
network={
ssid="your WiFi name"
psk="WiFi password"
key_mgmt=WPA-PSK
}
}
Need support?  support.freenove.com
25 Chapter 0 Raspberry Pi Preparation █ www.freenove.com
Insert SD card
Then remove SD card from card reader and insert it into Raspberry Pi.
Need support?  support.freenove.com

26 Chapter 0 Raspberry Pi Preparation www.freenove.com █
Windows OS Remote Desktop
The windows built-in application remote desktop corresponds to the Raspberry Pi xrdp service.
Download the tool software Putty. Its official address: http://www.putty.org/
Or download it here: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Then use net cable to connect your RPi to the routers and ensure your PC and your RPi are in the same LAN.
Then put the system Micro SD Card prepared before into the slot of the RPi and turn on the power supply
waiting for starting RPi. Later, enter router client to inquiry IP address named “raspberry pi”. For example, I
have inquired to my RPi IP address, and it is “192.168.1.108". Then open Putty, enter the address, select SSH,
and then click "OPEN", as shown below:


There will appear a security warning at first login. Just click “YES”.
Step1: enter
the IP address
Step2:
Select SSH
Step3:
Click “OPEN”
http://www.putty.org/
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Need support?  support.freenove.com
27 Chapter 0 Raspberry Pi Preparation █ www.freenove.com
Need support?  support.freenove.com

28 Chapter 0 Raspberry Pi Preparation www.freenove.com █
Then there will be a login interface (RPi default user name: pi; the password: raspberry). When you enter the
password, there will be no display on the screen. This is normal. After the correct input, press “Enter” to
confirm.
Then enter the command line of RPi, which means that you have successfully login to RPi command line
mode.
Need support?  support.freenove.com
29 Chapter 0 Raspberry Pi Preparation █ www.freenove.com
If you want to use built-in Remote Desktop Connection under Windows, you need install xrdp service on
Raspberry Pi.
Next, install a xrdp service, an open source remote desktop protocol(xrdp) server, for RPi. Type the following
command, then press enter to confirm:
sudo apt-get install xrdp
Later, the installation starts.
Need support?  support.freenove.com

30 Chapter 0 Raspberry Pi Preparation www.freenove.com █
Enter "Y", press key “Enter” to confirm.
After the installation is completed, you can use Windows remote desktop applications to login to your RPi.
Need support?  support.freenove.com
31 Chapter 0 Raspberry Pi Preparation █ www.freenove.com
Login to Windows remote desktop
Use "WIN+R" or search function, open the remote desktop application "mstsc.exe" under Windows, enter the
IP address of RPi and then click “Connect”.
Later, there will be xrdp login screen. Enter the user name and password of RPi (RPi default user name: pi;
password: raspberry) and click “OK”.

Need support?  support.freenove.com

32 Chapter 0 Raspberry Pi Preparation www.freenove.com █
Later, you can enter the RPi desktop system.
Here, you have successfully used the remote desktop login to RPi.
Raspberry Pi 4B/3B+/3B integrates a Wi-Fi adaptor. You can use it to connect to your Wi-Fi. Then you can
use the wireless remote desktop to control your RPi. This will be helpful for the following work. Raspberry Pi
of other models can use wireless remote desktop through accessing an external USB wireless card.

Need support?  support.freenove.com
33 Chapter 0 Raspberry Pi Preparation █ www.freenove.com
MAC OS Remote Desktop
Connect your pi to the the router via a network cable.
Open the terminal and type following command.
ssh [email protected]
The password is raspberry by default, case sensitive.
You may need to type yes during the process.
When you see pi@raspberrypi:~ $, you have logged in Pi successfully. Then you can skip to next section.
You can also use the IP to log in Pi.
Enter router client to inquiry IP address named “raspberry pi”. For example, I have inquired to my RPi IP
address, and it is “192.168.1.131".
Open the terminal and type following command.
ssh [email protected]
Need support?  support.freenove.com

34 Chapter 0 Raspberry Pi Preparation www.freenove.com █
Need support?  support.freenove.com
35 Chapter 0 Raspberry Pi Preparation █ www.freenove.com
VNC Viewer & VNC
Type the following command. And select 5 Interfacing OptionsP3 VNC YesOKFinish. Here Raspberry
Pi may need be restarted, and choose ok. Then open VNC interface.
sudo raspi-config
Need support?  support.freenove.com

36 Chapter 0 Raspberry Pi Preparation www.freenove.com █
Then download and install VNC Viewer according to your computer system by click following link:
https://www.realvnc.com/en/connect/download/viewer/
After installation is completed, open VNC Viewer. And click File  New Connection. Then the interface is
shown below.
Enter ip address of your Raspberry Pi and fill in a Name. And click OK.
Then on the VNC Viewer panel, double-click new connection you just created, and the following dialog box
pops up.
Enter username: pi and Password: raspberry. And click OK.
https://www.realvnc.com/en/connect/download/viewer/

Need support?  support.freenove.com
37 Chapter 0 Raspberry Pi Preparation █ www.freenove.com
Here, you have logged in to Raspberry Pi successfully by using VNC Viewer
If the resolution ratio is not great or there is just a little window, you can set a proper resolution ratio via
steps below.
sudo raspi-config
Select 7 Advanced OptionsA5 Resolutionproper resolution ratio (set by yourself)OKFinish. And then
reboot Raspberry Pi.


In addition, your VNC Viewer window may zoom your Raspberry Pi desktop. You can change it. On your
VNC View control panel, click right key. And select Properties->Options label->Scaling. Then set proper
scaling.
Need support?  support.freenove.com

38 Chapter 0 Raspberry Pi Preparation www.freenove.com █
Here, you have logged in to Raspberry Pi successfully by using VNC Viewer and operated proper setting.
Raspberry Pi 4B/3B+/3B integrates a Wi-Fi adaptor.If you did not connect Pi to WiFi. You can connect it to
wirelessly control the robot.

Need support?  support.freenove.com
39 Chapter 1 Software installation and Test (necessary) █ www.freenove.com
Chapter 1 Software installation and Test (necessary)
If you have any concerns, please feel free to contact us via [email protected]
In this chapter, we will make some necessary preparation: start your Pi Raspberry and install some necessary
libraries. Then test some parts. Batteries are needed when driving peripherals such as motors, servos, LEDs,
etc.
Note:
1, Please use Raspberry Pi OS with Desktop
2, The installation of libraries takes much time. You can power Raspberry Pi with a power supply Cable.
3, If you are using remote desktop to login Raspberry Pi, you need to use VNC viewer.
You can refer to this video.
https://youtu.be/3a2OFKBMM-4
Step 1 Obtain the Code
To download the code, you can power Raspberry Pi with a power supply cable or switch on S1 (Power Switch).
Then open the Raspberry Pi and the terminal. You can open the terminal by clicking as shown below, or you
can press “CTRL + ALT + T” on the desktop.
The terminal is shown below:
Open the terminal and type the following commands to obtain the car code. And the code will be placed in
the directory "Pi". (Note: Here are two commands. Please execute them in order.)
cd ~
git clone https://github.com/Freenove/Freenove_4WD_Smart_Car_Kit_for_Raspberry_Pi.git
Terminal Terminal
mailto:[email protected]
https://youtu.be/3a2OFKBMM-4
https://github.com/Freenove/Freenove_4WD_Smart_Car_Kit_for_Raspberry_Pi.git

Need support?  support.freenove.com

40 Chapter 1 Software installation and Test (necessary) www.freenove.com █
Downloading takes some time. Please wait with patience.
You can also find and download the code by visiting our official website (http://www.freenove.com) or our
GitHub repository (https://github.com/freenove).
Please note that this tutorial is based on python3. If you want to use python2, please download another
version of the tutorial.
Set Python3 as default python (Necessary)
First, execute python to check the default python on your raspberry Pi. Press Ctrl-Z to exit.

If it is python3, you can skip this section.
If it is python2, you need execute the following commands to set default python to python3.
1. Enter directory /usr/bin
cd /usr/bin
2. Delete the originalpython link.
sudo rm python
3. Create new python links to python.
sudo ln -s python3 python
4. Check python. Press Ctrl-Z to exit.
python
If you want to set python2 as default python in other projects, just repeat the commands above and change
python3 to...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here