Evaluating LinkSwitch TNZ as clocking source for RTC module using Power Integrations Home Appliance and Industrial Power Reference Design Kit

Table of contents

RoadTest: Power Integrations Home Appliance and Industrial Power Reference Design Kit

Author: JWx

Creation date:

Evaluation Type: Power Supplies

Did you receive all parts the manufacturer stated would be included in the package?: True

What other parts do you consider comparable to this product?: STMICROELECTRONICS STEVAL-ISA177V1, ROHM BM2P26CK-EVK-001

What were the biggest problems encountered?: Connector type - could be socketed/screwed, especially on the mains side

Detailed Review:

Intro and kit content

The kit has arrived in elegant carton box, containing a small PCB inside anti-static bag. 

{gallery}Product unboxing

Shipping box

Element side

PCB side

PCB size

Power supply module is small, with good assembly quality (no visible defects identified) and equipped with connectors in the shape of wire loops, requiring hooked connectors for secure contact.

Included documentation

Reference Design Kit is an implementation of RDR-877 - 6 W Isolated Flyback Power Supply with Lossless Generation of AC Zero Crossing Signal using LinkSwitch-TNZ which, in great detail, describes reference design of 12V/0.5A power supply. It's construction is based on one of topologies presented in LNK33x2-7D LinkSwitch-TNZ Family datasheet - namely "Isolated Flyback with AUX Winding for IC Bias", but with a few modifications. Below there is a simplified schematics from the datasheet and a final schematics from the reference design, with changes highlighted:

Schematics from datasheet

Reference design schematics

As can be seen, some of them are noise reduction features  (C1/L1/C2 and L2/C6 filters), R9 acts as a gate pull-down resistor for Q1, R4 and C4 create a RC snubber around D1, VR4 adapts ZCD output signal to 5V logic and C9 is added to improve frequency response of the optocoupler U2. R2 is an additional resistor of D2/C3/R2/R3 RCD clamp network that is reducing ringing during key switch-off and reverse current of D1 during key switch-on. They are also cost-reducing solution, allowing for use of slow, low-cost D2 diode (which - as added benefit - is also reducing EMI and improving efficiency).

Another interesting part is an over-voltage circuit, that, according to the documentation is optional and not installed by default (refer the following photo from the documentation):

no OVP

but in fact was installed on the module provided:


All the documentation provided is of high quality - not only step-by-step design howtos are provided, but also detailed transformer construction manual (like below)

{gallery}Trafo construction

reference signal curves

reference signal curves

or even thermal images of the powered module

thermal image

Dynamic parameters

To evaluate output stabilization performance, reaction to sudden load change was tested. During the test, PWM signal generator was used, which was switching resistive load of about 55Ω,  resulting in about 220mA of output current change, with no preload current. Using circuit as below, with 17Hz signal and 10% fill factor resulting in short load spikes, emulating - for example - periodic activation of high consumption element (like a radio module):

Load change test

three different power supplies were checked.

Reference PS 1

My first reference was an inexpensive 12V power supply, rated at 15W and 1.25A output.

Reference PS 1

During the test, following voltage curves were observed

Reference 1 voltage

using 500mV/div setting, which means that the stabilization isn't very good - despite declared power of 15W, 0.2A load change resulted in > 1V output voltage swing and slow return to the previous state.

Reference PS 2

The second reference was a second-hand, Sagem branded power supply, rated at 18W (1.5A) output.

Reference PS 2

This one generated following voltage curves during test:

Reference 2 voltage

As can be seen, not only voltage variation is smaller (about 0.5V), but the slopes are much sharper, indicating better stabilization.

Device under test

And finally our LinkSwitch power supply module - with much lower rated power (6W)

D.U.T voltage

Despite lower output power, voltage variation is the smallest observed (about 150mV). Another observation is that there is probably more noise in the high-load phase comparing with reference 2, but it can be observed only on the highest gain setting (so there can be significant measurement error) and in the situation of relative load variation much bigger for D.U.T (about 44%: 220mA of 500mA) than for Reference 2 (about 15%).

Another part of the module is a Zero Crossing Detection output, that is providing mains synchronized square signal with voltage limited to 5V (using VR4 Zener diode) and shape as below

zero cross

Zero-crossing output as a clock source for timekeeping purposes

Why to use

In the times of old, some electronic clocks were synchronized to the mains frequency - especially the ones installed in always connected appliances (like microwave ovens) and outfitted with power-hungry LED displays. Unfortunately, as mains frequency was of limited stability, their accuracy was questionable. 

Some time ago I have found interesting application note by Renesas (AN1342 "Using 60hz power line frequency accurate real time clock timebase") that is discussing the advantages of using mains frequency as a wall clock reference in place fo (especially budgetary) crystal oscillators. Their main argument against cheap crystal oscillators is a (lack of) temperature compensation that can result in large frequency errors, especially when working temperature derives from the (reference) room temperature.

As a proof of concept they propose circuit as below:

AN1342 block diagram

where mains frequency, after multiplication to the standard 32kHz, is synchronizing typical real-time clock IC.

Their conclusions are as below:

  • over a period of 2 weeks, clock deviation varied ±2 seconds, but never greater, which agrees with the published
    accuracy for power line frequency in the US,
  • short term measurements on the 60Hz frequency show that it can deviate more than this (up to ±500ppm over a period of hours) but
    averages to zero over a longer time period (1 week),
  • there is no cumulative error over long periods with the AC input as a
    frequency source

Encouraged by these results I have decided to use zero-crossing signal of LinkSwitch TNZ chip to test it's usability as a clock source of RTC circuit.

Proof of concept

I have decided that circuit proposed by Renesas has several drawbacks:

  • it is using typical RTC IC that needs to be clocked by 32kHz signal, that is internally divided by 32768 but there is no way to use signal of different frequency,
  • to generate such a frequency, circuit with two chips needs to be used (first - frequency divider and then PLL based multiplier to get the frequency required),
  • clock signal is lost when there is mains outage, without easy means of switching to the different reference, even if RTC chip can be battery backed,

so I have decided to find something else. Initial search turned  nothing interesting - most commercial RTC chips seem be prepared to work with 32kHz input only and MCU embedded ones are using either external 32kHz signal or some division of main clock frequency.

Then, I have found that Raspberry Pi RP2040 internal RTC can be clocked from an external source - usually 1 PPS signal from some stable reference like a GPS receiver. This discovery resulted in very simple circuit like below:

POC schematics

where Raspberry Pi Pico is connected to external RTC module of known (but not very good) timekeeping precision and (through 4050 voltage converting buffer) to zero crossing signal from P.I. Design Kit.

RTC module used (and shown at the photo below) is a low-cost DS1302 RTC board (modified here to use supercapacitor instead of the battery as a backup power source), using 32kHz quartz reference:

DS1302 RTC

This module is being read using port of Arduino library from https://github.com/kenwebb/pico-ds1302.git, and external clock source from Design Kit ZCD output is selected (as signal on GPIO20 with 50Hz frequency) using the following code part

  clock_configure_gpin(clk_rtc, 20, 50, 50);

During runtime, both DS1302 and local RTC output is periodically printed into emulated serial interface, from which it is read by the LattePanda SBC.

This computer, running standard Ubuntu GNU/Linux distribution, is then comparing both timestamps with NTP synchronized local time and inserting them into InfluxDB database, from which it can be easily visualized by the tools like Grafana.

Result evaluation

First, as a baseline. I have gathered time deviation data from DS1302 module and local RTC configured in the typical way, when RTC clock is derived from main clocking signal generated using quartz oscillator.

Results were as below:

baseline clock deviation

As can be seen, DS1302 is running fast by the 10s/day, but local RTC also exhibits a constant drift of about 0.3s/day (that can be better observed on the averaged graph below)

local RTC - averaged

In comparison, mains frequency clocked RTC behaves like below (green line):

50hz clocked RTC

At first glance - not very good: difference from reference time can be even several seconds. This is understandable, given that mains frequency changes with grid load - it is going faster during light load and lagging during consumption peaks, and distributed generation using renewable power sources is not helping (instead of controlling the frequency of a few big generators, hundreds of small and free-running ones are present). But in longer periods, average time difference seems stable  - without visible long-time drift, which seems consistent with Renesas findings.

Another interesting observation is that mains-synchronized clock is much more stable  than a cheap quartz synchronized RTC module.

This finding is in line with the theory - in Europe, all grid clocks are referenced to the Swissgrid provided frequency, which is also correcting long-time grid time deviation - when it drifts more than 20 seconds from UTC reference, they are enforcing frequency change of about ±0.01Hz to counter it.


Power Integrations Home Appliance and Industrial Power Reference Kit is an interesting module with good dynamic parameters, more capabilities than expected (installed optional over-voltage protection circuit) and Zero Crossing output that can be used for more (for example - switching loads during low mains voltage periods) or less traditional means. It also has outstanding documentation, with all sorts of reference signal shapes, tips for avoiding common design problems (like generation of audible noise) and even thermal images of a working module.

  • more long term measurements below - after two weeks of data gathering (DS1302 first, then mains synchronized RP2040 local RTC)

    DS1302 drift

    mains drift

    As can be seen, local 32kHz clock has a constant drift exceeding a minute/week and mains synchronized clock can be off by about 20s (which is in line with the theory) but without observable long-time drift so far...

  • An interesting use of the zero-cross is: filter out mains introduced noise from measurements.

    In many labs, the biggest source of noise is mains ripple (except if you use LED lighting Slight smile - they will shout over any other noise like a buoy horn). When making measurements, it makes sense to integrate the result over one or more mains cycles. The result is that the mains introduced noise is averaged out. The Keithley DMM6500 uses zero crossing detection for that.