To investigate glitchy effects in my PIC-based Netzlupe I decided to build an analog equivalent. I needed to come up with a way to convert the mains frequency (actually, the period) into a voltage that I could present to an analog meter. As it happened, I found a nice panel meter in my junk box with a center indication. The scale was useless:
so after scanning it in I created my own scale, using a similar font to the original scale:
Now the circuit. I found a vintage HEF4538 dual precision timer in my tray, as wel as a HEF4066 analog switch. I also wanted a rail-to-rail opamp. The one I had available, an LT6221, unfortunately a bipolar device and not CMOS. This means that the sample and hold circuit that I had in mind would be a challenge...
The schematic is quite simple:
The 50 Hz signal, coming from the PIC input, goes to the first timer which creates the S+H pulse. This triggers the measurement timer. Once it expires the output charges an RC network. When the 50 Hz signal triggers again the S+H pulse stores the voltage in a second capacitor. Its buffer drives the analog meter.
This meter is connected to a zener diode which provides the offset but also neatly linearizes the curve that the RC network generates. The result is an almost linear scale. The 390 ohm resistor is a bit too high so the sensitivity is a bit low but I did not want to fix it. It could be replaced by a trimmer resistor of 200-500 ohm in series with a 270 ohm resistor. The 50k trimmer resistor in series with the 649k resistor of the second timer sets the zero point. Initially this value was calculated too high due to an error in the 4538. Apparently it's not so precise as the datasheet promised. The second opamp has a rather high bias current, in the nano amperes, that causes droop in the capacitor voltage. This doesn't impact the accuracy of the measurement. Still, a CMOS opamp like the OPA2350 would have been nicer.
The end result is really good:
The meter is a bit jittery but the mass of the needle provides a good integration of the noise present in the 50 Hz signal. On the board, the huge polystyrene 27000 pF capacitor stands out. This was chosen for the stability of the measurement timer and does an excellent job.
And the kicker is that the glitches were easily solved leaving this as a nice exercise in electronics design.
Back to the homepage
Date: 24 February 2019
This software is licensed under the CC-GNU GPL.