准备
MicroSoft SD卡,建议8G以上读卡器手机电源网线(如需通过网线连接树莓派)电脑
安装
烧录操作系统
1. 下载系统镜像及安装工具
系统镜像 链接:https://pan.baidu.com/s/1wOUJ–U1T0olM_TkzXW3pQ 提取码:iszp
NOOBS 链接:https://pan.baidu.com/s/1s-V67RwxZSvoZMSgliSFwg 提取码:t82t
烧录工具 链接:https://pan.baidu.com/s/1FIwBLhXolFGFB5MbhDR5BQ 提取码:5gt1
2. SD卡格式化为FAT格式
连接电脑后,右键SD卡->格式化
方法一:NOOBS安装方式
将NOOBS解压后的文件复制至SD卡根目录下
默认系统不开启ssh服务,根目录并新建空文件ssh,不加后缀,即可启动时开始ssh,方便远程连接
方法二:镜像安装方式
使用WIN32磁盘映像工具进行烧录
默认系统不开启ssh服务,根目录并新建空文件ssh,不加后缀,即可启动时开始ssh,方便远程连接
烧录完成后,将SD卡插入树莓派主板卡主板卡使用网线连接路由器通过路由器管理器查看树莓派IP使用ssh工具进行连接 默认用户名密码:pi/raspberry
这里使用SecureCRT,注意:因为获取到的IP为局域网IP,电脑必须与树莓派在同一网络才能登录
常用配置
修改默认密码
> sudo passwd pi
New password:
Retype new password:
passwd: password updated successfully
配置网络(无界面化)
方法一:网线直连
直接网线连接路由器,通过路由器找到设备IP地址
通过SSH工具即可连接
方法二:WIFI连接
选择网络配置
> sudo raspi-config
选择SSID和密码设置
找到SSID
若出现乱码,则修改字符编码为UTF-8
查看可用WLAN
> iwlist wlan0 scan
此时网络配置文件已生成
> cat /etc/wpa_supplicant/wpa_supplicant.conf
此时查看WIFI状态下的IP地址
> ifconfig
通过SSH工具即可连接
方法三:手机USB共享网络
此时查看USB共享状态下的IP地址
> ifconfig
通过SSH工具即可连接
电脑/手机远程连接树莓派
安装xrdp
> sudo apt-get install xrdp
安装vncserver
> sudo apt-get install tightvncserver
本地电脑连接
打开命令行工具,输入mstsc,输入IP、用户名、密码
手机远程连接
安卓手机下载使用JuiceSSH工具进行连接
外接U盘/移动硬盘
树莓派默认不自动挂载外部磁盘,需要手动挂载
树莓派插入外接U盘或移动硬盘,新建目录,手动挂载
# 查看外接设备
> sudo fdisk -l
# 创建挂载目录
> sudo mkdir /aigo
# 手动挂载
> sudo mount /dev/sda1 /aigo
# 查看挂载情况
> df -h
# 配置开机自动挂载
> sudo vi /etc/fstab
proc /proc proc defaults 0 0
PARTUUID=ad2459ba-01 /boot vfat defaults 0 2
PARTUUID=ad2459ba-02 / ext4 defaults,noatime 0 1
# 添加下句
/dev/sda1 /aigo ntfs defaults,noexec,umask=0000 0 0
# 卸载已挂载U盘
> sudo umount /aigo
# 测试自动挂载
> sudo mount -a
> df -h
蓝牙连接
# 查看蓝牙版本
> bluetoothctl -v
bluetoothctl: 5.50
# 查看蓝牙状态
> sudo service bluetooth status
# 关闭蓝牙
> sudo service bluetooth stop
# 打开蓝牙
> sudo service bluetooth start
# 进行蓝牙操作
> sudo bluetoothctl
Agent registered
# 查看蓝牙信息
[bluetooth]# list
Controller DC:A6:32:AC:20:D8 raspberrypi [default]
# 扫描蓝牙设备
[bluetooth]# scan on
Discovery started
[CHG] Controller DC:A6:32:AC:20:D8 Discovering: yes
[NEW] Device 60:38:C0:18:EE:10 60-38-C0-18-EE-10
[NEW] Device 64:52:0B:FD:A7:BF 64-52-0B-FD-A7-BF
[NEW] Device 49:13:71:11:DD:FB 49-13-71-11-DD-FB
[NEW] Device 28:C1:3C:62:74:CF LCD-45SF475A
# 查看蓝牙设备
[bluetooth]# devices
[NEW] Device F8:C3:9E:96:77:0D 愤怒的小兵
[CHG] Device 64:52:0B:FD:A7:BF RSSI: -96
[CHG] Device F8:C3:9E:96:77:0D RSSI: -13
[NEW] Device 79:9E:52:20:87:40 79-9E-52-20-87-40
[NEW] Device 50:A0:09:AD:56:11 50-A0-09-AD-56-11
# 蓝牙配对
[bluetooth]# pair F8:C3:9E:96:77:0D
Attempting to pair with F8:C3:9E:96:77:0D
[CHG] Device F8:C3:9E:96:77:0D Connected: yes
Request confirmation
[agent] Confirm passkey 424888 (yes/no): yes
[CHG] Device F8:C3:9E:96:77:0D Modalias: bluetooth:v010Fp107Ed1436
[CHG] Device F8:C3:9E:96:77:0D UUIDs: 0000046a-0000-1000-8000-00805f9b34fb
[CHG] Device F8:C3:9E:96:77:0D UUIDs: 00001105-0000-1000-8000-00805f9b34fb
[CHG] Device F8:C3:9E:96:77:0D UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
[CHG] Device F8:C3:9E:96:77:0D UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device F8:C3:9E:96:77:0D UUIDs: 00001112-0000-1000-8000-00805f9b34fb
[CHG] Device F8:C3:9E:96:77:0D UUIDs: 00001115-0000-1000-8000-00805f9b34fb
[CHG] Device F8:C3:9E:96:77:0D UUIDs: 00001116-0000-1000-8000-00805f9b34fb
[CHG] Device F8:C3:9E:96:77:0D UUIDs: 0000111f-0000-1000-8000-00805f9b34fb
[CHG] Device F8:C3:9E:96:77:0D UUIDs: 0000112f-0000-1000-8000-00805f9b34fb
[CHG] Device F8:C3:9E:96:77:0D UUIDs: 00001132-0000-1000-8000-00805f9b34fb
[CHG] Device F8:C3:9E:96:77:0D UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device F8:C3:9E:96:77:0D UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device F8:C3:9E:96:77:0D UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device F8:C3:9E:96:77:0D UUIDs: 0000fe35-0000-1000-8000-00805f9b34fb
[CHG] Device F8:C3:9E:96:77:0D ServicesResolved: yes
[CHG] Device F8:C3:9E:96:77:0D Paired: yes
Pairing successful
[CHG] Device F8:C3:9E:96:77:0D ServicesResolved: no
[CHG] Device F8:C3:9E:96:77:0D Connected: no
# 移除设备
[bluetooth]# remove F8:C3:9E:96:77:0D
[DEL] Device F8:C3:9E:96:77:0D 愤怒的小兵
Device has been removed
# 信任设备
[bluetooth]# trust F8:C3:9E:96:77:0D
[CHG] Device F8:C3:9E:96:77:0D Trusted: yes
Changing F8:C3:9E:96:77:0D trust succeeded
# 连接设备
[bluetooth]# connect F8:C3:9E:96:77:0D
Attempting to connect to F8:C3:9E:96:77:0D