[ELECTRON] Arduino project help.
Andrew Back
andy at smokebelch.org
Tue Jan 25 22:48:15 UTC 2011
On (22:31 25/01/11), Gordon JC Pearce wrote:
> The thing that switches the reading between positive and negative looks
> a bit hairy. Have you considered just using a single PWM output, and
> making it "idle" at 127?
Hairy how so?
Well, the problem is that the meter I have is 5-0-5v, so I need to swap the
polarity of the PWM drive depending on whether mains is >50Hz or <50Hz.
The problem isn't limited to the transition above/below 50Hz either.
> I'd also be slightly wary of counting microseconds like that; I'd be
> more inclined to take a moving average of the last ten readings every
> time the comparator interrupt fires.
Not sure I understand the concern... You might have to be explicit - I'm not
a coder and so I'm not clear as to why this method is bad.
As to a sliding average, the problem is that these periodic hugely out
readings would still throw the product out somewhat.
Cheers,
Andrew
--
Andrew Back
a at smokebelch.org
More information about the members
mailing list