Danilo的数字译码器解码SRC-RAI信号,这是意大利官方每小时一次的信号。通过这个设备,你能够学到最古老的运行的信号之一的抽样时间是如何做到的以及它是如何工作的。
Decode Periodic Signal Transmissions
Danilo’s digital decoder decodes the SRC-RAI signal, the Italian
official hourly signal. With this device, you can learn how one of
the oldest operating signals of sample time is made and how it
works.
Men have been interested in the topic of time and how to measure it
for centuries. Famous philosophers and scientists such as Albert
Einstein have studied every aspect of this peculiar physical
concept. Through his theory of relativity, Einstein introduced
essential concepts about the regular flow of time. These matters
continue to puzzle us today. For instance, it is impossible to
synchronize two watches that are not in the same “condition.”
Think about the GPS satellites orbiting the Earth at an approximate
altitude of 20,000 km. Believe it or not,between the two atomic
clocks, one on the satellite and one at sea level, there is a daily
difference of about 38.9 μ s. It ’s a difference we cannot ignore
that ’s due to different gravitational pulls acting on the orbiting
clock and its displacement velocity, which is 12 times greater than
the one on Earth. Therefore, GPS satellite systems are usually
adjusted before launch in an effort to minimize such effects.
When it comes to time, a temporal scale of reference is important.
The old definition of a “second”—as a division of the 86,400 parts
of the mean standard day —is inadequate. In 1967, the scientific
community acknowledged the new definition of “second.” Back
in 1955,English physicians Louis Essen and J.V.L.Parry created the
first cesium-beam atomic clock at the National Physical Laboratory
in England. In the international system, the “second ” then became
SI, the duration of 9,192,631,770 periods of the radiation
corresponding to the transition between two hyperfine levels of the
ground state of the cesium-133 atom.
After that, numerous metrological laboratories adapted to the new
technological concept. For instance, since 1970, The National
Electrical Institute (IEN) in Turin, Italy, has had its own
coordinated universal time (UTC) that is based on cesium-beam
atomic clocks. With the introduction of the “cesium fountain”
atomic clock in 2003, the Institute, now called The National
Institute of Metrological Research (INRIM), has been at the
forefront of time measurement. This type of clock has a precision
of 10
–15, which means a 1-s error in 30 million years, provided that it
would work for such a long time.
To coordinate the ever-increasing amount of data produced by the
atomic-clock-equipped labs throughout the world, we now refer to
the International Bureau of Weights and Measures (BIPM) in Paris,
which has calculated the time since 1988 using the UTC times of
accredited centers, such as the so-called International Atomic Time
(TAI), which has become the scientific community ’s official point
of reference for time measurements.
In this globalized, computerized world, we cannot ignore the
importance of having a universal temporal scale of reference. Think
about the financial and stock transactions that are quickly
transferred through the telecommunication networks and may change
their values in only seconds. Time synchronization is important in
everyday life as well. If you think I am exaggerating,let ’s go
back for a moment to New Year ’s Day 2000 when a simple time change
was supposed to trigger a worldwide catastrophe. Fortunately, no
big problems occurred.But to prevent a potential catastrophe,
numerous tests were conducted on devices for thousands of hours.
Today, many systems are automatically synchronized through Network
Time Protocol (NTP) servers on the Internet. To supplement its
divulgation activities, the INRIM has two NTP free access servers,
which are set with the institute’s UTC-IEN time. These servers are
found at the following addresses: ntp1.ien.it (193.204.114.232) and
ntp2.ien.it (193.204.114.233).
THE SRC-RAI SIGNAL (IEN)In an international community, transmitting the time signal via a
radio signal is common. The German DCF77 signal, which works on
77.5 kHz, covers a large part of Europe, including all of England
and ranging from part of the Scandinavian countries down to near
the North African coasts (2,000 km). The similar Swiss Prangins HBG
signal is compatible with DCF77 signal coding.The only difference
is that the emissions frequency for the HBG signal is 77 kHz. Like
the German signal, it also has a considerable range of 1,500 km.
Finally, in England, since 2007, the National Physical Laboratory
(NPL) has transmitted the English official signal MSF from the
Anthorn station through 17 kW of power working on 60 kHz.
Unlike the aforementioned signals, the SRC-RAI signal is not
generated and directly transmitted on air. It is coded and sent to
the Radio Televisione Italiana (RAI) station, which broadcasts
through its own radio network.
Photo 1—This is the IEN SCR-RAI decoder.
My IEN-SRC project cannot compete with the progress of the hourly
signals or with Internet and the NTP service. But the purpose of
this project is to study one of the oldest operating signals of
sample time (see Photo 1). Even if the signal’s mode of
transmission is obsolete, the IEN in Torino is still at the
forefront in terms of precision and technological research. Thus,
this project is an excellent starting point for studying a signal’s
time and frequency. If you’re in Europe, you can receive the radio
RAI signal via satellite. Try Hotbird 8 (13.0°E, 11,804.00 MHz,
vertical polarization) or Astra 1L (19.2°E, 11,567.50 MHz, vertical
polarization).
Figure 1—This is the complete IEN SCR-RAI signal.
Let’s examine how the SRC-RAI time signal is made. First, note that
it is a modulated frequency shift keying (FSK) signal in an audio
frequency band. This means that it is an “audible” signal. As you
can see in Figure 1, it consists of two groups of bits that are
transmitted on seconds 52 (32 bits) and 53 (16 bits) of each
minute. Every bit has a fixed duration of 30 ms. The bit is
2,000-Hz if it is a 0, or a 2,500-Hz tone if it is a 1. A third
tone of 1,000 Hz is used for the last six audio synchronization
signals. At the head of the group of bits is the ID field (ID-1 and
ID-2), which identifies the bits that follow. Bits 16 and 31 of the
32-bit group (P1 and P2) and bit 15 of the 16-bit group (PA) are
parity bits that allow you to verify the preliminary accuracy of
the data received through the no-parity method.
The first segment of code transmits the time, the entire date, and
the day of the week. The second segment transmits the year and two
interesting technical parameters. Data is transmitted through the
binary-coded decimal (BCD) coding and not with a binary sequence,
as you might think.
Figure 2—These are details about the two blocks of the IEN SRC-RAI signal.
As you can see in Figure 2, the bit values are placed according to
the positions in the transmitted code.For the remaining technical
information (SE – SI), refer to the tables in Figure 2.
A detailed analysis of the two aforementioned parameters shows that
the first (SE)warns when time changes from standard to
daylight-savings time and vice versa. The second (SI) sees to the
warning for the socalled “leap second.” In brief, the leap second
represents the power to add or take away 1 s to compensate for
variations in the speed of the Earth ’s rotation. If necessary,this
compensation is inserted at the end of June or December after
23:59:59 UTC.
From the introduction of the leap second in 1972, up to the last
update on January 1, 2009, a total of 34 s have been added to the
time scale (TAI). The decision to use (or not use) the leap second
is made by the International Earth Rotation Service (
www.iers.org). It does so according to the measurements made by the
metrological laboratories that it refers to.
To a casual listener, the SRC-RAI hourly signal sounds like a
shrill,modulated, 1.5-s sound that ’s followed immediately by five
short synchronizing signals. A final signal is transmitted that
corresponds to second 00. As I mentioned, the INRIM ’s SRC-RAI
signal is directly transmitted on a dedicated frequency to the RAI
’s headquarters and then broadcast in the normal radio-RAI
program.This is why it can be received at different times and
places on all three RAI stations in both amplitude (AM) and
frequency (FM) modulation.The signal ’s broadcast usually takes
place 15 times per day (sometimes 20 or more times) in different
time bands. Signals at midday, midnight,and generally before the
evening news cannot be eliminated.
If the transmission can’t be received directly from Italy, the same
radio-RAI signal can be received throughout Europe with a standard
digital satellite TV receiver. In that case, you can can obtain the
signal via the audio output on the back of the receiver. For more
information about the SRC-RAI time signal, refer to the INRIM IEN
web site (
www.ien.it/tf/time/index.html).
SYSTEM DESIGNFigure 3—This is the decoder circuit. I used a PIC16F628.
This project was created for educational purposes. I developed the
circuit to study the SRC-RAI signal generated by the IEN in Turin
(see Figure 3). I don ’t pretend the circuit is highly accurate or
perfectly synchronized.Bear in mind that the signal is transmitted
via radio or TV satellite. In addition to being an old technology,
it produces a delay in the propagation that cannot always be
defined and that is often similar to other systems transmitting the
hourly signal (see Photo 2).However, the sources of information
contained in the SRC-RAI coded and received signal are
exact.Therefore, you can use them as a point of reference.
Photo 2—This is the PCB.
Let ’s move on to the electric diagram.It is separated into two
different sections. The first part hinges on the analog integrated
circuit LM311,a classic single-supply comparator,which, surrounded
by a few passive components, starts processing the input analog
signal. This entire first phase basically supplies a TTL squaring
of the signal to send it directly to the microcontroller, which
handles the entire decoding process.
The core is a Microchip Technology ’s PIC16F628A microcontroller.
Compared to the wellknown PIC16F84, this microcontroller has 2 KB
of program memory and more independent timer registers, which can
be used for programming.The PIC16F628A handles numerous tasks: it
reads the header, decodes the input TTL signal,manages the display
(including the display light), and drives the open-collector
synchronization output.
Many previous FSK signal decoder designs used a selective circuit
as an A/D interface —that is, an integrated circuit (e.g., LM567)
based on a PLL sample frequency, which literally “captured
”the allocated frequency. Once the sample frequency was found in
the signal, these devices simply produced a TTL output signal.
There are a few obvious disadvantages associated with these
circuits: the need to have different selective stages (one for
every frequency to be found), the need to use laboratory
instruments (oscilloscope or frequency counters)for the calibration
phase, and a proven instability due to the noises often present in
the input signal.Noises in the AM frequency (vanishing noises) and
the less invasive FM frequency (over modulation) are the major
causes for unsuccessful decoding with the old decoder circuits.
My project features a digital circuit where the task of selecting
the FSK tone, as well as its quality, is delegated to the only
microcontroller. In terms of functionality, you have notable
advantages: calibration isn ’t required, you have stable
selectivity,and you have an inexpensive, compact project.
The PIC16F628A microcontroller ’s software was developed with pure
assembly code. High-level languages weren ’t used. This refined
approach enabled me to use the 2 KB of memory and maximize the part
’s full potential.I used an alphanumeric integrated display that
contains a Hitachi HD44780 with a reduced pin (nibble)
configuration. The microcontroller manages the display (and
backlighting).The PIC16F628 ’s software is posted on the Circuit
Cellar FTP site.
I must point out one thing about the only output signal connected
to the open collector phase managing the TR2, which is responsible
for transmitting a 3-s pulse dead on second 00 of every hour. This
signal pulse may occasionally help when connecting an external
device to be synchronized with the aid of your SRC decoder.
Finally, note that the circuit includes a voltage regulator. A
tested LM7805 voltage regulator supplies an adequate level of
stabilization.
FIRMWARE & DECODINGFigure 4—This is the READ_FREQ routine.
I consider the software to be the most innovative part of this
project. As you can see in Figure 4 and Figure 5, the decoding
section of the three sample frequencies (1,000, 2,000, and 2,500
Hz) represents the most interesting portion of the firmware. The
READ_FREQ routine is responsible for this activity. It can
synchronize on the leading edge of the input signal, establishing
its period (lambda). If the lambda value is included in an expected
frequency range (1,000,2,000, or 2,500 Hz), the routine exits and
advises which incoming frequency has been recognized. The range of
lambda values that define the frequencies to be recognized has been
given a 3% margin to avoid errors in the recognition mainly due to
a frequency slippage, which is typical with AM receiving.
Figure 5—This is the READ_BIT routine.
In the same routine, several checks are made to verify the correct
lambda reading, as well as to reject frequencies that are too high
(caused by spikes) or frequencies that are too low (no incoming
signal). The first routine using READ_FREQ is the one that reads
the principal header,made up of one bit 0 followed by one bit 1.
The correct reading of this part of the code is fundamental for all
reading all of the data. The routine takes into consideration the
exact length of the signals and then estimates the quality through
a noise parameter rather than reading errors.
In fact, if the decoding activity is stopped as soon as a
“simple ” defection in reading occurs, it would become impossible.
Bearing in mind the nature of the incoming signal source, you
cannot expect to have a signal that is totally accurate.
The noise value then becomes an important parameter to value the
signal ’s quality. Higher parameters mean more signal
interferene.Beyond a certain cluster point, an error in reading
occurs and an ID1-ERROR message appears. The wide margin-based
reading technique and the quality of the read data are also made
possible by the fact that there are only three frequencies to be
read and their spacing. When designing the signal standard, it is
likely that the IEN had already considered the most adequate
frequencies to get a data transmission with the lowest number of
potential errors.
Immediately after reading the main header HD-1, the following bits
are decoded, which constitute the first segment in a quick
succession, one after the other. The generic READ BIT routine
carries out this activity depending on the preceding READ FREQ for
the frequency identification.
All of the data, which are read in the first segment, will be
stored and considered all at once after reading the second segment.
When the 32 bits constituting the segment are available,there is a
final check, which consists of testing the control of the odd
parity residing in the code every 16 transmitted bits. It is useful
for auditing the received data.
After the last check on the first segment, the second segment is
read with the same procedures and software routine. The second
segment is made up of 16 bits, which is half of the previous one.
The use of specific routines and the technique based on orderly and
recursive calls represents a typical example of a productive way of
programming. The remaining software routines don ’t show any
particularities apart from the calendar,which autonomously looks
after the correct display of the time and the punctual date change
for leap years included between 2000 and 2035. After 2035, this
device will probably be considered only as a piece of history.
However, an undoubtedly interesting feature is the display of the
second intercalary “leap second,” which will be able to display the
virtual 60 s as soon as the leap second happens. Its display will
happen at 1 A.M., not at midnight,because the Italian time zone is
1 GMT.
USER MANUALBy now you should be persuaded that using the decoder is easy to
use and highly reliable. You just need to decide if you want to use
a common AM-FM radio or a satellite TV receiver. The former is
easier and readily available, but imperfect frequency tuning may
blanket the reception. Don ’t worry. A lot of work has been made on
the software in the microcontroller in an effort to minimize
mistakes as much as possible.A special routine calculates and
judges the signal ’s quality to identify data that is also in the
presence of reception noises. On the other hand,a TV satellite
decoder offers excellent output signal quality but limits
portability.
When switching on the device, a welcome message appears on the
display. You ’re then asked to choose the source of the signal: or
. By selecting the satellite, you tell the device that the source
of the signal will be taken from a satellite receiver with a
calculated average delay of about 240 ms, which will be
automatically adjusted by the software in the microcontroller. This
enables perfect synchronization with absolutely no problem.
Once you connect the source of the input signal and feed the
circuit,check the signal ’s volume. To access the test routine,
hold the Enter key for 2 s immediately after you switch on the
device. A graphic slider moves each of the three frequency samples
(1,000, 2,000, and 2,500 Hz ) to be recognized. Then,adjust the
input volume. The bar moves a bit toward the right or left every
time one of the three frequencies used for recognizing the SRCRAI
signal (i.e., on 1,000, 2,000 or 2,500 Hz) is identified.
If the volume is too low, the bar on the display won ’t move and
will have to be turned on. Once you have terminated the check
phase, press Enter again. The device, with the display off, will
wait to receive a good SRCRAI signal. As soon as the first two
segments of information are received,they will be decoded and
displayed. A bar placed in the lower part of the display will move
forward, synchronized by six 1,000-Hz beeps.
If problems occur during reception,a warning message will appear.
The most common errors reported on the display will have to do with
the initial header of the first or second group (HD-1 and HD-2),
rather than the noncorrespondence of the control parities of the
byte of the information received (P1, P2, and PA). To be honest,
during my frequent tests, I found that the reception problems had
been limited.
I must point out that the coded SRC hourly signals, which are
broadcast in the middle of the day, must sometimes be broken or
incomplete for several technical reasons causing the abortion of
the reception. Usually there are no problems with signals that are
broadcast just before the news or at midnight because an adequate
space for a corrected transmission is allotted.
After a positive reception, the decoder’s display shows a clock
perfectly synchronized to a millisecond. Because the clock’s
functionality is based on the PIC16F628A’s internal oscillator,
don’t forget that it won’t be precise 24 h after the
synchronization.
The use of an external 10-MHz quartz doesn ’t ensure that all of
the prototypes we make have the same precision. For example, some
inexpensive quartz may have a margin (variance in the frequency)
of ±50 ppm (0.005%). This is why programming an EEPROM memory
location (38 Hex)with an “adjustment ” value has been
allocated. By changing this value,when developing the PIC, it is
possible to adjust, in advance or later, the internal routine,
which is in charge of the clock ’s adjustment.
Your internal clock is also fully equipped: it updates the complete
date, even for leap years until 2035;it automatically updates the
time when passing from standard time to daylight saving time and
vice versa;and it is a perfect display of the sixtieth second in
case of a leap second at 1 A.M. sharp. Central European Time (CET)
in Italy is 1 h ahead of Greenwich Mean Time (GMT).
Figure 6—These are the menus.
All the other parameters can be displayed using the two special
keys on a keyboard. You can page through to the next submenu. You
will then know if it is a standard or a daylight saving time. If in
the following seven days there will be some changes (and at the end
of the month), a leap second will take place. As you can see in
Figure 6, the menu enables you to control the display light and
perform a reset.
TEST SOFTWARE (DELPHI)The decoder for the SRC-RAI time signal is equipped with some of
the most refined programming technology that can be squeezed out of
one small PIC16F628 microcontroller. To thoroughly test your
project without having to wait for the signal to be broadcast,
refer to the Test-IENSRC.exe file on the Circuit Cellar FTP site.
To use the software, you need a PC running Windows XP and a sound
card. The program’s main screen is shown in Photo 3.
Photo 3—This is a principal panel in the test software.
After you set all the necessary parameters, the signal is ready to
be transmitted in an entire block. You can then manually enter the
beeps at 1,000 Hz for the transmission.
The software includes a wave format recording of a broadcast time
signal. You can use it to test your circuit as well. Please
consider this software as a mere test program with no control
procedure. Good luck hunting for signals and then decoding and
validating the received data!
Author’s note: You can enter GPS coordinates at
www.gpscoordinates.eu/show-gps-coordinates.php to see images of the time signal transmission facilities via
satellite. Enter 45.015037, 7.639634 for the IEN-IRITI in Torino,
Italy. Enter 50.016000, 09.007600DCF77 for the Mainflingen signal
in Hesse, Germany. Enter 54.911227, –3.279997 for the National
Physical Laboratory, which transmits the Anthorn station in London,
England. Enter 46.408300, 6.252500 for the HBG transmitter in
Prangins, Switzerland.
Danilo Consonni (
www_enigma@lycos.it) is an electronic engineer who lives in Italy, where he studied
electronics at the Politecnico di Milano. He develops circuits and
writes for several publications based in Europe. Danilo has been
active in the computer security field for more than 15 years. You
can contact him him on the web at
http://xoomer.virgilio.it/www_enigma.
PROJECT FILESTo download code, go to
ftp://ftp.circuitcellar.com/pub/Circuit_Cellar/2009/225.
SOURCEPIC16F628A Microcontroller Microchip Technology, Inc. |
www.microchip.com