This is only a preview of the June 2023 issue of Silicon Chip. You can view 38 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Basic RF Signal Generator":
Items relevant to "Loudspeaker Testing Jig":
Items relevant to "WiFi Time Source for GPS Clocks":
Items relevant to "Wideband Fuel Mixture Display, Pt3":
Items relevant to "Servicing Vibrators, Pt1":
Purchase a printed copy of this issue for $11.50. |
WiFi
Time Source for GPS Clocks
The Raspberry Pi Pico W can be used as a substitute for GPS
modules in existing time keeping designs, for when you can’t get a
reliable GPS signal. It gets the time from an internet NTP server via
WiFi and is accurate to a fraction of a second.
Project by Tim Blythman
S
ince GPS modules have been
affordable for the hobbyist, we
have used them as accurate time
sources. While GPS (and other similar satellite systems) has revolutionised navigation and mapping, it also
provides easy global access to highly
accurate time sources.
Each GPS satellite is equipped with
two atomic clocks and they transmit
a very accurate time signal every second. We have used that signal for many
projects to date, including the recent,
very popular GPS Analog Clock Driver
from September 2022 (siliconchip.au/
Series/391).
While GPS was the first GNSS
(global navigation satellite system),
there are now several more, including the Russian GLONASS, European
Galileo and Chinese Beidou systems.
The Indian Regional Navigation Satellite System (IRNSS) and Japanese
Quasi-Zenith Satellite System (QZSS)
are designed to improve positioning on
a national scale, with the QZSS also
benefiting Australia as the satellites’
orbits bring them over us.
While they use subtly differing technologies (even GPS has evolved over
its 50-year existence), a common external interface has been established. In
fact, the VK2828U7G5LF GPS module that we use for many projects can
receive signals from GPS, GLONASS
and Galileo satellites.
For the purposes of this article, we’ll
use GPS as an encompassing term for
all the different navigation satellite
systems. However, note that some of
these systems are not truly global, as
the satellites do not usually provide
coverage at high latitudes (close to
the poles).
Previous GPS Time Source
In the April 2018 issue, we published the Clayton’s GPS Time Source
(siliconchip.au/Article/11039). As the
name suggests, it doesn’t use any GPS
What projects does it work with?
New GPS-Synchronised Analog Clock, September 2022; siliconchip.au/Article/15466
GPS-Synchronised Analog Clock, February 2017; siliconchip.au/Article/10527
High-Visibility 6-Digit LED GPS Clock, December 2015 – January 2016; siliconchip.
au/Series/294
6-Digit Retro Nixie Clock Mk2, February – March 2005; siliconchip.au/Series/282
6-Digit GPS-Locked Clock, May – June 2009; siliconchip.com.au/Series/37
60
Silicon Chip
Australia's electronics magazine
technology, but rather it can be used as
a source of GPS-like time signals when
an actual GPS signal is unavailable. It’s
often recommended as a replacement
for a GPS module in clock projects.
The motivation for this concept was
driven by many clocks being used
indoors, where very weak GPS signals are hard to receive. On the other
hand, WiFi signals are usually available indoors.
The actual hardware of the 2018 unit
is simply a D1 Mini WiFi ESP8266
microcontroller module. The module
is programmed with firmware to connect to a WiFi network and update an
internal clock from the internet using
NTP (network time protocol).
This time is then used to generate ‘sentences’ to communicate that
time. A 1PPS signal is also generated,
although this signal will not have the
precision of an actual GPS module.
Pico W update
This project is an update of the original Clayton’s GPS but using a Raspberry Pi Pico W instead of a D1 Mini.
While we could have refactored the
same code for the Pico W GPS, there
are several reasons why we did not.
We have had many suggestions for
improvements over the last five years,
siliconchip.com.au
WiFi Time Source Features
Delivers NMEA 0183 data simulating
a GPS time source
Adjustable baud rate
3.3V logic levels work with 3.3V and
5V systems
Synthesised 1PPS signal
Gets the time from NTP servers
via WiFi
Generates estimated latitude and
longitude based on IP address
Can also output fixed dummy
coordinates
Can scan for up to eight WiFi
networks (SSIDs)
Configurable via virtual USB serial
port, independent of data stream
Uses a compact & low-cost
Raspberry Pi Pico W module
Integrated buck/boost converter
runs efficiently from 1.8-5.5V
Crystal oscillator offers better than
30ppm accuracy between updates
Draws 50mA, or up to 100mA during
WiFi transmissions (3.0V supply)
so it made sense to incorporate them
where possible.
We’ve chosen to use the C SDK as
we found it gave us better access to
low-level functions and programs run
more quickly. Some of the new features were possible (and much easier
to implement) due to aspects of the C
SDK and its software libraries.
There is no doubt that the Pico W is
very well priced, making it an attractive option when the module is all or
most of the hardware required. Indeed,
it is cheaper than the GPS module it
can replace. But particular features of
its RP2040 microcontroller helped us
to create the WiFi Time Source.
For example, it can implement a
virtual USB serial port, meaning that
the configuration menu is separate
from the NMEA data stream (National
Marine Electronics Association). Due
to the nature of the serial port on the
D1 Mini, these were shared on the
Clayton’s GPS, so using the configuration menu interrupted the data
stream.
The Pico W also implements a virtual USB drive for flash memory programming. Some people had difficulty uploading to the flash memory
to the D1 Mini for various reasons. For
example, it requires either a dedicated
siliconchip.com.au
programming application or the Arduino IDE for programming.
On the other hand, the Pico W can
be flashed by just about any computer
with a USB port. The process is as
simple as copying the file to the virtual USB drive.
The RP2040 processor on the Pico
W has two cores, so one can be dedicated to sending out the NMEA data
and not be blocked by activity on the
other core, which handles the configuration and WiFi connections.
The Pico W also has an onboard
switchmode regulator that’s more efficient than the linear regulator found
on the D1 Mini. Some readers reported
problems powering the D1 Mini, so it is
a welcome upgrade. It not only reduces
the current requirement at higher supply voltages but also enables operation
from supplies as low as 1.8V.
Like the earlier time source, the
WiFi Time Source emits three NMEA
sentences: “RMC” (recommended
minimum data for GPS), “GGA” (Fix
information) and “GSA” (satellite
data).
Most of our GPS clock designs only
use the RMC sentence, with some also
using GGA. So this data is entirely adequate for driving those clocks.
NMEA sentences
Practically all GPS modules deliver
data generally in accordance with the
NMEA 0183 standard. The standard
actually specifies 4800 baud serial data
using a balanced signal complying
with the RS-422 electrical standard.
The newer NMEA 2000 standard
uses a CAN bus network at 250kiB
per second. The full contents of this
standard are not publicly available, so
the simpler NMEA 0183 is still widely
used, as it is well understood.
Most receivers nowadays use single-
ended logic level signals (typically
3.3V) with baud rates of 9600 or even
higher. Many modules also offer a
1PPS (pulse per second) signal that is
synchronised to the satellite atomic
clocks.
The serial data consists of lines of
ASCII characters called sentences. For
our purposes, each sentence is marked
at the start by a “$” character, followed by two characters that identify
the ‘talker’. This is typically “GP” for
GPS systems, although we have seen
some modules that use “GN” where
data from multiple satellite systems
are combined.
Australia's electronics magazine
The next three characters identify the type of message, followed by
sentence-specific data and a checksum
code to provide a degree of protection
against corrupted data.
The most common sentences that
encode the time also contain location
data, so the WiFi Time Source can produce dummy location data or even use
an IP address geolocation data service
to generate an approximate location.
In any case, it’s a good idea to generate
such data in case the receiving device
expects there to be valid data in this
location, even if it is not used.
This approximation will never be
good enough for navigation purposes.
Still, it is usually sufficient to determine a timezone, which is ideal for
those clocks that use GPS location data
for this purpose.
For example, the High Visibility
6-Digit LED GPS Clock from December
2015 and January 2016 (siliconchip.
au/Series/294) uses location data to
set the time zone and daylight savings
rules automatically.
With most of our GPS projects using
the GPS signal for clock timekeeping,
the WiFi Time Source is well-suited
for use with indoor clocks, where they
may not have a view of the sky and
thus to a GPS signal, but can easily be
connected to a WiFi network.
Hardware
The WiFi Time Source hardware
is minimal. The dashed box in Fig.1
shows the pinout of the Pico W after
it has been programmed. The remainder of Fig.1 shows the full map of all
the pins with their features.
As you can see, we’ve kept all the
useful pins at one end. It would have
been nice to be able to shorten the
board by cutting off unnecessary section. Unfortunately, the entire board
is needed and it can’t be made much
smaller, especially as the WiFi antenna
is at the end opposite the USB connector.
The power pins are fixed on the
right-hand side, near the USB connector. These are pin 40 (VBUS), pin 39
(VSYS) and pin 38 (GND). There are
actually several GND pins (see Fig.1),
but pins 3 and 38 are closest to the
other important pins.
Pin 37 (3V3_EN) is an input to the
regulator on the Pico W; this is kept
high by a 100kW resistor but can be
pulled low to shut down the regulator
and thus power off the Pico W.
June 2023 61
Pins used for the WiFi Time Source
Fig.1: the pins on the Pico W that can be used for the WiFi Time Source are shown in the dashed red box. Pin 1 (GP0) is
the closest UART TX pin to the USB end of its PCB and is also near the relevant power pins. You probably won’t need all
the connections shown here for most clock projects (see Figs.3-6); three or four connections are often sufficient.
Pin 1: serial NMEA data; pin 2: 1PPS signal; pin 3: ground; pin 36: 3.3V; pin 37: 3.3V enable (active high); pin 38:
ground; pin 39: 1.8V to 5.5V in; pin 40: USB supply.
Pin 1 (GP0) is the source of the generated NMEA serial data, which idles
at a 3.3V logic high level.
The Pico W’s hardware UART (universal asynchronous receiver/transmitter) peripherals are only available
on specific pins. This pin was chosen
as it is the UART TX pin closest to the
USB connector and the power pins. We
selected the adjacent pin 2 (GP1) for
the 1PPS output; it could have been
any of the remaining GPIO pins.
We’ve shown the 3.3V output only
because it might be handy if you need
a regulated 3.3V supply for your project. The regulator on the Pico W can
deliver up to 2A, although some of that
is used by the Pico W.
Fig.2 shows the power circuitry of
the Pico W and will help you decide
how to connect the WiFi Time Source
in your circuit.
Most people will simply need to
connect a supply between the VSYS
and GND pins. But note that there is
a diode between VUSB and VSYS, so
if a USB cable is connected, it might
feed into VSYS, particularly if VSYS
is less than the 5V from USB.
Unless you can be sure you won’t
connect anything to VSYS while power
is applied to VUSB (for example, via
62
Silicon Chip
the USB socket), the safest option will
be to connect the incoming supply
to VSYS via a schottky diode, which
will prevent current from passing from
VBUS into your supply.
Given that most people will use the
USB port to program, configure and
test the Pico W, the easiest solution
is to disconnect the USB cable before
connecting to the target circuit. In that
case, direct connections to the Pico W
pins will be fine.
Later on, we’ll also show you how
to connect the WiFi Time Source to
some of our recent clocks.
Software development
The Raspberry Pi C SDK is still
evolving, especially the parts of it that
deal with the WiFi features of the Pico
W. But it is well documented, and
interest is sufficient that the online
community is also very helpful.
So, we ran into some minor difficulties during development, but we
managed to work around them. We
used version 1.5.0 of the SDK; versions before 1.4.0 did not support the
Pico W and later versions might differ.
As we noted, the Pico W has two
processor cores. One of these (the second core) is programmed to do nothing
Australia's electronics magazine
more than generate the NMEA data
and 1PPS pulses. This is crucial as we
found that the D1 Mini (as used in the
2018 time source) would occasionally
block (be busy and not be able to run
other parts of its program) during WiFi
operations.
By setting up one core to do the critical activity, the WiFi Time Source
can continue to operate, even in the
extreme event that one processor core
crashes entirely. This core can even
reset the Time Source under some
conditions.
When a reset happens, some data is
stored in RAM to preserve the current
time across the reset. This is possible
as RAM remains powered during the
soft reset process.
We saw very occasional crashes (and
reset recovery) when the Time Source
had been active for long periods, but
this should not be an issue for operation with the recent GPS clocks, as
the Time Source should only be powered long enough to set the time, after
which it is powered off.
This second processor core looks at
the current time and calculates what
the time will be when the next second
rolls over. It then prepares all its data
to suit this next second. As soon as the
siliconchip.com.au
Fig.2: the power supply circuit of the Pico W, shown here in case you wish to adapt the WiFi Time Source to a different
application. For example, consider adding a diode feeding into VSYS to prevent VBUS power from feeding into your
power supply if a USB cable is connected.
second rolls over, the data is sent, and
the 1PPS signal is pulsed.
This means that the NMEA data and
1PPS pulses are delivered with minimal jitter. Providing the output as the
second rolls over means that the fractional data can be ignored, simplifying the code slightly, both for us and
potentially for any device receiving
that data.
The other core has the vital role of
periodically getting an accurate value
for the time and collecting the other
data that is needed. One of these is a
‘validity’ flag, equivalent to the GPS
‘satellite lock’ that should always be
checked to ensure valid data is being
received.
The Pico W implements an internal 64-bit counter with microsecond
resolution. This counts up from zero
when the processor starts or is reset.
The documentation jokes that (in
the vein of the Y2K or Millennium
Bug) this will eventually cause a year
5851444 bug.
Such bugs typically occur when a
counter rolls over beyond its maximum value. While we are not too concerned about this particular counter,
we need to be aware of a few other
such bugs. We have a separate small
article starting on page 70 that explains
these ‘gotchas’.
The main role of the software running on the first core is to fetch an accurate timestamp from the NTP servers.
This timestamp is compared with the
current value of the 64-bit counter, and
an offset is used to calculate the actual
siliconchip.com.au
time (at any time) by simply adding
the current value of the 64-bit counter.
The RP2040 processor in the Pico W
has an internal real-time clock peripheral, but this only has a resolution of
one second, so we can’t really use this
to keep time accurately. However, we
set it and use it in places where it is
accurate enough, such as reporting
time in human-readable form on the
configuration interface.
The first core also provides a virtual
USB serial port that is used to print
an interactive menu with the help of
a serial terminal program. This can
be seen in Screen 1; we’ll look more
closely at the options later.
The menu allows up to eight SSIDs
(WiFi networks) to be set. The software
will automatically cycle through these
networks until it successfully connects
to one. It will attempt to reconnect if
the connection is lost.
Since many applications of the Time
Source depend on it only being turned
on briefly (to save battery power),
the initial behaviour is to perform a
network scan to ensure that the first
attempted connection is to an available network.
The virtual serial port also produces
status information, mainly concerning the WiFi status and time since
the last NTP update. One of the menu
Time is 22:43:01 on 14/02/2023. NTP OK. Last updated 0 minutes ago.
WiFi Status: Connected with IP: 192.168.130.140
Menu:
1 : Scan networks
2 : Show saved
3n : Delete SSID (n from saved list)
4n : Set SSID (n from scan list)
5 : Manual SSID
6n : Set Password (n from saved list)
7 : Test saved
8 : Save to flash
9 : Set Country Code (currently XX)
A : Set IPAPI URL (ip-api.com/line?fields=lat,lon)
B : Set Latitude (−27.467899 = 27°28’4”S)
C : Set Longitude (153.032501 = 153°1’57”E)
D : Set baudrate (9600 baud)
E : Set Talker (currently GP)
F : Set NTP validity timeout (200 min)
G : Set NTP server (pool.ntp.org [139.99.222.72])
H : Set default year (2022)
I : Turn debug on (currently off)
J : Reboot Clayton’s Pico W GPS Time Source
Screen 1: many options are available to configure the WiFi Time Source. At a
minimum, you will probably need to use commands 1, 4, 7, 8 and 9 to set the
country code and connect to your WiFi networks to operate it with our GPS
clocks. Other commands could come in handy depending on your application.
Australia's electronics magazine
June 2023 63
Table 1 – WiFi Time Source configuration commands
Comm. Function
Notes
1 Scan networks and
display a list in order
of decreasing RSSI
Channel and authentication are also listed.
The number shown in column n is used for
Command 4.
2 Show the current
network list
The list is active but may not reflect the
contents in flash memory unless a save has
been completed.
3n Delete item n from
the list shown by
Command 2
4n Add network n from
Command 1
Also prompts for a password. If all slots are
full, an error is printed and you will need to
use Command 3 to free a slot.
5 Enter a network
name manually
6n Enter the password
Shouldn’t need to be used unless you need to
for a network, using change a password.
n from the list shown
by Command 2
7 Test networks in the
list
Scans through the list and attempts to
connect to each network in turn. This can
take a while and success is only reported if
an IP address is obtained.
8 Save all settings to
flash memory
It’s a good idea to reboot after this to ensure
that all settings are reloaded correctly.
9 Set two-letter
country code
Only loaded on boot, so reboot after setting
this and using Command 8 to save.
A Set IP to lat/lon API
URL
This should return two lines of text with
decimal latitude on one line and longitude on
the next. Set URL to blank to disable.
B Set default latitude
Enter in the decimal format.
C Set default longitude Enter in the decimal format.
D Set NMEA baud rate
The default is 9600, but any rate between 300
and 921600 can be used.
E Set Talker code
The default is “GP”, but it can be any two
characters. “GP” works for all our clocks.
F Set NTP validity
timeout in minutes
The longest period for which the time can be
considered valid without a (typically hourly)
NTP update, from 60min to 50000min (about
a month).
G Set NTP server URL
The default is “pool.ntp.org”, which
automatically redirects to a geographically
nearby server. Others can be used, such as
“time.nist.gov”. The IP address may not be
correct until a network is connected.
H Set default year
The year used at boot when no other time
data is available, from 1970 to 4095. See the
separate article on the Y2K38 bug for why
this is important.
I Toggle debugging
Can be used to check and debug the NMEA
NMEA data output to data. This setting is saved in case you need
USB serial port
this data to always be available on the USB
serial port.
J Reboot Pico W
64
Silicon Chip
It’s recommended to reboot after saving
settings to ensure that all settings are
reloaded at boot time. If you hold the
BOOTSEL button while rebooting, you can use
electronicsmode.
magazine
this methodAustralia's
to enter bootloader
options allows the NMEA data to be
dumped to the virtual serial port for
easy debugging.
The first core is also responsible
for controlling the Pico W’s inbuilt
LED, which is used to flash a status
indication.
The LED is switched on solid when
power is applied, indicating that the
Time Source is powering up correctly.
It can also flash once, twice or three
times per second. One flash means it
is connected to a WiFi network, while
two flashes indicate that the time is
considered to be correct. Three flashes
occur when both those conditions are
true.
In general, the time is correct if an
NTP update has been received in the
last few hours, although this limit can
be adjusted.
The crystal oscillator used on the
Pico W has a 30ppm tolerance, meaning it could drift by up to one second
every eight hours. In practice, we
saw NTP adjustments up to 200ms,
so we’re confident that the time will
be accurate within half a second with
the default settings.
Programming the Pico W
It makes sense first to program the
Pico W and check that it is working
as expected. Hold the BOOTSEL button on the Pico W and plug it into
your computer. A USB drive named
“RPI-RP2” should appear. Copy the
NEW_CLAYTONS_1.UF2 file to it;
after a second or so, the LED should
come on.
You can then use a serial monitor
program to access the menu. We use
TeraTerm on Windows, while minicom can be used on Linux systems.
Open the Pico W’s virtual serial port
to access the interactive menu.
Ensure that your terminal program
uses CR or CR+LF as its line ending.
Since it is a virtual serial port, the baud
rate is unimportant, and any baud rate
setting should work.
Basic setup
All commands should be followed
by Enter.
The Pico W implements country
codes to ensure that the correct (legal)
WiFi channels are used for communication. The default “XX” setting is a
subset that is safe worldwide but does
not allow the use of some WiFi channels. So it should work but might not
be optimal.
siliconchip.com.au
It’s a good idea to set this to your
country. Use command 9 (followed
by Enter) and enter a two-letter country code (AU, NZ, US, UK etc), then
save the settings with command 8 and
reboot the Pico W with the J command.
Editor’s note: the codes should be
in the alpha-2 format, see: https://w.
wiki/4kP
Reconnect to the Pico W if necessary; TeraTerm usually does this automatically.
Now use menu option 1 to run
a WiFi scan; this should complete
within a second or so. The networks
are listed in order of RSSI (signal
strength), so you should find your SSID
near the top.
Note that commands listed with an n
suffix take a second numeric argument.
For example, if your network appears
first (next to number 0), enter command 40. You will then be prompted
for the password for this network; type
it in and press Enter.
You can enter multiple networks
without rescanning. If your network
doesn’t appear, use command 5 to
enter the name manually, and you
will be prompted for the password too.
Command 6 on its own is used to
change or set a password if, for example, you have entered it incorrectly.
Then try command 7 to test the
saved networks. You should see a message saying “Connected with IP”, followed by an IP address for each SSID.
If not, try again. If you get an “Auth
failed (password?)” message, the password entered may not be correct; you
can use command 6 to re-enter it.
The serial port will print updates
around every 15 seconds if nothing
has been entered on the serial port;
this is to prevent updates from interfering with your configuration process.
If all is well, use command 8 to save
the settings to flash and reboot again
to ensure that the settings are loaded.
This is necessary as some parameters
can only be set once, and the easiest
way around this is to reboot the device.
This should be the minimal amount
needed to set up the WiFi Time Source
to work with most of our clocks. A
detailed list of commands, along with
their use and purpose, is shown in
Table 1.
Screen 2 shows the typical responses
to the more common and complex
commands. Most other commands
require a simple response and will
report a message if there is a problem.
siliconchip.com.au
Screen 3 shows the typical progression at startup, although events may
not occur in this order. You might also
see a much larger NTP adjustment;
that is normal.
You can toggle the printing of GPS
sentences over the USB serial port by
using the I command. Screen 4 shows
this; naturally, your data might be different. If you have a PC program that
can process GPS data, you can use it
to verify the data.
Connecting it to a clock
The WiFi Time Source could feasibly connect to just about any system
that expects logic level NMEA 0183
data; however, its lack of accurate
speed and location data means it is not
the best choice in some cases.
We don’t recommend using it as
the source for any of our GPS-based
frequency references; the 1PPS signal
provided by this time source is not
intended to have the necessary precision. And since it only ever gives a
speed of 0 knots, it won’t be much use
in the GPS Finesaver (siliconchip.au/
Article/11673).
Screen 2 (right): this edited screen
dump shows the output of some of the
more complex commands. Note that
these commands have been issued
in the order shown, to add and then
remove an SSID. Commands 3 and 4
require a second parameter which is a
number printed by commands 2 and 1
(respectively) issued prior.
----------------------------------Command 1
----------------------------------1
Scanning
Scan complete
Scanned network list:
n SSID
RSSI Chan Auth
0 AndroidAP4AA0
−44
1 PASS
1 APV Admin Only −65
3 PASS
2 APHV Conference −66
3 PASS
3 TPW4G_ZeB426
−82
11 PASS
4 WiFi-5E5EE1
−84
8 PASS
5 NTGR_4E0C
−93
11 PASS
----------------------------------Command 43
----------------------------------43
2 TPW4G_ZeB426
Added OK
Enter password.
PASSWORD
password saved.
----------------------------------Command 2
----------------------------------2
Saved network list:
0 AndroidAP4AA0
1 Tim
2 TPW4G_ZeB426
----------------------------------Command 32
----------------------------------32
SSID deleted.
Saved network list:
0 AndroidAP44A0
1 Tim
----------------------------------Command 7
----------------------------------7
Testing networks.
0 AndroidAP4AA0
>connected with IP:192.168.208.140
1 Tim
>SSID not found
2 Networks tested, 1 OK
Time is 04:01:30 on 13/02/2023. NO NTP.
Connect failed
Connecting to 0 AndroidAP4AA0
Skip IPAPI fetch, no WiFi.
****
NTP adjustment: 11953
****
Connected with IP: 192.168.130.138
Time is 04:01:45 on 13/02/2023. NTP OK.
IPAPI start.
Headers of 170 bytes report 18 bytes of
Received 18 bytes.
HTTP finished:200
OK
Lat/Lon=−27.467899,153.032501
Time is 04:02:00 on 13/02/2023. NTP OK.
Time is 04:02:15 on 13/02/2023. NTP OK.
Time is 04:02:30 on 13/02/2023. NTP OK.
Time is 04:02:45 on 13/02/2023. NTP OK.
Time is 04:03:00 on 13/02/2023. NTP OK.
Time is 04:03:15 on 13/02/2023. NTP OK.
Time is 04:03:30 on 13/02/2023. NTP OK.
Time is 04:03:45 on 13/02/2023. NTP OK.
Time is 04:04:01 on 13/02/2023. NTP OK.
Last updated 0 minutes ago.
content.
Last
Last
Last
Last
Last
Last
Last
Last
Last
updated
updated
updated
updated
updated
updated
updated
updated
updated
0
0
0
1
1
1
1
2
2
minutes
minutes
minutes
minutes
minutes
minutes
minutes
minutes
minutes
ago.
ago.
ago.
ago.
ago.
ago.
ago.
ago.
ago.
Screen 3: the last few lines on this screen (using the TeraTerm serial terminal
program) show that the WiFi Time Source has connected to WiFi and updated
its time from NTP servers. The previous lines are typical of what might be seen
on a normal startup.
Australia's electronics magazine
June 2023 65
$GPRMC,050215.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*3F
$GPGGA,050215.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*78
$GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
$GPRMC,050216.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*3C
$GPGGA,050216.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*7B
$GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
$GPRMC,050217.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*3D
$GPGGA,050217.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*7A
$GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
$GPRMC,050218.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*32
$GPGGA,050218.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*75
$GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
$GPRMC,050219.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*33
$GPGGA,050219.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*74
$GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
$GPRMC,050220.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*39
$GPGGA,050220.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*7E
$GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
$GPRMC,050221.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*38
$GPGGA,050221.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*7F
$GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
$GPRMC,050222.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*3B
$GPGGA,050222.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*7C
$GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
Screen 4: the I command sends GPS sentences to the virtual serial terminal so
that you can confirm the data being produced. This setting can be saved to flash,
so the GPS data continues to be sent to the USB virtual serial port even after it
reboots.
It’s not going to be much use as a
navigational aid either, ruling out the
Advanced GPS Computer from 2021
(siliconchip.au/Series/366), so we’ll
assume you are using the WiFi Time
Source with one of our GPS clocks.
We have instructions below on using
the Time Source with some GPS clock
projects we have published over the
last ten years. Table 2 also summarises
how this Time Source can replace
some common GPS modules.
Note that these connections may not
be optimal, especially for clocks that
run on batteries. You might want to
experiment with alternative configurations. The suggested wiring for the
recent battery-powered clocks is different to Table 2 for that reason.
The problem is that the WiFi Time
Source has a higher current demand
than most GPS modules, and the circuitry sometimes cannot provide
enough current to drive it.
New GPS-Synchronised Analog
Clock – September 2022
The most recent GPS-synchronised
clock was published in September
2022 (siliconchip.au/Series/391) and
was followed by an update describing
how to connect the original Clayton’s
GPS Time Source in the November
2022 issue.
Like many of our recent GPS projects, it uses the VK2828U7G5LF GPS
module. In fact, we recommend this
module as a replacement for all the
previous GPS modules we have used
in clock projects.
The VK2828U7G5LF has six connections, but you only need four for the
Time Source. The connections are all
fairly straightforward, although they
don’t all connect to the GPS module
header – see Fig.3.
The black and blue wires are connected to the obvious points on the
GPS module header. The red wire
feeds power directly from the battery
to the Pico W’s VSYS pin; one of the
pins of the ICSP header is ideal for
this purpose.
Note that we’ve used a header pin
for this connection, so power can be
disconnected when we connect to the
USB socket for programming. This prevents 5V from the USB cable being fed
into the battery.
With just these three wires, the
Pico W would run continuously. So
the green wire connects the 3V3_EN
pin to pin 7 of IC1 on the Clock PCB.
This pin is usually used to control the
Clock’s boost regulator. This connects
underneath the PCB, as shown in the
photo, since it is easier to connect to
the corresponding pad.
Fig.3: connecting to the New GPS-Synchronised Analog Clock using the 3V3_EN pin on the Pico W makes the most
efficient use of the Pico W’s onboard boost regulator, bypassing the Clock’s own boost regulator (the Pico W is shown
larger than life size in Figs.3-6 for clarity). In this case, you could omit IC3, L1 and the two 10μF capacitors.
66
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
The WiFi Time Source wired to the New GPS-Synchronised Analog Clock from
2022. To save battery power, the boost regulator on the clock PCB is bypassed; in
fact, those onboard components could be left off entirely. The photo at upper left
shows the green wire connecting directly to pin 7 of IC1 on the reverse of the PCB.
This scheme bypasses the boost regulator on the New GPS-Synchronised
Analog Clock, which is possible as the
Pico W has its own buck/boost regulator. That also means that if you are
building the Clock board from scratch,
you can leave off the boost regulator IC
and its associated components.
With this arrangement, the Pico
W will power up even when the battery is down to 2V, the lower limit of
the Clock. By that stage, there wasn’t
enough voltage to power the blue
LED on the Clock, but everything else
worked as expected.
The photos show the Time Source
connected via short lengths of wire
and then mounted on the ICs using a
pad of double-sided tape. Note how
the Pico W’s WiFi antenna is clear of
the PCB below.
The WiFi Time Source typically
takes about 25 seconds to ‘get a fix’,
often faster and occasionally longer
if it does not connect to the WiFi network immediately. This should be the
same with most Clocks that use the
Time Source.
After powering on the Clock with
the Time Source connected, the Clock
would flash its LED once or twice, after
which the Time Source’s LED would
come on and start flashing at the same
rate as the Clock LED. After a few more
seconds, the LED on the Time Source
would turn off, showing that the Clock
has obtained the correct time and powered down the Time Source.
Generally, the Clock LED should
also turn off after half an hour at most
(and the clock should start ticking), so
if it continues flashing for longer than
that, you should investigate.
In general, we found that if the data
displayed on the USB serial terminal
appeared correct, the Time Source
would work correctly when connected
to the Clock.
GPS-synchronised Analog Clock
Driver – February 2017
The GPS-synchronised Analog
Clock Driver from February 2017
(siliconchip.au/Article/10527) also
recommended the VK2828U7G5LF
GPS module. Note that we have not
tested this arrangement or
any of the following arrangements
with clocks before 2022.
Here we propose a variation that
will avoid a small amount of inefficiency by also bypassing the Clock
Driver’s boost regulator. Since the
Pico W can work from voltages down
to 1.8V at VSYS, we take 3V directly
from the input of the boost regulator,
as shown in Fig.4.
GPS clocks from 2015
All the earlier GPS clocks we published used external power supplies,
so they should not have any problems due to the limitations of a battery supply.
Figs.5 & 6 show how to connect the
WiFi Time Source to the 6-Digit Retro
Nixie Clock Mk.2 and High Visibility
6-Digit LED GPS Clock, respectively.
Note that both use the same header
pinout for connections to their respective GPS modules, corresponding to
the connections shown in Table 2.
For efficiency reasons, the GPS
power supply voltage link for these
Fig.4: how to connect the Time Source to the GPS-synchronised Analog Clock Driver from 2017. This also bypasses the
Clock’s onboard regulator to power the Pico W. Note that we have not tested this configuration.
siliconchip.com.au
Australia's electronics magazine
June 2023 67
Fig.5: connections to the 2015 Nixie Clock. LK1 (which chooses between a 3.3V and 5V supply for the connected module)
should be set to the 5V position. Still, this design is not powered by a battery, so efficiency is less critical.
Fig.6: the High Visibility 6-Digit LED GPS Clock uses the same header pinout as the Nixie Clock, so the wiring is much the
same, as is the choice to set LK1 to the 5V position.
projects (LK1 for both projects) should
be set to the 5V position, since the
Pico W will happily work with 5V at
its VSYS input.
If you have any problems after connecting the Time Source to one of the
other clocks, it is most likely a power
problem. Check that the 3V3_OUT pin
is near 3.3V. If not, the circuit may not
be able to supply enough current for
the Pico W.
Conclusion
The Pico W board provides helpful
features in roles like this, such as its
integrated buck-boost power supply,
dedicated USB peripheral allowing
a separate configuration console and
good software support.
The WiFi Time Source is a natural
progression of the original Clayton’s
GPS Time Source from 2018 and is
68
Silicon Chip
similarly simple and well-priced. The
Pico W variant adds extra features,
particularly the ability to connect
automatically to one of several WiFi
networks.
At the time of writing, Bluetooth
support is in its early (beta) stages, so
we will investigate if it is possible to
add a Bluetooth interface for configuration. This would be very handy for
updating settings as it would remove
the need to connect a USB cable. SC
Table 2 – Time Source pin mapping compared to GPS modules
Pico W
VK2828
EM408
Pin 1 GP0 (NMEA
data)
TxD(4, blue)
Tx(4)
Pin 2 GP1 (1PPS)
1PPS (6, white)
Not connected
Pin 3/38 GND
GND (2, black)
GND(2)
Pin 39 VSYS
VCC (5, red)
V+(5)
Pin 40 VBUS
Not connected
Not connected
Not needed
EN (1, yellow)
EN (1)
Not needed
RxD (3, green)
RX(3)
Australia's electronics magazine
Notes
Not needed for
most applications
Or another source
of 1.8V to 5.5V
siliconchip.com.au
|