跳转到内容

Raspberrypi常见操作

来自FC
FC留言 | 贡献2024年12月3日 (二) 07:55的版本 (FC移动页面Rasperrypi常见操作Raspberrypi常见操作,不留重定向)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

收录一些树莓派的操作过程

查看系统信息

#查看系统基本信息
fang@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
#查看内核版本
fang@raspberrypi:~ $ uname -a
Linux raspberrypi 6.6.51+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08) aarch64 GNU/Linux
#查看内存使用情况
fang@raspberrypi:~ $ free -m
               total        used        free      shared  buff/cache   available
Mem:             907         161         249           1         550         745
Swap:            511           0         511
#查看磁盘使用情况
fang@raspberrypi:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            320M     0  320M   0% /dev
tmpfs            91M  1.1M   90M   2% /run
/dev/mmcblk0p2   15G  3.3G   11G  25% /
tmpfs           454M   12K  454M   1% /dev/shm
tmpfs           5.0M   12K  5.0M   1% /run/lock
/dev/mmcblk0p1  510M   60M  451M  12% /boot/firmware
tmpfs            91M  4.0K   91M   1% /run/user/1000
#查看cpu信息
fang@raspberrypi:~ $ cat /proc/cpuinfo
processor       : 0
BogoMIPS        : 38.40
Features        : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
BogoMIPS        : 38.40
Features        : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
BogoMIPS        : 38.40
Features        : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
BogoMIPS        : 38.40
Features        : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Revision        : a020d3
Serial          : 000000006ef86023
Model           : Raspberry Pi 3 Model B Plus Rev 1.3
#查看网络信息
fang@raspberrypi:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.99  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::5fb1:e4b8:98e6:7ed7  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:f8:60:23  txqueuelen 1000  (Ethernet)
        RX packets 53502  bytes 3397512 (3.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 52209  bytes 3452584 (3.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 163  bytes 22232 (21.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 163  bytes 22232 (21.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

设置固定ip

sudo nmtui然后有个对话框选择Edit a connection👉wired connection1👉然后根据实际情况设置固定ip地址

连接摄像头

直接命令:

sudo apt install libcamera-apps

sudo apt install libcamera-tools

测试

libcamera-hello

如果不行那就是摄像头没接好。

以上基于2024年12月2日10:57:55左右官网下载精简系统进行的操作。在此之前网上介绍使用命令sudo raspi-config👉Interfacing Options👉Camera,没有这个选项。

老版本的树莓派系统通过interface options中打开camera使能是通过picamera这个库来使用的.但是2023年的树莓派新系统是基于debian12开发的,并且去除了picamera这个库.所以并不能通过interface options这里来打开camera.

然后新系统本身预装了picamera2这个库,这个库是picamera库的升级版本.然后这个picamera2库是基于libcamera开源框架.所以libcamera能成功调用摄像头的话.则可以通过picamera2的接口来编写程序来调用摄像头