Raspberry Pi-2-RaspBerry4B hardware introduction and initial installation

1 Introduction to Raspberry

The Raspberry Pi is essentially a mini embedded computer, just like any other desktop or notebook, you can do many things with the Raspberry Pi. Ordinary computer motherboards rely on hard drives to store data, but Raspberry Pi uses TF cards as "hard drives".

The Raspberry Pi can be used to edit documents, browse the web, play games, play videos, and play audio. You can also use the Raspberry Pi to make smart cars, oscilloscopes, electronic photo frames, home theaters, cameras, etc. On the official website of Raspberry Pi, there are many open source application examples, which can be accessed through the following website.
https://projects.raspberrypi.org/en

1.1 Interface introduction

(1) The external interface
Insert picture description here Raspberry Pi 4B uses a BCM2711 chip produced by Broadcom Corporation that integrates GPU and CPU. The CPU that the Raspberry Pi is adapted to is of the ARM architecture, which is different from the X86 and AMD64 architectures we usually use on PCs. ARM is a reduced instruction set (RISC) processor. A major feature of this instruction set is that the instruction system is very simple, allowing the hardware to execute the most commonly used instructions the fastest, so the number of instructions is very limited. ARM architecture chips are most commonly used in smart phones that we are familiar with, such as Apple's A7, Samsung's Orion, and domestic Huawei's HiSilicon processor.
Insert picture description here

(1-1) Core
SOC: Broadcom BCM2711
CPU: Broadcom BCM2711, 1.5 GHz, 64-bit, 4 cores, ARM Cortex-A72 architecture, 1MB shared L2 cache
Quad core Cortex-A72 (ARM v8) 64-bit @ 1.5GHz

RAM:1、2、4 GB LPDDR4-3200 RAM (shared with GPU)
1GB/2GB/4GB/8GB(Rev1.2)LPDDR4

SOC is called system-on-a-chip, or System on a Chip, which is a product of a proprietary integrated circuit, which includes a complete system and has all the contents of embedded software. At present, SOC has more integrated processors (including CPU, GPU, DSP), memory, baseband, various interface control modules, various interconnection buses, etc. The typical representatives are mobile phone chips.
ARM produces CPUs. It sells its own CPU designs to other companies, and other companies add various peripheral controllers they need based on the CPUs provided by ARM. This is the SOC (Huawei Kirin). It can be simply understood that SOC includes CPU, and the development of chip is from CPU to SOC.

LPDDR can be said to be the most widely used "working memory" memory in mobile devices worldwide, Low Power Double Data Rate 4.
(1-2) Network
Ethernet: 10/100/1000 Mbit/s
Wireless network: b/g/n/ac dual-band 2.4/5 GHz
Bluetooth: 5.0
(1-3) Multimedia
GPU: Broadcom VideoCore VI @ 500 MHz
VideoCore VI, H.265 (4Kp60 decode), H.264 (1080p60 decode, 1080p30 encode), OpenGL ES 3.0 graphics 500Mhz

HDMI: micro-HDMI
high - definition multimedia interface (High Definition Multimedia Interface, HDMI)
Insert picture description here
DSI: onboard cable
MIPI (Mobile Industry Processor Interface) is an alliance established by ARM, Nokia, ST, TI and other companies in 2003, the purpose is to The internal interfaces of the mobile phone, such as the camera, display interface, radio frequency/baseband interface, etc., are standardized, thereby reducing the complexity of mobile phone design and increasing design flexibility. MIPI-DSI protocol has the characteristics of high speed, low energy consumption and low interference. It can be switched between performance and power saving modes. It is very suitable for use on mobile devices, so it is used in many mobile phones, wearable devices, Internet of Things, and virtual reality. And it has been applied to the in-vehicle intelligent system.
DSI is the display interface for Display, Display Serial Interface.

CSI: Onboard cable
CSI is the camera interface for Camera, Camera Serial Interface

The Raspberry Pi board is equipped with MIPI-DSI interface and HDMI output, so it can support MIPI-DSI interface LCD screen and HDMI format display.

(1-4)PoE function interface The
full English name is: Power Over Ethernet. The advantage is that it can transmit data signals for some IP-based terminals (such as IP telephones, wireless LAN access points AP, network cameras, etc.) while providing DC power supply technology for such devices.
To use this function is to match a POE HAT module.

(2) Expansion interface

Insert picture description here
(3) Pin introduction
Insert picture description here

1.2 Model comparison

Insert picture description here

2 Raspberry installation tool

Software:
(1) SDFormatter.exe
(2) Win32DiskImager
Insert picture description here
(3) Raspberry operating system
Hardware:
(1) Raspberry 4b motherboard
(2) TF card
SD card is generally a large memory card used by cameras, TF is a small memory card used by mobile phones Memory card, whether it is SD card or TF card, if it is broken, you can try to repair it with a memory card repair tool, or you can use data recovery software to restore data.

SD card is the English abbreviation of Secure Digital Card, literally translated as "secure digital card". TF card is T-Flash card, also called micro SD card, that is, micro SD card.

