樹莓派3B 安裝微雪LCD5inch顯示器(包含軟鍵盤)


  樹莓派單獨使用時,往往需要觸摸屏和軟鍵盤用以方便操作,微雪LCD顯示器就能較好的實現這個功能,

正好實驗室又買入了一個3B的板子和一個5inch的顯示器,便對着官方的安裝手冊,親自安裝了一次。

一:材料准備

  1. 樹莓派官方鏡像,本人使用的是2016-05-27-raspbian-jessie鏡像 
  2. Win32DiskImager.exe 用來燒錄鏡像。
  3. USB讀卡器
  4. matchbox-keyboard.zip 微雪LCD盤軟鍵盤
  5. 樹莓派LCD驅動 160813

二:鏡像燒入

  1. 將鏡像文件下載到電腦(PC),並解壓得到.img文件.
  2. 將TF卡通過USB讀卡器插入電腦,打開Win32DiskImager.exe,選擇1中的鏡像img文件,選中樹莓派TF卡磁盤,點擊write燒錄鏡像。
  3. 燒錄完成后,將樹莓派LCD驅動復制到boot目錄下,編輯boot下的config.txt文件,在文件末尾加入以下代碼,並保存。
    1     max_usb_current=1
    2     hdmi_group=2
    3     hdmi_mode=87
    4     hdmi_cvt 800 480 60 6 0 0
  4. 遠程連接樹莓派,本人使用的是一個網線直連樹莓派,具體參照http://www.whatled.com/post-1526.html
  5. 前面已經把樹莓派LCD驅動復制到/boot下,執行以下操作(需要外接USB鍵盤)
    1     tar xzvf /boot/LCD-show-YYMMDD.tar.gz 
    2     cd LCD-show/
    3     ./LCD5-show
  6. 重啟后安裝LCD顯示器到樹莓派即可。但是還沒有實現軟鍵盤功能。

三:軟鍵盤(虛擬鍵盤)的安裝

  1. 執行下列命令安裝相應軟件
    1     sudo apt-get update
    2     sudo apt-get install libfakekey-dev libpng-dev libxft-dev autoconf libtool -y
  2. 下載matchbox-keyboard.zip,解壓並復制到raspberry的系統,執行下列命令
    1     cd matchbox-keyboard
    2     chmod +x autogen.sh
    3     sudo ./autogen.sh
    4     sudo make
    5     sudo make install
    6     sudo apt-get install libmatchbox1 -y
    7     sudo nano /usr/bin/toggle-matchbox-keyboard.sh
  3. 復制以下內容到toggle-matchbox-keyboard.sh中,並保存
    1     #!/bin/bash
    2     #This script toggle the virtual keyboard
    3     PID=`pidof matchbox-keyboard`
    4     if [ ! -e $PID ]; then
    5     killall matchbox-keyboard
    6     else
    7     matchbox-keyboard -s 50 extended&
    8     fi
  4. 執行下列命令
    1     sudo chmod +x /usr/bin/toggle-matchbox-keyboard.sh
    2     sudo nano /usr/local/share/applications/toggle-matchbox-keyboard.desktop
  5. 復制以下內容到toggle-matchbox-keyboard.desktop,保存退出
    1     [Desktop Entry]
    2     Name=Toggle Matchbox Keyboard
    3     Comment=Toggle Matchbox Keyboard`
    4     Exec=toggle-matchbox-keyboard.sh
    5     Type=Application
    6     Icon=matchbox-keyboard.png
    7     Categories=Panel;Utility;MB
    8     X-MB-INPUT-MECHANSIM=True
  6. 執行以下命令,注意該步驟必須使用"pi"用戶權限,如果使用管理員權限,將找不到該文件
    1     nano ~/.config/lxpanel/LXDE-pi/panels/panel
  7. 找到類似以下命令(不同版本的圖標可能有一定差異)
     1     Plugin {
     2     type = launchbar
     3     Config {
     4     Button {
     5     id=lxde-screenlock.desktop
     6     }
     7     Button {
     8     id=lxde-logout.desktop
     9     }
    10     }
  8. 加入以下代碼以新增一個Button項,如下圖
    1     Button {
    2     id=/usr/local/share/applications/toggle-matchbox-        keyboard.desktop
    3     }

  9.執行以下命令重啟系統,正常可以看到左上角多了一個虛擬鍵盤的圖標

  1     sudo reboot

四:總結

  1. 整體安裝過程中,前期樹莓派與電腦的互聯以及樹莓派網絡的連接需要注意,本人使用的是網線直連。
  2. 在安裝LCD驅動的時候,如果出現錯誤,嘗試以管理員身份運行,若還是出錯,則直接安裝LCD顯示屏,開機嘗試是否能正常顯示畫面。
  3. 安裝時間整體下來也就一個小時左右,總體還算輕松,微雪的不同尺寸的LCD顯示屏安裝軟鍵盤方式好像不太一樣,具體沒有考證。  

五:安裝所需工具和鏡像。

   http://pan.baidu.com/s/1dE2Mj4H  密碼 8tqq

 


免責聲明!

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



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