Upload
raspberrypi-tw
View
57.429
Download
2
Embed Size (px)
DESCRIPTION
用Raspberry Pi做手機。 硬體包括Raspberry Pi Model B,Adafruit PiTFT 2.8" Touchscreen,EFCom Pro GPRS/GSM Module,鋰電池等。 軟體使用AT command和GSM模組溝通,Tkinter處理畫面,Xstroke與tegaki為手寫輸入。
Citation preview
Raspberry Pi 好好玩- PiPhone
台灣樹莓派 <[email protected]>Sep 29, 2014/Raspberry Pi #7
2
● Element14 指定台灣地區 Raspberry Pi 獨家經銷商
about 台灣樹莓派
http://farnell.com/raspberrypi-consumer/approved-retailers.php?region=apac&MER=MER-LM-OB-RPICC-76315
● 專注於 Raspberry Pi 應用與推廣
● 舉辦 Raspberry Pi 社群聚會和工作坊
● Facebook : ● 搜尋 RaspberryPiTaiwan
about 台灣樹莓派
4
● COSCUP, MakerConf 講者
● 投影片 , http://www.slideshare.net/raspberrypi-tw/presentations
● 程式碼 , https://github.com/raspberrypi-tw
分享 x 社群
● David Hunt 用 Raspberry Pi , PiTFT 和 SIM900 GSM/GPRS 組合成一支手機
PiPhone 新聞
http://www.davidhunt.ie/piphone-a-raspberry-pi-based-smartphone/
● Raspberry Pi Model B● Adafruit PiTFT 2.8” Touchscreen● SIM900 GSM/GPRS module● 2000mAh LiPo battery● DC-DC boost converter ● Cables, connectors, switch, etc.● MIC and Speaker
所需硬體
所需硬體
完成圖
● EFCom Pro GPRS/GSM Module(AT commands)● IO List: GND , +5V , RX , TX , PWR , RST.● Quad-Band 850/ 900/ 1800/ 1900 MHz● Power Supply: +5V
GSM 通訊模組
http://goo.gl/7jCgpd
● Adafruit PiTFT 2.8” Touchscreen , 適合 Model B
顯示與觸控
https://www.adafruit.com/product/1601
● 3.7V 鋰聚合物 ( 記得配充電器 )● 升壓模組可將 3.7V 電壓升到 5V
● Input voltage: 3V - 35V● Output voltage: 4 - 35V● Output Current: 3A (MAX)
電源供應
http://www.elecfreaks.com/store/lm2596-dcdc-stepdown-module-bkdc010-p-292.html
● 收發電話 , 傳送簡訊 , GSM/GPRS 狀態
● AT command● 畫畫面 , 互動介面
● Tkinter● 文字輸入
● Xstroke, tegaki
所需軟體
● Hayes command set, for Hayes Smartmodem (1981)● Dialing, hanging up, and changing the parameters of
the connection● AT - "Attention"
AT Command
http://www.elecfreaks.com/wiki/index.php?title=EFCom_Pro_GPRS/GSM_Module
● Pi to Modem : 直接透過 UART(TX/RX)● PC to Modem : 或者用 FT232(FTDI) 轉接板
如何溝通
http://www.elecfreaks.com/wiki/index.php?title=EFCom_Pro_GPRS/GSM_Module
● putty, picocom, minicom● sudo picocom /dev/ttyAMA0 -b 115200 -l
終端機程式
● 基礎類命令● 參數類命令● 擴展類命令
AT Command 速成
http://elecfreaks.com/store/download/datasheet/rf/SIM900/SIM900_AT%20Command%20Manual_V1.03.pdf
● AT<X><n>
● 開啟命令回呼– ATE1
● 關閉命令回呼– ATE0
基礎類命令
● 範例: AT+CEER ( 錯誤報告 )● 測試命令 AT+<x>=?
– AT+CEER=?● 查詢命令 AT+<x>?
– AT+CEER?● 設定命令 AT+<x>=<y>
– AT+CEER=0● 執行命令 AT+<x>
– AT+CEER
擴展類命令
● 寄簡訊
● AT+CMGF=1● AT+CMGS=”0987654321”● Ctrl + Z
● 撥電話
● ATD0987654321;● 掛電話
● ATH● 接電話
● ATA
AT Command 範例
● AT+CSQ # 檢查目前 GSM 信號 (Max 31.99)● AT+CREG? # 查詢目前是否連上網路
● AT+COPS? # 查詢目前連上的 Operator● AT+CLIP=1 # 顯示來電號碼
● AT+GSN # 查詢 IMEI● AT+CMGF=1 # 選擇簡訊顯示為 readable
AT Command 範例
● Python binding to the Tk GUI toolkit● Raspberry Pi 內建 Tkinter 模組
● Layout, widget and event
TKinter
http://oreilly.com/catalog/pythonwin32/chapter/ch20.html
● Model-View-Controller 模式
● View = UI 畫面● Controller = 分派動作● Model = 實際 AT command, 更新 UI 畫面
MVC in Tkinter
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
UI 畫面
AT 命令
分派動作
● 硬體是獨占資源● 如何在電話來時 , 顯示畫面 & 來電號碼?
● 背景跑多執行緒監聽 Serial port● 來電時叫起 UI 並將號碼傳送過去
接電話問題
● 沒有鍵盤輸入 , 只能用觸控輸入
● 螢幕這麼小 (2.8”), 用虛擬鍵盤不適合
● 用手寫輸入
傳送簡訊問題
● Full-screen Gesture Recognition for X
Xstroke 手寫輸入
http://ozzmaker.com/2014/06/17/raspberry-pi-with-stroke-and-gesture-recognition/
● Open-Source Chinese and Japanese Handwriting Recognition
tegaki 手寫輸入
http://tegaki.org/
DEMO
打電話- 查詢網路狀態 / 註冊資料
打電話 - 帶起鍵盤 UI
打電話- 撥通後顯示相關資訊
接電話
接電話 - 任何時候都會帶起來電畫面
● http://www.davidhunt.ie/piphone-a-raspberry-pi-based-smartphone/
● https://github.com/climberhunt/PiPhone
參考資料
Raspberry Pi Rocks the World
Thanks