透過 Arduino 取得 UART HMI 螢幕頁面 ID 然後按需求轉頁
最近因為我在弄一個 60W 的 PD 充電器,然後想弄一個迷你的螢幕來顯示電池的資訊,所以我便選用了一個 2.2寸的 UART HMI 了。 2.2 寸的 UART HMI,比想像中要小一點 選 UART HMI 的原因有很多,網上也有很多文章教你怎樣選合適的螢幕,所以我就不細說了。簡單來說, UART HMI 是一種可以透過 Serial 來控制螢幕載入預先設計好的界面的一種人機界面。 發送指令到螢幕 HMISerial 是 Software Serial。以下 function 把 cmd 內的內容發到螢幕,如果 debugMode 被啟用,側會同步輸出到 hardware serial 上。 SoftwareSerial HMISerial(2, 3); // RX, TX //... void sendCommand(String cmd){ if (debugMode){ //Mirror output to serial Serial.print(cmd); Serial.write(0XFF); Serial.write(0XFF); Serial.write(0XFF); } HMISerial.print(cmd); HMISerial.write(0XFF); HMISerial.write(0XFF); HMISerial.write(0XFF); delay(50); } 使用例子: sendCommand("t0.txt=\"[info] MCU Connected\""); 取得現在 HMI 屏幕正在顯示的 Page ID 如果你把 sendme 指令發到屏幕,屏幕會回傳現在的 page ID 給你,它的回傳信號大約長這樣 66 01 FF FF FF 66 是這個指令的回傳碼,01 是現在的 page ID (即是 page 1),FF FF FF 側是傳送完成的意思,所以我們只需要在 Serial.read() 的時候抓到 0x66 就知道下一個一定是 page ID 了。 int getPageNumber(){ sendCommand("sendme"); bool nextReadIsPageNumber = false; while (HMISerial.available() > 0) { // read the incoming byte: incomingByte = HMISerial.read(); if (nextReadIsPageNumber){ //這是 page ID nextReadIsPageNumber = false; return incomingByte; } if (incomingByte == 0x66){ //下一個出現的 byte 就是 page ID 了 nextReadIsPageNumber = true; } } } 使用例子(檢查現在是否在 page 0(hex: 0x00)) currentPageNumber = getPageNumber(); if (currentPageNumber == 0x00){ //Do something } 成果(Arduino 透過 COM port 輸入到模擬器)
Powerman v6 – 由 Micro USB 升級為 type C 的方法
話說我在一年前完成了一塊叫 Powerman v5r2 的一體式鋰電池充放管理板。它使用 IP5306 來對聚合物鋰電池進行 5V 2A 的充電和 5V 2A 升壓輸出。後來我也有放到 Tindie 上面賣,大約 65港幣一塊。 正面 背面 可是最近因為之前一次性生產的 100 塊存量即將見底,所以在準備下一批的生產過程。而在使用這充電板來做 STEM 套件的時候也收到不少的使用者意見,其中一個不時會聽到的是「不能用 type C 充電嗎?」 就是這樣,就讓我來設計一個能夠使用 type C 充電的設計吧! 要升級成 type C 聽上去很簡單,可是 Raspberry Pi 3 在升級到 4 的 type C 的時候出現過很嚴重的問題(有的甚至把充電器燒壞),所以我們就來看看當時 Pi 4 的初版是怎樣設計的: 這是 Raspberry Pi 4 初代的設計 你看到它 CC1 跟 CC2 是共用一對 5.1K 電阻,可是根據 USB C 的規格書,實際上的做法應該是這樣 由於我們不需要 5V 以上的電壓,我們只需要很簡單的用兩個 5.1K 電阻(Rd 位置) 分別連接 CC1 跟 CC2 再接地就好。 經過一大堆 re-route 之後,我的 Powerman v5 就成功升級成有 type C 的 powerman v6 了
在 Raspberry Pi 上設定 MHS 3.5寸屏幕並啟用 Chromium Kiosk 模式
如果你想快速的做一個 Prototype,通常開發者都會直用 Web Browser 作為 GUI 的首選。但是當去到需要部署在硬體上面的時候,到底要怎樣把整個 Chrome 搬到去 ARM 開發板上面呢? 以下這個一個教學將會記錄我 DIY Rpi DAC 時架設 Chromium 的經歷 選擇屏幕 這個應該不用多說,當然就是最便宜的那個吧!就是這樣,我想也沒想就買了這個 MHS 3.5寸屏幕。 收到後接上 Rpi 4,並安裝好 Raspberry Pi OS LITE (沒有桌面版),之後就是重要的部分了 安裝 xserver 跟 Chromium https://die-antwort.eu/techblog/2017-12-setup-raspberry-pi-for-kiosk-mode/ 跟著這個教學,首先我們需要更新 apt-get sudo apt-get update sudo apt-get upgrade 之後安裝 Xserver 等顯示需要用到的程序庫 sudo apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit openbox -y 最後就是安裝 Chromium sudo apt-get install --no-install-recommends chromium-browser -y 設定 Openbox 並讓它啟動 Chromiuum 。編輯 /etc/xdg/openbox/autostart sudo nano /etc/xdg/openbox/autostart 並在裡面填入以下的東西 # Disable any form of screen saver / screen blanking / power management xset s off xset s noblank xset -dpms # Allow quitting the X server with CTRL-ATL-Backspace setxkbmap -option terminate:ctrl_alt_bksp # Start Chromium in kiosk mode sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State' sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences chromium-browser --disable-infobars --window-size=320,480 --app-shell-host-window-size='320x480' --noerrdialogs --kiosk -app='http://YOUR_URL_HERE/' 這裡因為我的屏幕是 320 x 480的,所以所有 window size 的設定都是 320 x 480。請根據你的屏幕大小作更改。 安裝屏幕驅動 https://github.com/waveshare/LCD-show 安裝 git sudo apt-get install git -y clone 並安裝驅動 git clone https://github.com/waveshare/LCD-show cd ./LCD-show #把下面這行改成你屏幕的規格 sudo ./LCD35-show 如果你需要旋轉顯示角度,用這個指令 #無旋轉 cd LCD-show/ ./LCD35-show 0 #90度 cd LCD-show/ ./LCD35-show 90 #180度 cd LCD-show/ ./LCD35-show 180 #270度 cd LCD-show/ ./LCD35-show 270 測試 xserver…
便攜式冷氣機計劃
這篇文章主要記錄由 2014 年開始到 2018 年的便攜式冷氣機(空調)開發計劃的所有版本及失敗原因。由於此計劃已經完成,現在在此作開源處理。 授權:姓名標示-非商業性-禁止改作 3.0 香港 (CC BY-NC-ND 3.0 HK) Short for PA#, The version number is represented by #. Aim This project aims to design and create the world's first Thermoelectric Plate based portable air cooling devices with a target of handheld and at least 1 hour running time. Budget Limit The budget has been limited to less than 1000HKD per prototype. And the manufacturing price of raw material (excluding shipping) should be lower than 100HKD. The design of PA1 to PA5 did not have any prototype as there are still design problems inside the sketch that made the sketch not possible to manufacture. Reference design sketches are included as reference. PA01 PA02 PA03 PA04 PA04 rev2 PA05 PA06The first success prototype of the Portable Air Conditioner Project. System wiringPA07 The PA07 was similar to PA06 but with more solid casing with cardboard instead of paper cards. Cooling UnitPA08The PA08 was the first prototype for self contained Portable Air Conditioner with standard forward Peltier Design. Internal StructurePA09The portable air conditioner version 9 was the first version that…
ArOZ Online BETA 版開發中
ArOZ Online Alpha 版早在 2016 年就完成並運作好幾個月了。 Alpha 版用起來還算方便但是有很多想要的功能卻沒有,好像說看不到漫畫,傳不了信息還有多多少少很多不同的不方便。於是這樣的話就乾脆把 ArOZ Online 系統改成移動式雲端就好了。你想想看,如果有一個雲端處理系統能夠放在背包裡,然後用手機連上去之後就能夠看到自己的庫存漫畫、動漫、玩到小遊戲、也能夠做基本的文書處理和圖像處理(好像小畫家、筆記本之類的感覺),最重要的是把自己整個音樂庫也帶在這個移動雲端裡面,就不用每次聽歌都要上網到真正的雲端伺服器慢慢的下載下來了。 嘛,想是這樣想,可是要支援所有 OS 和平台的使用者界面…應該就只有 HTML 吧? 於是, ArOZ Online Alpha 這個多媒體串流網站計劃就這樣變成了 BETA 版的移動雲端網站應用系統了。 好吧,到底雲端怎樣移動呢?是要背一台伺服器上街麼?才不啦w 最近不是有那個甚麼 Raspberry Pi Zero W 嗎?這麼迷你的一台東西裡面已經包含了CPU, RAM, USB Port, Storage 之類伺服器需要用的資源了。所以在這裡面 Host 個 Web Server 就可以了吧。   然後再加上一塊聚合物鋰電池,一塊 Micro USB 的 Hub 擴展板,然後兩塊 64GB 的 USB 電路板(對,是要打開 USB 手指裡面把電路板拔出來),把兩塊 USB 做成 RAID 0,那樣就能夠把READ / WRITE 速度 x2了,又或者做成 RAID 1 的話也能更確保資料安全性。不過既然是放音樂、動漫之類不見了也不要緊的東西,當然是 RAID 0 較好用吧。 ArOZ Online BETA (實驗版) 雖然說還在開發中,可是基本上能用的實驗版已經出來了。大致上長這樣子: 全部的 Module 採用 Grid 的型式來顯示,找起來還算方便。每個 Module 也能自定封面和 description text。所以自由度非常大。 延續 ArOZ Online Alpha 版的傳統,ArOZ Online 系統必要有的 Module: 音樂,影片 和 相片 系統。這次的音樂庫做成了 Web App 的形式,在手機上看到這個網站也是跟一般的播放應用程式無異,就是不用安裝直接能用。 (下面的是 ArOZ Online Alpha 版的音樂播放界面)   相片模組的界面也不是變得太多,只是新系統加入了相片管理頁面,能夠把不同時間或是標題的相片分類儲存。 (下面的是舊版) 而影片播放器還沒寫好,所以留待下次更新再寫吧。 在 ArOZ Online BETA 之下新增了不少新的模組,包括有移植自 IMUS 實驗室標淮網頁服務的 Quick Send 和 Q/9 輸入法   新加入的模組就包括了 Home Dynamic (家居自動化控制器)、Manga Cafe (漫畫應用)、ArOZ Chat 、Memo 等 (Manga Cafe 應用) (Memo 牆) 而系統控制模組方面,現在已準備了 Pi DB(輕量化資料庫),Upload Manager (上載 API),Virtual File System,HELP 模組(Read me 收集器)等 (使用了 Upload Manager API 的 Audio Module) (HELP 模組會收集其他模組裡的 READ ME 然後整理顯示出來。) 待更新…        
40000mAh 超大容量聚合物鋰電池開發完成
40000mAh 聚合物鋰電池重制計劃 規格 容量:40000Mah 輸出口:8個 1.5A Max x6 3A (share) x2 IMUS SAB 充電管理器 x4 IMUS Universal Port x1 (v2.0) (與 UP1 不兼容,不提供5V 輸出功能) 嵌入式微控制器:AVR ATtiny24A SSU 五段式電量顯示器 最大充電速度 5v 4A供 5V 輸出 最大放電流量:3.7v 12A (超過的話會激活自動斷電保護)     有關本計劃的開發記錄可見此 pdf 開發記錄
Hyper Charging Power Bank
Project Introduction Power Bank usually output at a Voltage of 5V with current up to 2.1A (MAX), however in some cases, when you want to charge a bit faster, increase the current will not help as most of the devices usually draw up to 1A (MAX). Hence, if you want to charge a bit faster and not afraid of damaging your devices, you can try to use the Hyper Charge approach. Explanation Hyper Charge is just a random name for the technique that rise the voltage of the output USB port by 0.5V to 1V. Hence, the maximum power delivered to the devices will be increased from, for example 5W (5V 1A) to 6W (6V 1A). Hence, the devices should thermostatically charge a bit faster. Gallery [gallery columns="2" size="full" ids="77,78,79,74,75,73,76,80,72"] Wiring Diagram Just for refrence Specification 5V600mA Output Port x1 6V 3A Max Output Port x1 5V 1A Charging Circuit x1 1100 mAh Li-ion Battery x4      
The 20000mAh Power Bank
  Project Introduction Power supply usually is a problem that occurs when you go camping or long period of outdoor activity. The time that this power bank was made, the common power bank volume you can find on the market has a maximum of  10000mAh. That is quite enough for daily uses but not for those who go camping every years. Hence, I made myself a giant power bank with solar charging system. Explanation During camping, there is no electric plug for charging your power bank. Hence, I need to find an alternative sources of power supply which Solar power come into my mind. We all know that Li-ion Battery will lose its stored capacity during unused period. And the solar panel on top was to reduce the energy lose by continuously charging the Battery just to refill its energy lost. Specification 5V 1.2A Output x2 5V 1A Charging Controller x1 5V 150mA Solar Panel x1 3.7V 21000mAh Lithium Ion Battery Universal Charging Port x1 12V Charging Input Male Header (2.1mm)   Universal Charging Port (UCP) is a Standard USB…
The $1 Hologram Screen
Project Introduction Hologram on youtube or instructables are always a hot topic. You can buy those cheap Hologram stand for a few dollars, but actually, you can make your own. Due to the over simple mechanism of this DIY project, I better just post pictures and let yourself to decide how to make it. The back of the Hologram Screen     Side Views with our Old Logo Explanation You can see the thin transparent screen makes a 45 degree angle with the bottom card board. Hence, when you place the mobile phone onto the screen, the light reflects from the screen and create a Hologram like image. You can also change the black background to other image just to look cool. Specification 7 inch 1mm thickness Full transparent Aquatic Sheet   Project Ended in 28/8/2014
目前第 2 頁,共有 2 頁