[time-nuts] Building a mains frequency monitor

Nick Sayer nsayer at kfu.com
Tue Apr 12 18:15:34 UTC 2016


At one point, I did try an LM393 instead of a 358. The result was that noise caused excessive false triggering. The 358, so far as I can tell, when acting as a comparator lacked sufficient bandwidth and/or speed to keep up with the noise. The result was that the per-second cycle offsets reported were almost always ±1, and were not every second. When I plotted my results, the scale of the “cycle debt,” as I termed it, was so broad that I concluded that whatever inaccuracy there was was being swamped by the signal being measured. My results also seemed to be on a par with the published results of other similar investigations (particularly those of tvb).


> On Apr 11, 2016, at 11:00 PM, Charles Steinmetz <csteinmetz at yandex.com> wrote:
> 
> Nick wrote:
> 
>> The instructable I wrote about it is at [link]
>> 
>> There's code for the Arduino and the
>> Linux side as well as schematics.
> 
> Several things to note about that front end circuit, from a time-nut perspective (the circuit was apparently created as a science project, and it may be fine for that):
> 
> 1)  The LM358 makes a very poor comparator, even for a 60Hz ZCD, with rise and fall times of tens of microseconds.  Also, its output doesn't pull closer than about 1.5v to the positive supply.
> 
> 2)  With the non-inverting input biased to +2.5v, the switching threshold is over 3 volts positive from the zero cross of the AC mains voltage, which guarantees that mains voltage variations will create timing offsets.  Ideally, the non-inverting input would be biased one diode drop below ground so the actual switching threshold would be near 0v.  However, that is not within the input voltage range of the 358 running on a single supply, so ground would be the closest workable choice (the 358 is a "single supply" op-amp, so its input common-mode range includes the negative supply -- ground, in this case).  Just remove R2 to implement this change.
> 
> 3)  The unused section of the LM358 has its noninverting and inverting inputs grounded, with the output left floating.  This is not a good way to connect an unused op-amp.  Generally, one should connect the noninverting input to a potential that is within both the input common-mode range and the output voltage range (here, from ground to about 3.5v), and connect the output to the inverting input (making it a unity-gain follower).
> 
> A much better solution is to use a real comparator with the threshold at 0v.  Instead of a series diode on the input, use a series resistor and clamp diodes as necessary to keep the comparator's noninverting input within its allowable voltage range.
> 
> I didn't review the code, but anyone building the circuit should check it carefully to see if there are any similar issues on the software end.
> 
> Best regards,
> 
> Charles
> 
> 
> _______________________________________________
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
> and follow the instructions there.




More information about the Time-nuts_lists.febo.com mailing list