Lesson 3 Installing and Configuring Raspberry Pi System
Lesson 3 Installing and Configuring Raspberry Pi System
Lesson 3 Installing and Configuring Raspberry Pi System
In this lesson, we will learn how to install and remotely log in to the Raspberry Pi OS under
Windows. And we will download the code program to control the robot.
3.1 Preparation
⚫ When studying this lesson, you need to prepare the following components first:
One SD card that has been formatted (we recommend using an SD card with memory
above 16G), 1 card reader, Raspberry Pi development board.
⚫ You need to insert the SD card into the card reader first, and then connect the card reader
to the computer.
https://www.raspberrypi.com/software/
Support email:
2
Support email:
3
Support email:
4
Method 1
Raspberry Pi officially provides a Raspberry Pi OS - Raspberry Pi OS (Legacy) for educational
and industrial users. The operating system has stable compatibility, and there will be no
incompatibility with specific dependencies due to the update of the Raspberry Pi system. It also
avoids frequent revision of the tutorial.
Raspberry Pi official description of the Raspberry Pi OS (Legacy):
https://www.raspberrypi.com/news/new-old-functionality-with-raspberry-pi-os-legacy/
Support email:
5
2. Select the Raspberry Pi OS (Legacy) with desktop version, which contains a complete
desktop system and recommended software packages.
3. Click "Download", download the ".ZIP" file(or compressed files in other formats), and wait
for the download to complete: (remember where the file is saved).
4. Find the ".ZIP" file you just downloaded, and extract it. The uncompressed file format of the
file is ".img". Pay attention, you must name the path of the uncompressed .img file all English
letters without special characters.
Support email:
6
Method 2
Due to compatibility issues with the latest Raspberry Pi official image file and the camera.
It may cause an error when the Raspberry Pi runs the program. We recommend downloading
the official older version of the Raspberry Pi image.(This image file will not change and has
been tested in detail and successfully).
Using this image is a good idea to try if you run into problems with dependent libraries in the
following lessons.
After the download is successful, extract the ZIP file and get a ".img" file.
Method 3
The image downloaded according to the method 1 is the official version of Raspbian and comes
with some pre-installed software. At the same time, the normal operation of the robot product
requires many other dependent libraries, although we provide a script to install these simple
methods of relying on libraries (will be introduced in detail later), occasionally encountering
dependent library updates may cause the installation of dependent libraries to fail, so we
provide a Raspbian mirror file pre-installed with dependent libraries. The disadvantage of this
method is that the mirror files and related dependent libraries we provide cannot be kept
updated at any time. Only when you encounter a very difficult problem, you can try this method
Support email:
7
The content of the PDF "xxx image file" on the page is the download address of the image
file. After the download is complete, decompress it. The path of the decompressed” .img” file
must be all English letters and no special characters.
2. Click "Use custom" and select a custom ".img" file from your computer, which is the
".img" file of the Raspberry Pi OS that we downloaded and decompressed before.
Support email:
8
3. Find the ".img" file of the Raspberry Pi OS that we downloaded and decompressed
before. Click "Open".
Support email:
9
5. Then on the interface of Raspberry Pi Imager, the ".img" file of our selected Raspberry Pi
OS will appear.
Support email:
10
8. Click "WRITE" to write it to the SD card. Wait for the burn to complete.
Support email:
11
9. After the burning is completed, the following message will be prompted,indicating that
the burning is finished, click "CONTINUE".
Support email:
12
【Pay Attention】
Don't remove the SD card after burning! After the Raspberry Pi Imager is burned, the
memory card will be ejected in the program. This will cause the subsequent copy operation to
prompt that the SD card has not been found. You can unplug the card reader from the
computer and then plug it into the computer again.It is necessary to configure SSH and WIFI
connection later. At this time, once the SD card is put into the Raspberry Pi to boot, it may
cause subsequent headless WIFI configuration failure.
SSH is a protocol designed to provide security for remote login sessions and other network
services. Through the SSH service, you can remotely use the command line of the Raspberry Pi
on another machine. In the subsequent operations and the process of using the Raspberry Pi,
you can control the Raspberry Pi through another machine in the same local area network
without connecting the mouse, keyboard and monitor to the Raspberry Pi. After 2016,
Raspbian distributions disable the SSH service by default, so we need to manually enable it.
The following steps are operated under Windows OS, other OS are similar. If the operation
is unsuccessful, please see the second half of 3.5.
1. We first enter the driver D of the computer, click "View" in the upper left corner, and
select "File Extension", as shown below:
2. Right-click on the blank space of the D drive, select "New", and select "Text Document".
Support email:
13
4. Then delete the suffix ".txt". We will get an ssh file without any extension. As shown
below:
5. Copy this ssh file to the root directory of the SD card of the Raspberry Pi OS. When the
Raspberry Pi starts, it will automatically find this ssh file. If it is found, it will start SSH. This
method only needs to be used once. After that, every time you start the Raspberry Pi, it will
automatically start SSH without repeating the above operations. Copy the ssh file to the
Raspberry Pi as shown below:
Support email:
14
Next, we also need to set up a WIFI wireless connection for the Raspberry Pi.
1. Create a new file named wpa_supplicant.conf in the root directory of the D driver of the
computer.
2. Click to select the wpa_supplicant.conf file, right-click the mouse, and select "Open Mode
(H)".
Support email:
15
Support email:
16
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="WIFI"
psk="PASSWORD"
key_mgmt=WPA-PSK
priority=1
"Country" is your country code, do not modify it, the default is US; "ssid" needs to be
changed to the name of the WIFI you want to connect; "psk" needs to be changed to the
password of the WIFI you want to connect; other parts do not need to do any modifications.
For example, our company's WIFI name is Adeept, WIFI password is 123456, and the
modified wpa_supplicant.conf file is as shown below:
Support email:
17
5. Save the set wpa_supplicant.conf file, and then copy it to the root directory of the SD
card of the Raspberry Pi OS. As shown below:
6. Now we can take out the SD card and put it into the "MICRO SD CARD" card slot on the
Raspberry Pi development board, and use the Type-C data cable to supply power to the
Raspberry Pi. And then the Raspberry Pi will start up and run.
Support email:
18
Note: If the above steps are not successful in configuring SSH and WiFi, please try another way
to configure SSH and WiFi: (If you cannot complete the above steps using a Mac OS, you can use
this method)
1. Connect the Raspberry Pi to the display through the mouse, keyboard, and HDMI cable.
2. Click the WiFi icon in the upper right corner of the desktop (the WiFi icon in the picture is
the connected WiFi status), then select the WiFi name and enter the password.
3. Select "Preferences" from the drop-down list in the main menu of the Raspberry Pi desktop,
and then select "Raspberry Pi Configuration".
Support email:
19
4. Select "Interfaces", set the SSH and I2C options to "Enabled", and then click "OK".
Support email:
20
Before using SSH to connect to Raspberry Pi, you need to know the IP address of the
Raspberry Pi and the software that supports SSH.
The remote login to the Raspberry Pi is achieved through the SSH protocol, and the
Raspberry Pi can be remotely logged in through the software with the SSH protocol. For
example: Putty, MobaXterm, etc. It is recommended that MAC users install Putty windows and
install MobaXterm.
Linux or Mac OS comes with SSH function, and you can also log in to the Raspberry Pi
remotely through the terminal.
Method 1
Obtaining an IP address with an external display
We provide a simple and fast way to get the Raspberry Pi IP address. You need to prepare
the following components:
⚫ One Type-C data cable: used to supply power to the Raspberry Pi.
⚫ One monitor
⚫ One Raspberry Pi
Support email:
21
Support email:
22
2. Turn on the monitor switch, and connect the mouse to the USB port of the Raspberry Pi,
supply power to the Raspberry Pi with the Type-C data cable, then the Raspberry Pi starts.
After entering the system interface, we move the mouse cursor to the "
" in the upper right corner, then it will display the IP address of the
Raspberry Pi: 192.168.3.157 (the IP address of each Raspberry Pi is different). It is necessary
for you to record this IP address for it is needed to log in to the Raspberry Pi OS later.
Support email:
23
3. You can also check the following IP address by opening the command window of the
Raspberry Pi and entering the following command, you need to write it down:
hostname -I
Method 2
1. You need to download an APP called "Fing" on your phone, as shown below:
2. After the download is complete, your phone and Raspberry Pi need to be in the same
local area network, that is, your phone and Raspberry Pi are connected to the same WIFI, then
open "Fing" and click "Scan for devices":
Support email:
24
Support email:
25
4. Click “OK”:
5. Wait for the scan to complete. In the list, you find a device named "Raspberry Pi". In the
lower left corner, you will see the IP address of the Raspberry Pi: 192.168.3.157. You need to
write down this IP address.
Support email:
26
Putty
You need to download and install PuTTY corresponding to your computer OS version, and
use it to log in to the Raspberry Pi. PuTTY download address:
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
1. Run PuTTY, enter the IP address of the Raspberry Pi into the Host Name, and click
“Open”.
2. If it prompts Network error: Connection timed out, it means you probably entered the
wrong IP address.
Support email:
27
3. When the connection is normal, you will see a security warning. You can safely ignore it
and click the "Yes" button. You will see this warning when PuTTY connects to a Raspberry Pi
that has not been connected before.
4. You will now see the usual login prompt. Log in with the same username and password
as the Pi itself. The default login name of Raspbian is pi and the password is raspberry. When
entering the password, the screen will not display the entered password. After entering
raspberry, press Enter to confirm.
5. You should now have the Raspberry Pi prompt, which will be the same as the prompt on
the Raspberry Pi itself.
MobaXterm
MobaXterm is a terminal tool software that can be used to remotely control the Raspberry
Pi.
Support email:
28
Support email:
29
Support email:
30
7. Click "SSH".
8. Enter the your IP address of the Raspberry Pi queried before, E.g:192.168.3.157, and
click "OK" to confirm.
Support email:
31
9. Enter the Raspberry Pi default account: pi, then press the Enter key, and then enter the
Raspberry Pi default password: raspberry. Press Enter to log in to the Raspberry Pi system.
10. After successfully logging in to the Raspberry Pi OS, the following interface will appear:
Support email:
32
11. The red box in the figure below is the command window, where you can control the
Raspberry Pi by entering commands.
12. When we close the MobaXterm software and open MobaXterm again to connect to the
Raspberry Pi, we can double-click the IP address under "User sessions" on the left:
192.168.3.157, enter the account name: pi, and you can directly connect to the Raspberry Sent.
Support email:
33
2. The initial user name of the Raspberry Pi is “pi” and the initial password is “raspberry”.
3. Enter ssh pi@<IP> in the command line and replace <IP> with your Raspberry Pi IP
address, as shown in the following example:
ssh [email protected]
4. Press Enter, and the prompt Are you sure you want to continue connecting (yes/no)?
5. Enter “yes”, press Enter, “[email protected]'s password:” appears, fill in the initial
password “raspberry“ of the Raspberry Pi, pay attention to the case, there will be no changes
on the screen during the password input, but it does not Indicates that the input was not
successful, press enter after the input is complete.
Support email:
34
⚫ For the power supply of Raspberry Pi, please refer to this official document:
https://www.raspberrypi.org/documentation/hardware/raspberrypi/power/README.md
⚫ Our Raspberry Pi robot driver board Robot HAT can directly supply power to the Raspberry
Pi through the GPIO pins. However, because the software installation time in the Raspberry
Pi is relatively long, it is not recommended to use battery power when installing the
Raspberry Pi. The Raspberry Pi robot driver board Robot HAT or camera need not be
installed when installing the software in the Raspberry Pi. This does not affect the software
installation, but when you run the installed program, you must connect the driver board and
the Raspberry Pi camera, otherwise Will cause the program to report an error.
⚫ If you manually download the image file provided by us, you only need to load the SD card
into the Raspberry Pi to boot, and the program of the robot product will run automatically.
You can skip this section.
Use the image file we provide If you want to update the code, you can delete the
"adeept_picarpro" file and download the product code again.
1. After the operations in the previous section, we have logged in to the Raspberry Pi, and enter
the following commands in the console:
Support email:
35
2. After the input is complete, press enter to start downloading the robot program from GitHub.
This process will continue for a period of time. Wait patiently for the download to complete.
4. After the download is complete, a new folder” adeept_picarpro”will appear, in which the
product code is stored. Check through the Linux command "ls".
ls
⚫ If you use "Manually download the image file we provide" to write the image file to the SD card,
the dependency library of the robot product has been installed, you can directly boot the
Raspberry Pi to start using the robot.
Support email:
36
⚫ If you used "Download the official Raspbian image file" to write the image file to the SD card,
you can refer to this section to install the dependent libraries.
⚫ When installing dependent libraries, the installation of some dependent libraries may fail due to
network problems or dependent library version issues. For dependent libraries that fail to install,
the program will automatically install multiple times.
⚫ After the installation is complete, the Raspberry Pi will automatically restart. At this time, the
remote login program of the Raspberry Pi via SSH will be terminated. Please log in again.
⚫ When installing dependent libraries, the installation may fail due to network or regional reasons.
If you encounter any problems, please contact us: [email protected]
We have prepared a script to install all the dependent libraries that need to be used and set up
operations such as turning on the camera and automatically running on startup.
Steps:
1. Enter the following code in the console and run the script setup.py to install the required
dependent libraries:
2. Press Enter to confirm. The following operations are automatically completed by the script
program. Depending on the network environment, this process may last for tens of minutes or several
hours, just wait patiently.
Support email:
37
After the installation is complete, the Raspberry Pi will automatically disconnect the SSH
connection and restart. At this time, if you are using a Raspberry Pi connected by software such as
Putty, there will be an error message such as Network error: Software caused connection abort,
which is normal, just close the window.
⚫ When no error message appears when the “webServer.py” program is running, the dependent
library is installed successfully.
⚫ Only by successfully running the webServer.py program on the Raspberry Pi, can the Raspberry
Pi be accessed with the IP on the browser.(After installing the dependent libraries, the Raspberry
Pi will automatically run webServer.py).
⚫ Prepare the components required for installation, and turn off the power of the Raspberry Pi
during installation.
Support email:
38
1. Install the camera cable, contact the metal surface of the cable with the metal surface of the
Raspberry Pi (the same applies to installing the camera).
2. Install Robot HAT and camera, and connect the Raspberry Pi power supply.
3. After the Raspberry Pi is turned on (about 30-50s), you can access the Raspberry Pi with a
browser.
⚫ How to tell whether the robot has run the `webServer.py` or not: If the WS2812-LED lights up
with the breathing effect, it means the robot has booted and runs the program automatically.
⚫ If the program is not run when the robot is booted, try to connect Raspberry Pi via SSH,
manually run `webServer.py` with code and check the errors. Refer to the Q&A below or email
us for help: [email protected]
Support email:
39
⚫ before manually running `webServer.py`, you need to end the program possibly auto run in the
back end to release resources.
1. Make sure your device is in the same local area network as the Raspberry Pi.
2. Obtain the IP address of the Raspberry Pi (refer to the software installation section).
3. Open the browser on the device (chrome browser is recommended to avoid possible browser
compatibility issues), enter the IP address of your Raspberry Pi in the address bar, and visit port 5000,
for example: 192.168.3.44:5000
Support email:
40
Depending on the product, the modules on the web controller are also different.
The dependent library is successfully installed, and after "webServer.py" runs automatically, our
product will automatically turn on the hotspot when the wifi is not connected.
The method of turning on the WIFI hotspot in our robot product uses a project from GitHub
create_ap. Our installation script will automatically install this program and related dependent
libraries. If you have not run our installation script, you can use the following command to install
create_ap:
Support email:
41
cd create_ap
3.Under normal circumstances, if the robot program is not connected to the WIFI when it is
turned on, it will automatically turn on the hotspot. You can use your phone or computer to search for
the WIF named Adeept_Robot. The default password is 12345678. Once the connection is successful,
you can log in to 192.168 .12.1: 5000 using a browser to open the WEB application to control the
robot.
4.If your Raspberry Pi is connected to peripherals, and you want to test the Raspberry Pi ’s
ability to turn on hotspots, you can click the WIFI icon in the upper right corner of the Raspberry
Pi ’s desktop, click the name of the connected WIFI, click forget, and never turn Off WIFI, if it is
already in the off state, you need to turn it on.
5.When the WIFI module of the Raspberry Pi is turned on and is not connected to any known
network, you can enter the following command on the console to turn on the WIFI:
Support email:
42
Q&A
⚫ Errors occur with `permission denied` prompt when I manually run `server.py` or
`webServer.py`.
The Raspberry Pi needs the root permission to run the dependent libraries for WS2812 LED
lights control.
You need to add `sudo` to the beginning of `server.py` or `webServer.py` to run the program.
[PATH] is the product folder path. E.g: sudo python3 adeept_picarpro/server/webserver.py
sudo python3 [PATH]/server.py
sudo python3 [PATH]/webServer.py
Support email:
43
⚫ SSH can't connect, error: WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
Enter the following in the command line and press Enter
ssh-keygen -R <the Raspberry Pi's IP address>
For example:
ssh-keygen -R 192.168.3.157
Then you can SSH to the Raspberry Pi again
⚫ When using a computer to copy ssh and wpa_supplicant.conf to the SD card, it prompts that
there is no SD card
If this happens, unplug the card reader and connect it to the computer.
Support email:
44
The metal surface of the camera cable is in contact with the metal surface of the camera,The
metal surface of the camera cable is in contact with the metal surface of the camera interface of the
Raspberry Pi
If the camera is installed correctly, the program will not go wrong, and after running the
command "ls", an image file of image.jpg will appear
If an error occurs, it means that the camera is not installed correctly or the camera is
malfunctioning
Support email: