A DCF77 Clock with RS232 Interface using PIC16F84
The clock is synchronised via the German time signal DCF77. It has a display with automatic brightness control and a RS232 computer interface.
The clock is built around a PIC16F84 microcontroller from Microchip. I chose this microcontroller since its FLASH memory is easy to program and assembler and programmer software is freely available for GNU/Linux. It has 13 general input/output pins which is just enough to implement all the feature I wanted.
- Display with Brightness ControlThe 6 7-segment LEDs are multiplexed with a frequency of 100 Hz. A simple combination of a 74138, 74247 and some transistors is used. With more I/O pins on the microcontroller, one could save the two chips but the current might be to high for a microcontroller.
The brightness of the LEDs is controlled by the ambient light. This is achieved by varying their illumination time, also known as Pulse Width Modulation. Whenever a new 7-segment LED is switched on, a capacitor is discharged. The capacitor is then slowly charged. When the voltage at the capacitor gets higher than the reference voltage determined by the A1060 photocell, the display is blacked out.
- RS232 InterfaceThe hardware part of the RS232 interface is straightforward. Two pins of the PIC16F84 act as RX/TX, and MAX232 does the conversion from TTL to RS232 signal level.
The software part is more interesting. Since the PIC16F84 does not have an USART, the coding and decoding of the serial signal is entirely done in software. This is suboptimal since the PIC16F84 does not have interrupts for any I/O pins, so the software must constantly poll the RX pin. You can get example code from Mircochip for this. But as a consequence, the main code for analysing the radio signal and driving the display is called from the RS232 code and is only allowed to use a limited amount of time. This amount of time available decreases with higher serial speeds, so the highest possible speed with this design is 1200 Baud. Next time I would definitely use a microcontroller with a build in USART.
- Radio Signal ReceiverThe radio signal is demodulated with an U4224B by TEMIC Semiconductors. The digitised serial signal is displayed by a LED and fed into to PIC16F84. The U4224B together with the ferrite antenna are placed in a separate box to keep circuit noise emission from the antenna and to allow perfect alignment of the antenna.
For more detail: A DCF77 Clock with RS232 Interface using PIC16F84
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w
Current Project / Post can also be found using:
- dcf77 emulator
- dcf77 pic asm
- dcf77 modul rs232