Occasionally, radio-controlled alarm clocks get out of work, but the
DCF77 receiving module is still intact.
But why making a voltage shifter for connecting a serial port
when there is a nice USB solution there?
Here, a small 8-pin ATtiny45 is sufficient, filled with smart firmware called
V-USB and
AVR-CDC.
With this firmware combination, the DCF77 receiver creates a serial port
and is fully compatible to old-style true-serial-port ones.
No software adaption is necessary.
Function
The signal received should stimulate all five input “pins” of the
emulated serial port. Therefore, software settings are no more critical.
However, one line will not work at all, and another one not within “Funkuhr.exe”.
DCD,
DSR,
RI and
RxD will work.
CTS won't work.
The receiver has to be activated using any of the three output “pins” of
the emulated serial port. However, one of these lines will not work at all.
TxD and
DTR will work.
RTS doesn't work.
The software installation procedure below is for Windows (2k, 2k3, XP, Vista, 7).
Linux and Mac users should know what to do.
Circuitry
The microcontroller and the DCF77 receiver will be fed by regulated
3.3 V.
The internal 16.5 MHz oscillator is used for clocking, synchronized by
SOF pulses onto the DATA– wire of USB by the host computer.
Schematic, totally easy
(made of IBM CP437 frame characters; regular image)
Construction
See photos below.
Very low-power low-dropout voltage regulators are only available
in SMD housings. Therefore, the chip is placed on the bottom side.
Programming
The chip is programmed using an external programmer.
The Firmware is freeware
(FunkUsb.c: Public Domain; V-USB part: GNU LGPL).
The firmware contains a new approach for synchronization
of internal RC oscillator, and lots of changes at AVR-CDC
for support of virtual modem state lines.
Installation
As for all AVR-CDC projects, no driver is necessary,
but an .INF file.
After installing, a serial port occurs (maybe, COM7)
that can be used as any serial port with any Windows program.
Note that DOS software will not run with FunkUsb.
Windows does not virtualize port addresses.
After installing the driver, the device will not automatically run nor
a clock will automatically set.
This is done with the next program, for example.
Driver installation for the COM port may be complicated!!
Usage (Windows)
For receiving the time and setting the clock, I have written the program “Funkuhr.exe” (has English and German GUI, but only German help file).
You can use any receiver software of your choice,
but it must be Windows (not DOS) software that accesses a COM (not LPT) port.
Normally, the LED lights dimmed.
On aerial signal (carrier attenuation) the LED lights up.
For enabling this effect, the running receiver software must activate either TxD or DTR.
In USB standby mode, the LED is off.
FunkUsb emulating a Joystick
With same schematic, a newer approach emulates a one-button joystick.
It has some pros and cons:
The firmware fits into 2 KByte flash of cheaper ATtiny25
No driver installation hassle at all, runs perfectly from Windows 98 upto Windows 11 64 bit
Function can be checked without any additional Windows software at all,
see screenshot on right side, taken from built-in Control Panel application.
Requires clock-setting software that accepts a joystick button as input device
The firmware now supports configurable pins and polarities.
Solution
The new firmware
emulates a joystick with 1 button and 1 lever.
This offers the following advantages:
No driver issues; every USB-capable system supports joysticks
without a need for extra driver, possibly on Windows 95c too
Function check without third-party tools using Control Panel / Game Controller.
See animated screenshot.
Note: The Windows 98 Control Panel application refuses to work properly.
For the same reason as
joySetCapture()
expects two levers.
FunkUsb.exe uses
joyGetPosEx() instead.
Measurement of time is done in real-time capable microcontroller,
decoding data doesn't rely on low system load.
The Microcontroller's size can be smaller (ATtiny25 statt ATtiny45)
and thus be cheaper
Disadvantages:
Loss of compatibility with software expecting a COM port.
Then use firmware above instead.
The hardware doesn't change.
Simply swap or re-flash the microcontroller, that's all.
My „Funkuhr.exe“ application
is extended to know this HID Interface.
Moreover: The firmware source code allows easily configurable port pins
and is suited for both gcc3 and gcc4.
The time server ntpd supports DCF77
only over serial port and RxD input.
Sorry, I'm not able to modify its (cumbersome) source code
to joystick input.
Nevertheless, my dcf77-js.c
can set the system clock.
This source code doesn't depend on uncommon libraries,
is easily compilable, and useful for setting the system clock of a
Raspberry Pi.
The program uses /dev/input/js0 as default device.
The one-and-only command-line parameter selects another joystick.
The program runs in one of two modes:
As unprivileged user, DCF77 data will be decoded and displayed
endlessly with colored characters. Nothing else. See screenshot.
Started as root, DCF77 data reception runs
until two adjanced telegrams are received error-free
and with 1 minute difference.
Then it attepts to set the system clock, and terminates.
While terminating (with ^C), a histogram will be shown.
The bucket width is 20 ms.
This firmware version can use the same schematic as above
but is made with modifications for rechargeable battery backup in mind.
Its main advantage is keeping date and time available while PC is switched off.
Therefore, time is available early at startup.
It requires a special USB interface, and special software for querying this.