Raspberry Pi Sensor Kit 45 in One: 66
Raspberry Pi Speaker: 6
Raspberry Pi GPIO Extended Version: 15
DuPont Line: 8
Raspberry Pi Microphone: 9
Raspberry Pi Acrylic Fan: 22
Raspberry Pi 4B: 450
Universal Meter: 10
32GTF card: 23

2.1 Raspberry operating system

https://www.raspberrypi.org/software/operating-systems/#third-party-software
Insert picture description here(1) Raspberry Pi OS (32-bit)
Insert picture description here contains Raspberry desktop operating system and recommended software system [recommended];
only contains Raspberry Desktop operating system;
a lightweight system that does not include a desktop.
(2) Raspberry Pi Desktop The
Insert picture description here official raspbian operating system of Raspberry Pi has a PC version, which can be used to install on your own computer. It may be an official promotion strategy. First launch the Raspberry Pi system so that everyone can experience it on the PC.
No Raspberry Pi hardware experience: Install Raspberry Pi Desktop in a virtual machine.
Raspberry Pi Desktop is a derivative release based on Debian Buster.
i386 is the collective name for 32-bit microprocessors. Virtualbox
set bridge network card
mirror 2021-01-11-raspios-buster-i386.iso
type Linux
version Debian 32-bit
select "Graphical Install
default username/password pi/raspberry

(3)Third-party software
Insert picture description here

2.2 Install the system

Raspberry Pi 4B novice configuration (no display, no network cable, same WiFi)
Raspberry Pi 3b+, 4b novice to get started

(1) Format the SD card with SDFormatter
Insert picture description here(2) Use Win32DiskImager to write the downloaded system image into the SD card
2021-01-11-raspios-buster-armhf-full.img After
Insert picture description hereburning the system, it will be divided into Three areas, the boot partition is displayed on win. The system will read the information in the boot partition every time the system is turned on, so after the following configuration, there is no need to reconfigure each time the machine is turned on and off.
Insert picture description here
(3) Open the ssh service
This step allows us to use the ssh function to connect to the Raspberry Pi remotely.
Open the SD card and create a file named ssh without suffix in it.

(4) Check the Raspberry Pi ip.
First connect the Raspberry Pi and the notebook with a network cable.
Then set the internet share in the wlan attribute.
Insert picture description hereFinally, query the ip address
CMD>arp -a and
Insert picture description herefound that the connection through sharing is relatively slow.

2.3 Set up connection to wifi

After the card reader has written the system, open the card reader and
create a new file wpa_supplicant.conf

country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    
    
ssid="ES-144565"
psk="33720657"
key_mgmt=WPA-PSK
priority=2
}

network={
    
    
ssid="HUAWEIP40"
psk="123456789"
key_mgmt=WPA-PSK
priority=1
}

The first three lines remain unchanged, and a network block represents a network. ssid represents the network name, psk represents the network password, key_mgmt represents the network encryption method, and priority represents the connection priority. The higher the priority, the first to connect to this network (cannot be a negative number).
CMD>ping
Insert picture description hereraspberrypi.local connects to the Raspberry Pi via SSH through the IPV6 address.

It is equivalent to the operation file /etc/wpa_supplicant/wpa_supplicant.conf.

2.4 Replacing the source of Raspberry Pi

#备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
sudo cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list_backup  

#sudo vi /etc/apt/sources.list

deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi

#sudo vi /etc/apt/sources.list.d/raspi.list

deb http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui 
deb-src http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

#sudo apt-get update #Update system software

2.5 Connect to the Raspberry Pi desktop through the vnc client

(1) Open vnc and
enter in the ssh interface:
pi@raspberrypi:~ $ sudo raspi-config
to operate in turn: Interfacing Options --> VNC -> Yes-> Finish.

Created symlink 
/etc/systemd/system/multi-user.target.wants/vncserver-x11-serviced.service
→
/lib/systemd/system/vncserver-x11-serviced.service.

(2) Install and start tightvncserver
$sudo apt-get install tightvncserver install tightvncserver
$ vncpasswd Set a VNC password [bigdata]
First enter the operation password twice, and then ask whether to set a view-only password, generally not necessary.
$ tightvncserver starts tightvncserver The
Insert picture description herelast number is the port number to connect to the Raspberry Pi.
Windows install tightvnc-2.8.59-gpl-setup-64bit.msi.
Enter the ip and port number, for example: 192.168.0.199:1
Insert picture description hereas required to enter the vncpasswd password just set.
Ctrl+Alt+Shift+F full screen switch.

2.6 Shut down the Raspberry Pi properly

The Raspberry Pi is a miniature motherboard, but there is no power-on or power-off button on this motherboard. When we connect the Raspberry Pi to the power supply through the mini USB interface, the system installed in the SD card will start automatically. But how to shut it down?

Many people think this way: Since the machine is automatically turned on when it is connected to the power supply, then the machine will not be turned off when the power supply is unplugged. This kind of shutdown is equivalent to an abnormal shutdown (such as a sudden power failure). Long-term abnormal shutdown will damage the Raspberry Pi's SD card.

