Presentation is loading. Please wait.

Presentation is loading. Please wait.

Raspberry Pi 基本操作

Similar presentations


Presentation on theme: "Raspberry Pi 基本操作"— Presentation transcript:

1 Raspberry Pi 基本操作

2 製作 Pi SDcard 的 Image Step 1: 下載 Pi image (RASPBIAN JESSIE) http://www.raspberrypi.org/downloads/ Step 2: 在 PC 上 利用 win32 Disk Imager 工具將.img 檔 寫入 SD 卡

3 SD Card 內容 Pi’s Embedded Linux 組成 Boot code Linux Kernel Root File system Boot code kernel Root FileSystem mmcblock0p1 /boot mmcblock0p2 / 資料來源 : https://goo.gl/VrjL9b FAT32 EXT4

4 使用 UART Console 登入 Raspberry Pi Linux 紅色 Raspberry Pi Shield 上內建 USB-to-Serial (PL2303) 晶片, 故可以用電腦透過 USB 界面連接到 Raspberry Pi PL2303 USB Power (5V)

5 軟體安裝 Step1: 安裝 PL2303 Driver Step2: 安裝 TeraTerm 終端機連線軟體 Step3: 終端機連線設定PL2303 DriverTeraTerm Note: Pi 3 須將 /boot/config.txt 的檔案, 加入此行 enable_uart=1

6 打開 TeraTerm 軟體會看到連接埠的端口有 COMx( 如下畫面 ) 。 選擇連接埠端口 : COM3: Prolific USB-to-Serial Comm Port 並按下 [ 確定 ] 。TeraTerm

7 設定 UART 通訊參數 115200,8N1

8 終端機畫面 使用預設帳密登入 Username: pi Password: raspberry

9 也可以使用 putty 選擇 Serial Speed: 11500 Serial Line: COM3

10 Linux 基本操作命令 ls -l # list 目錄內容 cd # 改變工作目錄 pwd # 顯示目前所在工作 目錄位置 cp -a #copy 檔案 mkdir# 產生目錄 rm -rf # 刪除目錄 ( 含子目錄 ) cat # 顯示檔案內容 ln -s # 建立 Softlink ( 捷徑 ) unzip xxx.zip # 解壓縮 zip 檔 tar zcvf xxx.tar.gz # 製作 tar.gz 壓縮包 tar zxvf xxx.tar.gz # 解 tar.gz 壓縮包

11 Linux 基本操作命令 Ifconfig # 檢視所有網路卡狀態 ping ; # 確認是否可以連到某個 ip ctrl+C 停止 passwd # 變更登入密碼 passwd # 變更某 User 的登入密碼 whoami# 顯示登入帳號 sudo # 以 root 身份執行此命令 sudo apt-get install # 線上安裝軟體套件 sudo reboot # Reset Pi sudo shutdown -h now # 關機 ps -aux ; kill -9 # 示系統上所有的執行程式 su # 切換成 root

12 ls -l / 顯示 Linux 根目錄

13 如何傳檔案到 Pi 用 MobaXterm 簡單、好學、易用, 它具有終端機及 SFTP Client 的功能 http://mobaxterm.mobatek.net/ Pi 的 IP 位址 SFTP 在 PC 上拖曳檔案 到這裡, 即是傳送 Pi 需要 SSH 服務被啓動 !

14 將 MobaXterm 貼上的快速鍵改為習慣的 "Ctrl+V"

15 Pi 組態工具 : raspi-config sudo raspi-config ; 設定完後 reboot

16 開啓 Pi 的 SSH 功能 sudo raspi-config  進入 [Interfacing options] 將 SSH 開啓 16

17 確認 SSH 服務啓動中 netstat -atn  啓動 SSH 後, TCP Port 22 應處於 Listen 狀態

18 允許 root 使用 SSH 密碼登入 Normally ssh does not allow root access because this is considered a security risk 作法 : sudo passwd root  設定 root 登入密碼 sudo nano /etc/ssh/sshd_config  找到 “#PermitRootLogin without-password”, 改 成 ”PermitRootLogin yes”

19 設定 Pi 3 Wi-Fi # Site Survey (AP Scan) sudo iwlist wlan0 scan # 連接 AP sudo raspi-config  進入 [Network Options]  Wi-Fi

20 修改 Wi-Fi 密碼或更多組 Wi-Fi 設定 sudo nano /etc/wpa_supplicant/wpa_supplicant.conf 離開 ctrl-X 存檔 Ctrl-O country=GB ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="ittraining401" psk="itstudent" } country=GB ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="ittraining401" psk="itstudent" }

21 Wi-Fi 功能開關 # 停止 Wi-Fi sudo ifdown wlan0 # 啓用 Wi-Fi sudo ifup wlan0 You can verify if it has successfully connected using ifconfig wlan0

22 Linux Wireless Tools sudo iwconfig wlan0  確認連到的 AP

23 Useful Links https://www.raspberrypi.org BCM2835 Low-Level I/O Library http://www.airspayce.com/mikem/bcm2835/http://www.airspayce.com/mikem/bcm2835/ BCM2835 DataSheet 用 Raspberry Pi 學 Linux 驅動程式開發 http://blog.ittraining.com.tw/2015/05/raspberry-pi-b-pi2-linux-gpio-button.html PIR 感測電路應用設計 http://blog.ittraining.com.tw/2016/08/raspberry-pi-pir.html 用 Raspberry Pi 學嵌入式系統開發 https://goo.gl/VrjL9b 用 Raspberry Pi 學 ARM Bootloader 程式開發 https://goo.gl/eNEuUk 艾鍗 BLOG http://blog.ittraining.com.tw/


Download ppt "Raspberry Pi 基本操作"

Similar presentations


Ads by Google