現在是幾奌?幾年來我一直在將舊手機重新用作時鐘。
Android 2.2.2 - Froyo. This one still going, its sibling has failed. And more recent phones have failed.Android 2.2.2 - Froyo. This one still going, its sibling has failed. And more recent phones have failed.Android 2.2.2 - Froyo. This one still going, its sibling has failed. And more recent phones have failed.Android 2.2.2 - Froyo. This one still going, its sibling has failed. And more recent phones have failed.Android 2.2.2 - 弗羅約。 這個還在繼續,它的兄弟已經失敗了。 最近的手機也出現了故障。
有兩個剛剛失敗。 這是最後一個運行的......良好的硬件。 非常舊的操作系統,但仍然可以從網絡上獲取時間,並且當我們切換到白天時間並返回時仍然會更新。
所以我需要更換它們,我開始考慮 Arduino 和 Raspberry,並偶然發現了 ESP32。
Quarter inch squares, this is about 25cm x 50cmQuarter inch squares, this is about 25cm x 50cmQuarter inch squares, this is about 25cm x 50cmQuarter inch squares, this is about 25cm x 50cm四分之一英寸的正方形,約為 25 厘米 x 50 厘米
這是來自樂鑫我在亞馬遜買了這個,3個17美元。 到目前為止,我已經嘗試過閃爍 LED 和使用內置 WIFI 硬件。 是的,WIFI、藍牙、大量 I/O 引腳、4M rom 和 512K ram(我認為。還沒有探索得足夠遠,無法確定。)在此過程中,我運行了 NTP(網絡時間協議)示例並開始想知道NTP 是如何工作的。
從本質上講,NTP 非常簡單。 想要知道時間的計算機向託管 NTP 服務器的另一台計算機發送一條短消息,然後該計算機發回一條包含 GMT 時間的短消息。 完畢。
(情況要復雜得多;顯然 NTP 服務器可能會回答這個問題 1000 次第二! 同步服務器的機制使用統計數據。 David L Mills 在 1980 年左右發明了 NTP 東西.)
互聯網主要使用TCP (傳輸控制協議) ,一種構建在 IP 之上的強大協議。 TCP 重試等,以確保數據按順序完整傳送。 它是一個重量級協議。 NTP 服務器使用輕量級協議 UDP(也在 IP 之上),它不提供任何保證。 您的消息可能會丟失、永遠不會到達、無序到達。 但服務器上的負載很小;服務器不需要進行任何額外的握手來確保您得到答案。 UDP中的U (用戶數據報協議)意味著用戶負責處理錯誤。
此 JSL 創建一個套接字以使用端口 123(NTP 端口)和 UDP 協議將消息發送到 NTP 服務器池並獲取響應。 它做了一些非常簡單的事情統計數據數學假設往返服務器的旅行時間相等,因此服務器的時間可以更好地與本地計算機同步。 結果還不錯! 這是一個比平均水平稍好一些的示例,它在地球另一端的池中找到了一台服務器:
pool.ntp.org(rn5.quickhost.hk)
總時間 = 0.143846988677979
飛行時間 = 0.143799781799316
差異 = 0:00:00.01689
假設 .hk 確實位於香港,距離北卡羅來納州 8,000 英里。 16,000 往返。 飛行時間是總時間減去在香港的處理時間,這個時間可以忽略不計。 如果我沒算錯的話,速度超過 100,000 英里/秒,是光速的很大一部分。
最後一個數字,差值,是我的 CPU 時鐘和 NTP 服務器時鐘之間的差值。 不到 1/50 秒。 我在 1/10 秒內從大多數服務器獲得結果,除非飛行時間很長,在這種情況下它是不對稱的並且校正技術會崩潰。
pool.ntp.org(LAX.CALTICK.NET)
總時間 = 0.101963043212891
飛行時間 = 0.101903915405273
差異 = 0:00:00.08646
pool.ntp.org(ns2.nuso.cloud)
總時間 = 0.103617668151855
飛行時間 = 0.103596687316895
差異 = 0:00:00.04034
pool.ntp.org(50-205-57-38-static.hfc.comcastbusiness.net)
總時間 = 0.0763883590698242
飛行時間 = 0.0763206481933594
差異 = 0:00:00.00965
pool.ntp.org(13.86.101.172)
總時間 = 0.077089786529541
飛行時間 = 0.07708740234375
差異 = 0:00:00.00663
// this snippet demonstrates a UDP (User Datagram Protocol) exchange with an NTP
// (Network Time Protocol) server using a JSL socket. NTP sends enough information
// from an NTP server to correct for some network delays and make a really good guess
// at the local time, possibly within 1/100 second, usually within 1/10 second (depending
// on how similar send and receive times are.) Using the OS time setting to sync your
// clock first (which uses NTP as well) will make the deltas near zero. Otherwise the
// deltas should be similar across several runs. Your computer clock will drift between
// the syncs (once a day?) that your computer automatically performs with an NTP server.
//
// idea from https://lettier.github.io/posts/2016-04-26-lets-make-a-ntp-client-in-c.html
timezone = -4; // (tz for my computer) Eastern Daylight Time is GMT-4.
// build the transmit packet to send to the NTP server
xPacket = Hex To Blob( "1b" || Repeat( "00", 47 ) );
// make the socket object
sock = Socket( DGRAM ); // not a normal STREAM socket, this is an unreliable UDP socket.
// choose a server (or server pool)
addr = "pool.ntp.org"; // a pool of servers. Don't ask too often, they have a heavy load.
// if nothing goes wrong, the bind and ioctl are optional, but
// if we never get a response (for various reasons) we'd rather not hang forever...
rc = sock << bind( addr, "123" ); // bind, maybe not required, but needed for NBIO...
If( rc[2] != "ok",
sock << close;
Throw( "bad bind" );
);
rc = sock << Ioctl( FIONBIO, 1 ); // NBIO: non blocking i/o. the unreliable UDP may never answer.
If( rc[2] != "ok",
sock << close;
Throw( "bad ioctl" );
);
// send our request to the server. <<SENDTO is="" for="" unreliable="" udp="" packets.=""></SENDTO>