The correct shutdown method is
(1) first execute the following command
$sudo shutdown -h now
(2) when the above command is executed, you will find that among the LED status indicators of the Raspberry Pi, only the PWR indicator (power indicator) ) Is on, and other indicators are off, indicating that the system has been shut down. Next, unplug the power supply, and the PWR indicator will go out immediately. This is the correct shutdown.

3 Installation and configuration

3.1 Install vim editor

$sudo apt-get install vim editor

3.2 Transfer files

Turn on the ssh service of the Raspberry Pi, first log in from the ipv6 address, check the ipv4 address in ifconfig, and switch to the ipv4 address to log in. The mobaxterm software can drag incoming files.

3.3 python version

$ pip install numpy
numpy in /usr/lib/python2.7/dist-packages (1.16.2)

$ pip3 install numpy
numpy in /usr/lib/python3/dist-packages (1.16.2)

3.4 Connect Bluetooth

Insert picture description here(1) Under the Bluetooth icon, select Remove Device..., select the Bluetooth headset to delete.
(2) Turn on the Bluetooth headset again to make it in the pairing state.
(3) Under the Bluetooth icon, select Add Device…, find our Bluetooth headset, and pair it.
(4) After the pairing is successful, immediately right-click the volume icon, select Audio Outputs, find our Bluetooth headset under this column, select it, and modify the output audio to be a Bluetooth headset.
(5) Open the web page with audio and play the sound test.
Insert picture description hereAmong them, AV jack--Audio Video jack
$ systemctl status bluetooth to check the Bluetooth operating status

3.5 Connect mobile phone to Raspberry Pi

Use ConnectBot, the ssh tool on the mobile phone.
(1) ConnectBot
ConnectBot is an SSH client for the Android platform. It should be regarded as the first client for Android.
Insert picture description here
(2) JuiceSSH
is the best free SSH client on Android. It has powerful functions. It has special characters and A pop-up keyboard with keyboard keys, including Ctrl, Alt, Tab, Space, Back, etc.
Insert picture description here

3.6 Change the system time to 24 system

After the system is installed, the system defaults to the world time. In our East Eight District, the meeting is 8 hours late. In addition, the system time is 12 hours. Use the date command to check the time, AM in the morning and PM in the afternoon. If you are not used to it, you can modify it. It is a 24-hour time format.

The modification time is 24 hours, we can modify /etc/default/locale, there is no LC_TIME variable by default, delete a line LC_ALL=en_US.UTF-8, we add a line to the file, set the amount of change as follows:
$ sudo vim /etc/ default/locale

#  File generated by update-locale
LANG=en_US.UTF-8
LC_TIME=en_DK.UTF-8
LANGUAGE=en_US.UTF-8

After the modification, restart the machine to take effect.
$ locale
$ sudo apt install ntpdate
$ ntpdate us.pool.ntp.org Use ntpdate to synchronize standard time

3.7 Check the usage of TF card

(1) View hard disk and partition information
$ sudo fdisk -l

Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram1: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram2: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram3: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram4: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram5: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram6: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram7: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram8: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram9: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram10: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram11: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram12: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram13: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram14: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram15: 4 MiB, 4194304 bytes, 8192 sectors

Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 sectors
Disklabel type: dos Disk identifier: 0x57eec67a

Device    Boot  Start  End     Sectors  Size Id Type
/dev/mmcblk0p1  8192   532479   524288  256M  c W95 FAT32 (LBA)
/dev/mmcblk0p2  532480 31116287 30583808 14.6G 83 Linux

(1-1) Linux system mounts FAT32 U disk
FAT32 is a partition format of Windows system hard disk. This format uses a FAT32-bit file allocation table, which greatly enhances the dao management capability of the disk. However, because the FAT32 partition cannot store a single file larger than 4GB, and the performance is poor, it is prone to disk fragmentation. It has been replaced by the more excellent NTFS partition format.

LBA (Logical Block Address), Chinese name: logical block address. It is a general mechanism for describing the block of data on a computer storage device, and is generally used in auxiliary memory devices such as hard disks. LBA can mean the address of a certain data block or the data block pointed to by a certain address.
FAT32 is a kind of hard disk partition format.
FAT32 (LBA) is a hard disk partition with logical block addressing mode.
(1-2) Explain that the
size of the U disk is 16G.
16 1000 1000*1000/1024/1024/1024=14.9G.
Hard disk character: /dev/mmcblk0, size 14.9G
Partition 1: /dev/mmcblk0p1, size 256M
Partition 2: /dev/mmcblk0p2, size 14.6G

mmcblk0p2代表
mmc(本意是MultiMedia card,sd卡就是从这个发展来的,这里代表sd设备)
blk(block,块设备)
0(第dao一个块设备,也就是第一张sd卡)
p(partition,分区)
2(第3个分区)

(2) Check
Insert picture description here that the /dev/root mounted is /dev/mmcblk0p2.

3.8 Chinese garbled solutions

Solution to Chinese Garbled on Raspberry Pi

4 Acrylic shell installation

Raspberry Pi nine-layer acrylic case stitching tutorial

Guess you like

Origin blog.csdn.net/qq_20466211/article/details/113914243