串口連接樹莓派


在沒有顯示器以及網絡配置弄亂了,無法再通過筆記本連上樹莓派時,就需要使用串口來連接樹莓派對其網絡進行配置。

筆記本通過串口連接樹莓派

  1. 須准備一個USB轉串口模塊,插到電腦上后在電腦得設備管理器中將識別到一個COM口,如果未識別或者有感嘆號則可能需要安裝模塊對應驅動。

筆記本識別串口

  1. 在電腦正確識別到串口后,將串口得TXD、RXD、GND引腳連接樹莓派得RXD、TXD、GND引腳(具體連接見圖片),然后筆記本上打開任一串口軟件連接1中識別COM口,這里我使用得是SecureCRT,具體配置信息見圖片。

    image-20210428000550462

    串口模塊與樹莓派實物連接圖

    image-20210428001405785

  2. 軟件連接成功后,給樹莓派上電將在串口軟件上看到樹莓派的啟動信息,輸入用戶名密碼即登錄成功。

    image-20210428001711474

配置樹莓派網絡信息

  1. 輸入如下指令打開編輯網卡配置文件,eth0為有線網卡,wlan0為無線網卡。無線網卡當前配置為自動獲取IP,無線名稱及密碼:
pi@raspberrypi:~$ sudo vi /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
#iface wlan0 inet static
#address 192.168.0.66
#netmask 255.255.255.0
#gateway 192.168.0.1
wpa-ssid "wifi名稱"
wpa-passphrase "wifi密碼"
  1. 保存網卡配置,重啟網卡,查看網卡ip地址。
pi@raspberrypi:~$ sudo service networking restart
pi@raspberrypi:~$ ifconfig
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 4  bytes 156 (156.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4  bytes 156 (156.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.33.11  netmask 255.255.255.0  broadcast 192.168.33.255
        inet6 fe80::ba27:ebff:fe6e:bac1  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:6e:ba:c1  txqueuelen 1000  (Ethernet)
        RX packets 220  bytes 15874 (15.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 96  bytes 14489 (14.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

遠程連接樹莓派

windows系統打開遠程桌面,連接上一步查詢到的ip,輸入用戶名密碼后遠程操作樹莓派。

image-20210428002711741

image-20210428002819683


樹莓派參數
型號:Raspberry Pi 3B+
CPU: BCM2837B0 64-位 1.4GHz 4核
接口:藍牙4.2、雙頻Wifi、千兆有線網口、4xUSB2.0


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM