圖片來源:MxL7704 PMIC Powers the Raspberry Pi 4 樹莓派目前使用中的供電系統是在 3B+ 開始改用的。供電系統的好壞對樹莓派來說是非常重要,一個運作良好的供電系統可以確保整塊板子的各功能運作正常,一旦供電出問題時,可能對板子所有功能造成各種問題,例如 USB、WiFi 功能失效或不正常,最嚴重的慘況就是讓整塊板子完全停擺變成一塊磚頭。 《供電系統之演進》 樹莓派供電系統的演進可以分成三個階段: 《第一階段是 Pi2 以前的供電》 重點提示:這代整體的供電源頭是來自於 Micro USB 5V,再轉換成 3.3V、2.5V、1.8V等部份供給系統上元件使用。 圖片來源:Introducing the Raspberry Pi Model B+ 接著來看看電路圖了解電源是怎開始的。電源從左側MICRO USB TYPE B這接頭端開始,經過 F3 保險絲再來到 D17 TVS(Transient voltage suppressor)及後端的濾波電容。 這樣的電路設計有什麼優點: 電路設計簡單,價錢便宜。 … Continue reading →
除了 Puffin Web Browser 和主打教育市場的 Puffin Internet Terminal 以外,CloudMosa 正在做可以跑在手機上的 Puffin OS ,希望能讓低階手機更為普及,彌平世界數位落差。
Puffin Internet Terminal 是一個瀏覽器的解決方案。能讓 Raspberry Pi 3 Model B+($35)的瀏覽網頁體驗可以媲美要價上千元 ChromeBook,並降低使用網路取得資訊的門檻。
由於學校單位大量使用 Adobe Flash 技術,Puffin Internet Terminal 可以跨平台和跨瀏覽器的特性讓許多教育單位採用。
由於越來越多的應用程式是以網頁(Web)的方式呈現,因此 Puffin Internet Terminal 的高效能也是主打特色之一。Swind 也展示了和 Chromium 的效能比較,是使用 JetStream 做評比,分數越高越好。
要介紹 Puffin Internet Terminal 就直接介紹 Puffin Browser,兩者在架構上是一樣的。Puffin Browser 的架構是,用戶端(Browser)不會直接連到 Web Server,而是透過 Puffin Cloud Server 向 Web Server 做請求,再回傳到用戶端。這樣的技術似乎和 Proxy 很像,但 Proxy 雖然會做快取(cache)或是壓縮,但並不會幫忙做運算,因此傳回到用戶端的資料還是需要用戶端即時運算顯示。這樣的問題是現行的網頁特效很多,如果將運算都移到用戶端,那用戶端的裝置需要在一定的規格以上才能有良好體驗。
所以 Puffin Browser 就像是一個 Remote Browser,幫用戶端在 Puffin Cloud Server 運算完畢後再將運算結果回傳。也因為雲端已經做完運算,等於節省用戶手機上的運算流量,幫沒有網路吃到飽方案的用戶省下費用。
Puffin Browser 能跑得這麼快的第二個原因是歸功於 Puffin Cloud Server 的佈建。CloudMosa 目前有三個資料中心(Data Center),近萬台獨立的中高階實體伺服器與擁有近萬個 Public IP,這樣就可以快速的和全球各地的網頁伺服器進行高速傳輸。
除了架設伺服器做 remote browser 以外,Puffin Browser 可以用資料中心超快的網路去 Web Server 取得資料,還能因此大量減少 Client 與 Server 之間 資料傳輸的次數以及傳輸量,達到快速的回應時間。
而 Puffin Internet Terminal 針對 Raspberry Pi 的優化包括有。
1. 因為效能考量而不使用 Windows 版本正在用的 React Native,改使用 GTK 重新開發。
2. 支援 Raspberry Pi 的 GPU。
大家對於 Puffin Internet Terminal 後端的運作原理非常感興趣,對資源分配與安全性等都提出相關問題。因此 CloudMosa 的 Brian 在 QA 時間也回答了許多技術細節。
Bofu 再利用 YouBike 的演進說明了 Server AI 和 Edge AI 的分別。在過去,所有借還 YouBike 必須要先使用悠遊卡在 YouBike 的基站感應,而該站台會連回雲端主機,有著運算資源充沛、中央控管和容易追蹤各裝置狀況等優點。但也有受到基礎建設的限制或是佈署花費較高等缺點。這樣透過基站來計算處理資訊的方式稱為是 Server AI,也就是 YouBike 1.0。
整個操作情境,可以這樣舉例。如果你有一個手機當作影像的輸入來源,接著在 Raspberry Pi 跑 BerryNet,你就可以很輕鬆的透過可能是 RTSP 的協定將影像接到 Pi 上,並初始化 BerryNet 上的 TensorFlow Lite,決定好儀表板的顯示方式輸出到外接螢幕,如此一來我們就完成一個 BerryNet 的基本設定。
接著我們就可以在螢幕上顯示推論結果(Dashboard),例如物件辨識,將辨認出的物體標記出來。
根據上一個範例,你可以發現使用者很輕鬆的就可以搭建出 AIOT 的應用,當然你會需要先準備一些硬體,包括 Raspberry Pi 和 Pi Camera 等。
如果你不想準備這些硬體與額外的設定,DT42 也在 Kickstarter 發起了 AIKEA 的群幕專案,標的物是是家庭的私有攝影機。但如果你仔細看專案說明,就會知道支持者最後會拿到 Pi 4B 和 Pi Camera 還有一個外盒。這是 DT42 團隊想要表達,使用者不需要花大錢買昂貴的硬體,只要使用手邊的裝置就可以建構出 AIOT 的應用。
很多人拿到 Pi 3B+ 之後會迫不及待的把原本在 Pi 3B 上所使用的 SD 卡拿到 Pi 3B+ 使用,但是會發現無法開機。這是因為 Pi 3B+ 使用新的晶片(BCM2837B0),因此如果沒有安裝 2018-03-13 以後所發布的核心(kernel)或是韌體(firmware)是無法直接使用的。
2018-03-13:
* Raspberry Pi 3 B+ support
* WiFi is disabled until wireless regulatory domain is set (Pi 3 B+ only)
- The domain can be done through 'Raspberry Pi Configuration' (rc_gui),
'raspi-config' or by setting 'country=' to an appropriate ISO 3166
alpha2 country code in /etc/wpa_supplicant/wpa_supplicant.conf.
$ sudo rfkill unblock wifi
$ sudo rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
七月底我們應虎科大電機工程系蔡老師的邀請,帶 Raspberry Pi + Python + Camera 兩天的工作坊。最後會實作”鄉民查水表”功能,是使用 Pi Camera 拍照後,用 OpenCV 做影像處理取得水表指針角度,就可以知道水表目前度數。學生很認真程度也很好,兩天的練習與實做都可以在時間內完成。我們未來也會和虎科大有更多的合作。
The Raspberry Pi is built from commercial chips which are qualified to different temperature ranges; the LAN9512 is specified by the manufacturers being qualified from 0°C to 70°C, while the AP is qualified from -40°C to 85°C. You may well find that the board will work outside those temperatures, but we’re not qualifying the board itself to these extremes.
4. 根據實測,在 -78°C 的低溫下,Raspberry Pi 會停止反應。
圖片來源:geek
5. 除了使用紅外線測溫外,我們還可以使用 /opt/vc/bin/vcgencmd measure_temp 指令來查看 CPU 的溫度。
import RPi.GPIO as GPIO
import time
LED_PIN = 12
GPIO.setmode(GPIO.BOARD)
GPIO.setup(LED_PIN, GPIO.OUT)
try:
while True:
print("LED is on")
GPIO.output(LED_PIN, GPIO.HIGH)
time.sleep(1)
print("LED is off")
GPIO.output(LED_PIN, GPIO.LOW)
time.sleep(1)
except KeyboardInterrupt:
print "Exception: KeyboardInterrupt"
finally:
GPIO.cleanup()
如果在 Raspberry Pi 2 (2015-01-31 版本)執行這段程式碼會出現以下訊息:
pi@raspberrypi ~ $ sudo python led_blink.py
Traceback (most recent call last):
File "led_blink.py", line 1, in
import RPi.GPIO as GPIO
RuntimeError: This module can only be run on a Raspberry Pi!
現在的 3G/4G 網卡(或稱為 USB 數據機)大多同時有儲存設備和 USB 數據機的功能,其中儲存設備功能存放 MS Windows 的驅動程式,USB 數據機就是可撥號連線接取上網際網路。
如果是第一次將 3G 網卡插在安裝了 Windows 系統的電腦上,網卡將會以虛擬光碟機的模式掛載成儲存設備,並且自動安裝驅動程式。當完成安裝後就可用虛擬光碟機轉換工具(Virtual CD-ROM switching utility)或稱為模式轉換工具,正確轉換網卡為 USB 數據機。
如果要在 Raspberry Pi 上使用 3G/4G 網卡上網,要做的事就是安裝設定模式轉換工具與安裝設定撥號連線程式。步驟如下:
1. 確認硬體資訊。
當插上 E1820 時,可以看到系統可辨認成 HSPA modem。
pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
... skip ...
Bus 001 Device 008: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552/E1800/E173 (HSPA modem)
... skip ...
pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
... skip ...
Bus 001 Device 007: ID 12d1:14ac Huawei Technologies Co., Ltd.
... skip ...
Raspberry Pi 有提供原生的序列(Serial)傳輸介面,因此只要透過 USB 轉 TTL 序列傳輸線,就可以在不需要螢幕和鍵盤滑鼠的情況下登入 Raspberry Pi (預設帳號密碼是 pi/raspberry),連上的虛擬終端機為 ttyAMA0。
序列傳輸介面至少需要有三條線,包括接地(GND)、接收(RX)和傳送(TX),參考接線圖如下。 本 Raspberry Pi B+ GPIO 腳位圖獲得授權使用
注意:
1. 目前 PL2303HX 僅支援 Windows XP/Vista/7 和 Linux 使用,如果是 Windows 8 和 Mac 作業系統,需使用 PL2303HXD 才能正常使用。
2. 安裝 USB 轉 TTL 傳輸線設定時,Raspberry Pi 不需要開機。但是完成安裝後,記得要將 Raspberry Pi 開機,才能透過該序列傳輸線連接。
Windows XP
1. 沒有接上 USB 轉 TTL 序列傳輸線時的裝置管理員。
2. 接上 USB 轉 TTL 序列傳輸線時的裝置管理員,一開始會跳出”歡迎使用尋找新增硬體精靈”。我們先暫時忽略這訊息並下載驅動程式吧。
pi@raspberrypi:~$ netstat -nutlp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:6002 0.0.0.0:* LISTEN 2124/Xtightvnc
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:5902 0.0.0.0:* LISTEN 2124/Xtightvnc
udp 0 0 0.0.0.0:22316 0.0.0.0:* -
udp 0 0 0.0.0.0:68 0.0.0.0:* -
udp 0 0 192.168.1.2:123 0.0.0.0:* -
udp 0 0 127.0.0.1:123 0.0.0.0:* -
udp 0 0 0.0.0.0:123 0.0.0.0:* -
我們也可以用 ps 這個指令查看目前系統執行的程序中。
pi@raspberrypi:~$ ps aux | grep vnc
– a :不和終端機 (terminal) 有關的所有程序
– u :所有有效使用者 (effective user) 的程序
– x :與 a 這個參數一起使用可列出完整資訊
– | grep vnc 表示只列出有包含 vnc 關鍵字的程序
pi@raspberrypi:~$ ps aux | grep vnc
pi 2124 0.0 0.9 6532 3460 ? S 14:36 0:03 Xtightvnc :2 -desktop X -auth /home/pi/.Xauthority -geometry 640x480 -depth 8 -rfbwait 120000 -rfbauth /home/pi/.vnc/passwd -rfbport 5902 -fp /usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,/usr/share/fonts/X11/100dpi/ -co /etc/X11/rgb
pi 2128 0.0 0.1 1760 508 ? S 14:36 0:00 /bin/sh /home/pi/.vnc/xstartup
pi 2426 0.0 0.2 3548 800 pts/0 S+ 15:44 0:00 grep --color=auto vnc
pi@raspberrypi:~$ sudo vim /etc/init.d/tightvncserver
內容如下,重要的是在 start) 部份設定啟動的參數。
#!/bin/bash
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: vnc server
# Description:
### END INIT INFO
export USER='pi'
eval cd ~$USER
# Check the state of the command - this'll either be start or stop
case "$1" in
start)
# if it's start, then start vncserver using the details below
su $USER -c '/usr/bin/vncserver :1 -geometry 800x600 -depth 16 -pixelformat rgb565'
echo "Starting vncserver for $USER "
;;
stop)
# if it's stop, then just kill the process
pkill Xtightvnc
echo "vncserver stopped"
;;
*)
echo "Usage: /etc/init.d/tightvncserver {start|stop}"
exit 1
;;
esac
exit 0
sosorry@ubuntu:~/rpi$ cd linux
sosorry@ubuntu:~/rpi/linux$ git checkout rpi-3.10.y
6. 讀取目前 Pi 的核心設定,假設 Pi 的 IP 為 192.168.1.2。
sosorry@ubuntu:~/rpi/linux$ make mrproper
CLEAN scripts/basic
CLEAN scripts/kconfig
CLEAN include/config include/generated
sosorry@ubuntu:~/rpi/linux$ scp pi@192.168.1.2:/home/pi/.config .
sosorry@ubuntu:~/rpi/linux$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- oldconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --oldconfig Kconfig
*
* Restart config...
*
*
* ALSA for SoC audio support
*
ALSA for SoC audio support (SND_SOC) [M/n/?] m
SoC Audio for the Atmel System-on-Chip (SND_ATMEL_SOC) [N/m/?] n
SoC Audio support for the Broadcom BCM2708 I2S module (SND_BCM2708_SOC_I2S) [M/n/?] m
Support for HifiBerry DAC (SND_BCM2708_SOC_HIFIBERRY_DAC) [M/n/?] m
Support for HifiBerry Digi (SND_BCM2708_SOC_HIFIBERRY_DIGI) [N/m/?] (NEW)
Support for RPi-DAC (SND_BCM2708_SOC_RPI_DAC) [M/n/?] m
Support for IQaudIO-DAC (SND_BCM2708_SOC_IQAUDIO_DAC) [N/m/?] (NEW)
Synopsys I2S Device Driver (SND_DESIGNWARE_I2S) [N/m/?] n
Build all ASoC CODEC drivers (SND_SOC_ALL_CODECS) [N/m/?] n
ASoC Simple sound card support (SND_SIMPLE_CARD) [N/m/?] n
#
# configuration written to .config
#
7. 以選單方式選取所需要的功能。
sosorry@ubuntu:~/rpi/linux$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
8. 編譯核心(k, –keep-going)。
sosorry@ubuntu:~/rpi/linux$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -k V=1
9. 安裝核心模組。
sosorry@ubuntu:~/rpi/linux$ mkdir ../modules
sosorry@ubuntu:~/rpi/linux$ make modules_install ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=../modules/
10. 使用內建的工具產生出 Raspberry Pi 的核心(kernel.img)。
sosorry@ubuntu:~/rip/linux$ cd ~/tools/mkimage
sosorry@ubuntu:~/rpi/tools/mkimage$ ./imagetool-uncompressed.py ~/rpi/linux/arch/arm/boot/zImage"
11. 將 kernel、firmware、lib 安裝到 Pi 上(假設 SD 卡已經 mount 在 ~/sdb1 和 ~/sdb2)。
sosorry@ubuntu:~/rpi$ vi ~/.bashrc
export PATH=$PATH:/home/sosorry/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin # add this line at the end of file
4. 測試。先開啟一個新的終端機,輸入 arm 後連續按兩次 tab 鍵,如果跑出來一堆像下面的提示表示安裝成功。
This repository contains the source code for the ARM side libraries used on Raspberry Pi. These typically are installed in /opt/vc/lib and includes source for the ARM side code to interface to: EGL, mmal, GLESv2, vcos, openmaxil, vchiq_arm, bcm_host, WFC, OpenVG.
Use buildme to build. It requires cmake to be installed and an arm cross compiler. It is set up to use this one: https://github.com/raspberrypi/tools/tree/master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian