现在是几奌?几年来我一直在将旧手机重新用作时钟。
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。 这些电线在墙上不起作用。