使用 UDP 套接字從 NTP 服務器獲取時間。
回复: 現在幾點了?在訂購 PCB 的第 2 版之前,我正在根據第一個訂單構建另外兩塊板。 與第一個類似,但同時構建一點並進行測試。 我學到了一些我意想不到的東西。
構建階段看起來像這樣:
- 將所有薄型、小型、廉價的元件放在板上。 他們以後很難做到。
- 添加 LED 驅動器、三個 16 引腳 IC。
- 添加電源組件並查看電源指示燈 LED 是否亮起。
- 添加CPU,確保它接受下載的程序。
- 添加另一側的數字。 數字隱藏了一些東西,所以它們必須放在最後。
Some of these prototypes are not working correctly.Some of these prototypes are not working correctly.Some of these prototypes are not working correctly.Some of these prototypes are not working correctly.其中一些原型無法正常工作。這些數字(其中四個)價格適中,而且有些脆弱。 我隨機放置了一個(小時一位置)並做了一個快速測試。 只有某些部分有效。 回到工作台,目視檢查,儀表檢查,最後拉出瞄準鏡。 此時,有六處可能是錯誤的;從CPU到驅動IC再到數字的任何東西。 這不是基本設計;而是。我有兩個工作原型(一個在麵包板上,一個在第一個 PCB 上。)
時鐘採用複用設計;每個驅動芯片有四個輸出。 其中一個驅動程序選擇一個數字,另外兩個驅動程序選擇七個段和一個小數點。 32 個元素的 4X8 矩陣,由 12 位尋址。 一次最多可以打開八個元件(一位數)。 幸運的是,我正在查看一個應該擁有大部分段的數字,並且我看到屬於一個驅動器芯片的所有缺失段。 使用該芯片上的示波器,我看到輸入正在請求段打開,但輸出......死了。
更換IC是件痛苦的事。 我從管子裡抓起一根新的,安裝好,然後……真糟糕! 好多了,但是有一段還是看不出來! 難道是我誤診了? 還有什麼東西在崩潰嗎?
等待。 我正在並行構建兩張卡。 我們再看看另外一個。 沒有什麼。 沒有段。 經過一番研究...嗯。 這次的問題不是段的驅動程序,而是矩陣中其他軸(選擇數字的軸)的驅動程序。 我有一整管壞IC嗎?
這是一管未使用過的 IC,大約 10 年前為另一個項目購買的。 我需要構建一個測試器。 這是測試儀,顯示我最近從不同經銷商處獲得的芯片的四個綠燈。
All 10 in the newer tube checked out good.All 10 in the newer tube checked out good.All 10 in the newer tube checked out good.All 10 in the newer tube checked out good.新試管中的所有 10 個都檢查良好。
我目前相信另一管中至少有 5/10 的芯片在一個或多個輸出上是壞的:
Crush the pins in (to prevent re-use) and roll them on their backs so they look like dead bugs. Even 3/4 OK is not good enough when all four outputs are needed!Crush the pins in (to prevent re-use) and roll them on their backs so they look like dead bugs. Even 3/4 OK is not good enough when all four outputs are needed!Crush the pins in (to prevent re-use) and roll them on their backs so they look like dead bugs. Even 3/4 OK is not good enough when all four outputs are needed!Crush the pins in (to prevent re-use) and roll them on their backs so they look like dead bugs. Even 3/4 OK is not good enough when all four outputs are needed!將別針壓碎(以防止重複使用)並將它們捲起來,使它們看起來像死蟲子。 當需要所有四個輸出時,即使 3/4 OK 也不夠好!
我學到的可能是在安裝之前測試芯片,但我認為這並不是真正需要的。 但我要做的是使用示波器進行測試,可能會顛倒組件中的第 2 項和第 3 項,這樣我可以在附加數字之前進行更好的測試。 然後,為了放置第一個數字,選擇一個阻止電源的芯片,而不是驅動芯片。 現在我必須刪除一個數字,以便刪除驅動器 IC。
回复: 現在幾點了?原型已建成並正在運行。
It's hard for me to call this the back; it was the front in KiCad.It's hard for me to call this the back; it was the front in KiCad.It's hard for me to call this the back; it was the front in KiCad.It's hard for me to call this the back; it was the front in KiCad.我很難把這稱為背面;這是 KiCad 的正面。
The flash makes the white balance show the red digits as red.The flash makes the white balance show the red digits as red.The flash makes the white balance show the red digits as red.The flash makes the white balance show the red digits as red.閃光燈使白平衡將紅色數字顯示為紅色。
With no flash, the white balance messes up the colors, but this is closer to what it really looks like otherwise.With no flash, the white balance messes up the colors, but this is closer to what it really looks like otherwise.With no flash, the white balance messes up the colors, but this is closer to what it really looks like otherwise.With no flash, the white balance messes up the colors, but this is closer to what it really looks like otherwise.在沒有閃光燈的情況下,白平衡會弄亂顏色,但這更接近實際情況。
線性穩壓器運行非常熱; 5V 穩壓器可提供約 1/4 安培的電流,但這意味著 16V 輸入電壓會降低 11 伏 * 1/4 安培 = 近 3 瓦,進入那個微小的散熱器。 是時候考慮一下替代開關模式穩壓器了。 顯然封裝尺寸相同,但效率高達 90%。
回复: 現在幾點了?電路板來了! 設計與凱德,由製造職業健康公園,20 天,包括 11 天的製造時間和 8 天的免費送貨(盡可能節省!)在我知道它們有效之前,可能不應該展示這些......原型......
This is my first board that will have components front and back.This is my first board that will have components front and back.This is my first board that will have components front and back.This is my first board that will have components front and back.這是我的第一塊板,正面和背面都有組件。
邊緣周圍的粗糙點是我的板從更大的面板上折斷的地方;我很快就會清理它們,它們很尖! 木板尺寸約為 3x9 英寸。 我正在使用通孔技術;所有表面安裝位都將位於預構建卡上(GPS、BME 和 ESP32)。 儘管時間有點長,但我還是選擇了 AfterDark 板。 我喜歡這個樣子! 初步測試表明,我設計的足蹟的部件能夠正常工作。 耶!
回复: 現在幾點了?更新...最右邊的藍燈是esp32。 現在是下午 4:05。
It's really hard to get the light right to take a picture of an LED display.It's really hard to get the light right to take a picture of an LED display.It's really hard to get the light right to take a picture of an LED display.It's really hard to get the light right to take a picture of an LED display.找到合適的光線來拍攝 LED 顯示屏的照片確實很困難。
2 1/4 英寸高的數字需要 8 伏,而不是舊數據表建議的 2 伏。 這意味著我需要右上角的額外電源,由垃圾箱零件製成,並且 4 個驅動芯片來自同一個盒子。 右下角還有一個 12 美元的 GPS。 如果可以看到一些衛星,則可以通過 GPS 設置時間;如果密碼未更改,則可以通過 WiFi 設置時間。
還不確定 JMP 在哪裡適合這個,但我有一個我想添加的壓力/溫度/濕度傳感器。也許它會做一些數據記錄並運行網絡服務器。 或者也許我會添加一個小天氣顯示器。 細節確定後,我將製作 PCB。 這些電線在牆上不起作用。