Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.electronics.design > #466487 > unrolled thread

F to bits

Started byDavid Lesher <wb8foz@panix.com>
First post2017-07-02 03:13 +0000
Last post2017-07-03 00:51 -0500
Articles 7 on this page of 67 — 15 participants

Back to article view | Back to sci.electronics.design


Contents

  F to bits David Lesher <wb8foz@panix.com> - 2017-07-02 03:13 +0000
    Re: F to bits Lasse Langwadt Christensen <langwadt@fonz.dk> - 2017-07-01 20:27 -0700
      Re: F to bits David Lesher <wb8foz@panix.com> - 2017-07-02 05:21 +0000
        Re: F to bits edward.ming.lee@gmail.com - 2017-07-02 07:36 -0700
    Re: F to bits Don Y <blockedofcourse@foo.invalid> - 2017-07-01 22:34 -0700
      Re: F to bits edward.ming.lee@gmail.com - 2017-07-02 07:55 -0700
        Re: F to bits rickman <gnuarm@gmail.com> - 2017-07-02 11:44 -0400
          Re: F to bits edward.ming.lee@gmail.com - 2017-07-02 08:51 -0700
            Re: F to bits rickman <gnuarm@gmail.com> - 2017-07-02 12:00 -0400
              Re: F to bits edward.ming.lee@gmail.com - 2017-07-02 10:20 -0700
                Re: F to bits rickman <gnuarm@gmail.com> - 2017-07-02 13:52 -0400
        Re: F to bits Neon John <no@never.com> - 2017-07-02 13:41 -0400
        Re: F to bits Don Y <blockedofcourse@foo.invalid> - 2017-07-02 11:22 -0700
        Re: F to bits "John Miles, KE5FX" <jmiles@gmail.com> - 2017-07-02 12:55 -0700
          Re: F to bits Lasse Langwadt Christensen <langwadt@fonz.dk> - 2017-07-02 13:12 -0700
            Re: F to bits Don Y <blockedofcourse@foo.invalid> - 2017-07-02 13:27 -0700
            Re: F to bits edward.ming.lee@gmail.com - 2017-07-02 14:18 -0700
              Re: F to bits Lasse Langwadt Christensen <langwadt@fonz.dk> - 2017-07-02 14:37 -0700
                Re: F to bits edward.ming.lee@gmail.com - 2017-07-02 14:44 -0700
                  Re: F to bits edward.ming.lee@gmail.com - 2017-07-02 14:48 -0700
                    Re: F to bits edward.ming.lee@gmail.com - 2017-07-02 15:44 -0700
                      Re: F to bits Lasse Langwadt Christensen <langwadt@fonz.dk> - 2017-07-02 16:23 -0700
                        Re: F to bits edward.ming.lee@gmail.com - 2017-07-02 16:26 -0700
                          Re: F to bits Lasse Langwadt Christensen <langwadt@fonz.dk> - 2017-07-02 16:36 -0700
                            Re: F to bits edward.ming.lee@gmail.com - 2017-07-02 16:44 -0700
                              Re: F to bits Lasse Langwadt Christensen <langwadt@fonz.dk> - 2017-07-02 17:13 -0700
                            Re: F to bits krw@notreal.com - 2017-07-02 19:53 -0400
                      Re: F to bits Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2017-07-03 10:30 +0300
                      Re: F to bits Don Y <blockedofcourse@foo.invalid> - 2017-07-03 09:44 -0700
                        Re: F to bits Don Y <blockedofcourse@foo.invalid> - 2017-07-03 09:50 -0700
                      Re: F to bits Jasen Betts <jasen@xnet.co.nz> - 2017-07-04 05:18 +0000
                Re: F to bits Les Cargill <lcargill99@comcast.com> - 2017-07-03 00:44 -0500
              Re: F to bits Les Cargill <lcargill99@comcast.com> - 2017-07-03 00:42 -0500
              Re: F to bits Jasen Betts <jasen@xnet.co.nz> - 2017-07-04 05:11 +0000
          Re: F to bits rickman <gnuarm@gmail.com> - 2017-07-02 19:32 -0400
            Re: F to bits Lasse Langwadt Christensen <langwadt@fonz.dk> - 2017-07-02 16:40 -0700
              Re: F to bits klaus.kragelund@gmail.com - 2017-07-02 16:45 -0700
              Re: F to bits rickman <gnuarm@gmail.com> - 2017-07-02 19:55 -0400
                Re: F to bits Lasse Langwadt Christensen <langwadt@fonz.dk> - 2017-07-02 17:07 -0700
                  Re: F to bits rickman <gnuarm@gmail.com> - 2017-07-02 20:30 -0400
                    Re: F to bits edward.ming.lee@gmail.com - 2017-07-02 17:39 -0700
                      Re: F to bits klaus.kragelund@gmail.com - 2017-07-02 18:09 -0700
                        Re: F to bits edward.ming.lee@gmail.com - 2017-07-02 18:45 -0700
                    Re: F to bits "John Miles, KE5FX" <jmiles@gmail.com> - 2017-07-02 17:49 -0700
                      Re: F to bits rickman <gnuarm@gmail.com> - 2017-07-02 22:56 -0400
                        Re: F to bits "John Miles, KE5FX" <jmiles@gmail.com> - 2017-07-02 21:52 -0700
                          Re: F to bits rickman <gnuarm@gmail.com> - 2017-07-03 01:38 -0400
                          Re: F to bits David Brown <david.brown@hesbynett.no> - 2017-07-03 12:37 +0200
                            Re: F to bits edward.ming.lee@gmail.com - 2017-07-03 04:23 -0700
                              Re: F to bits David Brown <david.brown@hesbynett.no> - 2017-07-03 14:10 +0200
                                Re: F to bits leongdentalsf@gmail.com - 2017-07-03 06:14 -0700
                                  Re: F to bits Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-07-03 15:46 +0100
                                    Re: F to bits edward.ming.lee@gmail.com - 2017-07-03 08:24 -0700
                                      Re: F to bits Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-07-03 17:12 +0100
                                        Re: F to bits rickman <gnuarm@gmail.com> - 2017-07-03 12:50 -0400
                                          Re: F to bits Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-07-03 18:36 +0100
                                            Re: F to bits rickman <gnuarm@gmail.com> - 2017-07-05 02:01 -0400
                                    Re: F to bits Lasse Langwadt Christensen <langwadt@fonz.dk> - 2017-07-03 09:30 -0700
                            Re: F to bits Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-07-03 12:32 +0100
      Re: F to bits David Lesher <wb8foz@panix.com> - 2017-07-03 00:54 +0000
        Re: F to bits Don Y <blockedofcourse@foo.invalid> - 2017-07-02 18:14 -0700
          Re: F to bits David Lesher <wb8foz@panix.com> - 2017-07-03 02:33 +0000
            Re: F to bits Don Y <blockedofcourse@foo.invalid> - 2017-07-02 21:29 -0700
            Re: F to bits edward.ming.lee@gmail.com - 2017-07-02 22:46 -0700
    Re: F to bits Les Cargill <lcargill99@comcast.com> - 2017-07-02 12:40 -0500
      Re: F to bits Don Y <blockedofcourse@foo.invalid> - 2017-07-02 11:38 -0700
        Re: F to bits Les Cargill <lcargill99@comcast.com> - 2017-07-03 00:51 -0500

Page 4 of 4 — ← Prev page 1 2 3 [4]


#466637

FromDon Y <blockedofcourse@foo.invalid>
Date2017-07-02 18:14 -0700
Message-ID<ojc5ik$96v$1@dont-email.me>
In reply to#466634
On 7/2/2017 5:54 PM, David Lesher wrote:
> Don Y <blockedofcourse@foo.invalid> writes:
> 
>>> Seeking a packaged line (~~60hz) frequency [or period] counter
>>> with I2C or SPI output to feed a Mega2560 box. The goal is to
>>> monitor a b/u generator's speed.
>>>
>>> Suggestions?
> 
>> How accurate do you need to be?  Presumably, the mains will not be
>> available when the generator's output is "of interest".  But, the
>> device you're contemplating could be located *on* the "backed
>> up mains" just as easily as on the output of the genset.
> 
> The goal it to detect if/when the generator is overloaded,
> and shed less critical loads.

So, you're interested in the current instantaneous frequency
AFTER you're reasonably sure the genset has "come online"
(it may stumble a bit as it takes on the load) AND the
*change* in frequency as the load is increasing beyond what
it can handle.

But, you still haven't indicated the range of values that you
consider significant to convey this information.  A 20KW genset
overloaded by 1KW will respond differently than a 2KW overloaded
by 100W.

Likewise, an inverter might exhibit perfect frequency control
but just start losing voltage...

> We don't care about 12:00 12:00 12:00 12:00
> 
>> Can it be indoors? (i.e., in a relatively constant environment)
>> Or, does it have to reside in the same environment that the generator
>> is likely located (which may be out-of-doors)
> 
> Sure, it will be next to the other stuph.

Next to the other stuff *outdoors* or other stuff being *powered*
(presumably -- though not necessarily -- INdoors).

I.e., in my case, the powered loads are all indoors as is the
monitoring/control electronics.  But, the genset is outdoors
to keep the heat, noise and exhaust out of the living space.

[toc] | [prev] | [next] | [standalone]


#466645

FromDavid Lesher <wb8foz@panix.com>
Date2017-07-03 02:33 +0000
Message-ID<ojcadc$l8c$1@reader2.panix.com>
In reply to#466637
Don Y <blockedofcourse@foo.invalid> writes:


>So, you're interested in the current instantaneous frequency
>AFTER you're reasonably sure the genset has "come online"
>(it may stumble a bit as it takes on the load) AND the
>*change* in frequency as the load is increasing beyond what
>it can handle.

>But, you still haven't indicated the range of values that you
>consider significant to convey this information.  A 20KW genset
>overloaded by 1KW will respond differently than a 2KW overloaded
>by 100W.

Well, it's 10KW, but experimentation will tell us what 
amount of overload gets us a slowdown. And 

>Likewise, an inverter might exhibit perfect frequency control
>but just start losing voltage...

This is spinning iron....But we're debating if voltage drop is
a valid metric...

>> Sure, it will be next to the other stuph.

>Next to the other stuff *outdoors* or other stuff being *powered*
>(presumably -- though not necessarily -- INdoors).

Quite indoors. 
-- 
A host is a host from coast to coast.................wb8foz@nrk.com
& no one will talk to a host that's close..........................
Unless the host (that isn't close).........................pob 1433
is busy, hung or dead....................................20915-1433

[toc] | [prev] | [next] | [standalone]


#466652

FromDon Y <blockedofcourse@foo.invalid>
Date2017-07-02 21:29 -0700
Message-ID<ojch0p$guf$1@dont-email.me>
In reply to#466645
On 7/2/2017 7:33 PM, David Lesher wrote:
> Don Y <blockedofcourse@foo.invalid> writes:
> 
> 
>> So, you're interested in the current instantaneous frequency
>> AFTER you're reasonably sure the genset has "come online"
>> (it may stumble a bit as it takes on the load) AND the
>> *change* in frequency as the load is increasing beyond what
>> it can handle.
> 
>> But, you still haven't indicated the range of values that you
>> consider significant to convey this information.  A 20KW genset
>> overloaded by 1KW will respond differently than a 2KW overloaded
>> by 100W.
> 
> Well, it's 10KW, but experimentation will tell us what
> amount of overload gets us a slowdown. And
> 
>> Likewise, an inverter might exhibit perfect frequency control
>> but just start losing voltage...
> 
> This is spinning iron....But we're debating if voltage drop is
> a valid metric...
> 
>>> Sure, it will be next to the other stuph.
> 
>> Next to the other stuff *outdoors* or other stuff being *powered*
>> (presumably -- though not necessarily -- INdoors).
> 
> Quite indoors.

OK, so you won't see large temperature fluctuations (esp over short
time intervals).

The first thing you need to address is gaining access to the mains.
I.e., if you're using a DC wall wart to power your kit, then the AC
component of the mains is hidden behind (in front of) the power supply.
OTOH, if using an AC wall wart (aka XFORMER) and rectifying, filtering
and regulating *this*, then you can tap off the AC ahead of the rectifier
and use this as a reflection of the mains voltage (which, in turn, tells
you the frequency when examined over time).

This can be as simple as feeding the signal through a (high) resistance
with clamps to gnd and "Vcc", then a buffer/op amp/etc. to get to a clean
digital signal.

You can also use an optoisolator, etc.

Your goal here is to have a (digital) signal that has a consistent phase/timing
relationship with some portion of the mains signal (e.g., a zero-crossing).
Any variation, here, introduces jitter to your measurement.

(e.g., if you ran the signal through a comparator and tried to slice it at
something close to its peak expected voltage, then if that voltage dips
or climbs, the point in *time* when the ATTENUATED mains voltage reaches
that fixed voltage threshold will change)

You can do this for both "legs" of the transformer to get 120 events per
second (60Hz mains) or just one -- leaving the portion of the mains waveform
when the signal is "negative" to be unobserved.

The transformer will help act as a hash filter to cut down on some of the
high frequency noise on the line.  You can also add some filtering (a cap)
at the input to the comparator/buffer (sized carefully lest it add more
variation to the signal skew).

Once you have a signal that is roughly 60 (120) Hz in periodicity, you
have to capture the time at which this "event" occurs.

There are many ways to do this -- each with different hardware requirements
and costs -- as well as software latency consequences.

The straightforward way of doing this is to feed an edge-triggered
interrupt pin and write an ISR that grabs the value of a free-running
(actually, it need not be but its easier to describe if it is) counter
and passes that to a "handler" that can do the math at its leisure
(the ISR wants to do as little as possible).

However, a problem with this lies in the variations in "interrupt points"
in the instruction stream -- that you probably have no control over
(unless you want to halt the processor periodically to *wait* for the
next interrupt; work on something for a while and then pause so you know
the processor isn't doing anything "unpredictable" when the interrupt
occurs; service the ISR, then start working, again, confident that the
next ISR won't happen for many milliseconds).

Additionally, if there are other interrupt sources competing for the processor,
then these may be active (being serviced) at the time the LFC interrupt
comes along.  So, the other ISR may cause the LFC ISR to be delayed
by a (variable!) amount, depending on where the other ISR happens to be
in its service routine when the LFC event comes along.

Finally, if the run-time package installs a default handler for each ISR and
dispatches those through some sort of MTOS structure, *it* might introduce
delays that you can't control (e.g., ISR sets a flag that the scheduler
examines AT ITS CONVENIENCE and conditionally invokes *your* ISR... much
delayed from the actual event of interest!

There are numerous ways to get this sort of edge-to-trigger-interrupt.

One is a dedicated interrupt pin (often programmable as to which edge
is active).

You can also program a timer to *start* when the edge is detected
and have *it* (the timer) generate an interrupt when it "times out"
(i.e., preload the timer with a count of "1" and some fixed clock
source; when the event occurs, the timer arms and "1 fixed clock"
later, it generates an interrupt -- which you use to examine another
free-running timer, as above)

[Note that you don't care that the interrupt is delayed by that
"1 fixed clock" as long as it is ALWAYS delayed by the same amount!
OTOH, you can't delay by a length of time that exceeds the
amount of time between your LFC events as the "next" one will
be missed while the first one is still timing out]

You can use a serial port "modem control" signal.

You can use the RxD signal for an unused serial port (if you can
ensure the signal from your detector is wide enough to look like a
start bit -- then, some number of bit times later, the "data"
on the RxD pin is received by the UART and an interrupt signaled)

I.e., look at every interrupt source and see how you can trick
one that you aren't using to perform this function for you...
reliably!

A better approach is to use the capture register present in
many MCU's (incl the Mega).  Instead of generating an interrupt
and HOPING you can carefully and CONSISTENTLY get around to noticing
that "free-running counter" value (in the ISR), you let hardware
in the MCU take a snapshot of *a* free-running counter and signal
an interrupt.  The interrupt then can leisurely examine the CAPTURED
timer value when the hardware event was signaled.

This lets the software get sloppy in its timeliness (how quickly
it gets around to handling the interrupt/event) AND consistency
(the latency need not be constant/consistent cuz the time-critical
aspect of the problem has been handled by the capture hardware.

The free-running counter is typically the counter that your
"timing services" use (e.g., the mechanism that lets you
note that "1 millisecond" has expired) -- unless you don't have
a *real* service (i.e., the timing/delay functions twiddle the
hardware directly  <frown> )

*Ideally*, the timer will not wrap around more than once between
events.  I.e., if the counter counts from 0 to 9 and then
wraps to 0, again, you would ideally like to see events at,
for example, 2... then 8 (for a difference of 6), then 4
(another difference of 6 cuz 4+10-8=6), then 0, etc.

If the timer wraps more often, you have a few choices:
- slower clock/timebase (more time between wraps)
- wider timer (more counts between wraps)

The slower clock comes at the expense of more granularity in your
measurements.  You lose precision.

The wider timer can be implemented by cascading two (or more)
hardware timers (so one wraps causing the other to advance by a
count).  Or, by implementing the "wrap counter" in software.
This requires an interrupt at each wrap of the (one!) hardware
timer and an update of some internal variable that acts as
the more significant portion of the "virtual timer".

This adds yet another (trivial) ISR.  But, complicates the design
of the original ISR as it now has to read the hardware timer
AND the "software variable" that acts as its extension.  All
the while taking into account the fact that other ISRs may be
interspersed in the process.

At the very least, it requires a more complicated "atomic read"
of this combined hardware+software timer:  how do you know
that the hardware timer hasn't changed while you're reading
the software counter -- and vice versa?

However, a bit of clearer thinking can often eliminate the need
for this extra counter/timer and the overhead/complexity that
comes with it.

If, for example, you can guarantee that the variation between
expected observations will always be within the range of one
"hardware timer timeout period", you can *infer* the number
of "wraps" that must have occurred between events!

For example, assume the counter counts [0..99].  Now, assume
the range of valid "intervals" (between events) is [528..619]
(pick two values that differ by less than 100 counts).

Assume *an* event is noted as occurring at a HARDWARE count
value of 42.  Assume the next event occurs at a count of 95.
It *looks* like the interval was 53 counts.  But, we know
that 53 isn't possible!  The only value in the range supported
would be 553.  So, we can infer that the timer had wrapped
5 times.  If the second read had been 41, we'd know that the
difference (99) could only be accounted for if the interval
had been 599.

Where this falls down is if the range of valid intervals
exceeds the period covered by the hardware timer.  E.g.,
imagine if the valid range was [500..619] and the two
observations were 42 and 43 -- an apparent difference of "1".
Would this be 501?  Or, 601??

<shrug>  Hopefully enough to get you started...

As for your "load detector", you could either hard-code limits
*or* take a snapshot of the current frequency and watch to
see if it degrades by a percentage in a particular time interval
(you want to react quickly enough to not damage the genset
*or* end up with a low-line condition; but, not too quickly
that you shed load unnecessarily).

Also keep in mind that the genset will appear to be performing
BETTER once the load is shed -- don't get caught thinking you can
now reacquire the load that you just shed (add some hysteresis
to your decision loop so it doesn't oscillate).

[toc] | [prev] | [next] | [standalone]


#466657

Fromedward.ming.lee@gmail.com
Date2017-07-02 22:46 -0700
Message-ID<fc1db4b5-00c2-4f26-9a60-460c296dae21@googlegroups.com>
In reply to#466645
On Sunday, July 2, 2017 at 7:33:21 PM UTC-7, David Lesher wrote:
> Don Y <blockedofcourse@foo.invalid> writes:
> 
> 
> >So, you're interested in the current instantaneous frequency
> >AFTER you're reasonably sure the genset has "come online"
> >(it may stumble a bit as it takes on the load) AND the
> >*change* in frequency as the load is increasing beyond what
> >it can handle.
> 
> >But, you still haven't indicated the range of values that you
> >consider significant to convey this information.  A 20KW genset
> >overloaded by 1KW will respond differently than a 2KW overloaded
> >by 100W.
> 
> Well, it's 10KW, but experimentation will tell us what 
> amount of overload gets us a slowdown. And 

Why do you think overloading will affect the frequency?  It does not take much power for zero crossings.  I beg it would not change the frequency at all.  However, it will distort the wave form and make it more triangular than sinusoidal. In other words, you need to capture the exact waveform, not just oversampling it.

[toc] | [prev] | [next] | [standalone]


#466555

FromLes Cargill <lcargill99@comcast.com>
Date2017-07-02 12:40 -0500
Message-ID<ojbasu$7nc$1@dont-email.me>
In reply to#466487
David Lesher wrote:
> Seeking a packaged line (~~60hz) frequency [or period] counter
> with I2C or SPI output to feed a Mega2560 box. The goal is to
> monitor a b/u generator's speed.
>
> Suggestions?
>

All the "frequency" oriented things I have seen with SPI
in the PI universe are pulse train oriented. If you can get the
AC waveform down to pulses, that might work. But that's out
of the frying pan into the fire.

You might be able to make do with a lesser processor; not sure.

Clip the waveform, use a diode pair after the clipper to
feed two PIO - one for up, one for down. Be careful of voltage
and current range on the PIO. I'd have to headscratch a bit
on the clipper - you want a pretty hi-Z output.

http://www.electronics-tutorials.ws/diode/diode-clipping-circuits.html

I'd have to think isolation thru on something like this. Might use
optos. Dunno yet.

You'd prefer that this turn on and off at pi/4, 3pi/4,
5pi/4 and 7pi/4. That's negotiable through oversampling. For
production, I might use digital pots to tune the duty cycle.

I'd butch the clipper/diode setup up and watch it on a scope
for a while to make sure it's not gonna damage the PIO or itself.
Buy enough parts to make three. Again, not being a hardcore analog guy,
I'd have to think about isolation and the like.

That gives you up to four time measurements per cycle. The critical
design element then becomes choice of filters.

Arduino has a library function called "micros()" that returns a
32 bit upcounter w/ resolution of 4 or 8 microseconds. It rolls over at 
like 70 seconds @ 16MHz.

https://www.arduino.cc/en/Reference/Micros

8x oversampling for 60Hz is 960Hz - a very long time @ 16MHz.
That should satisfy Nyquist although the duty cycle might be
off. You'll have to consider the time to output to the
USB serial port....

-- 
Les Cargill


[toc] | [prev] | [next] | [standalone]


#466570

FromDon Y <blockedofcourse@foo.invalid>
Date2017-07-02 11:38 -0700
Message-ID<ojbebu$jha$1@dont-email.me>
In reply to#466555
On 7/2/2017 10:40 AM, Les Cargill wrote:
> David Lesher wrote:
>> Seeking a packaged line (~~60hz) frequency [or period] counter
>> with I2C or SPI output to feed a Mega2560 box. The goal is to
>> monitor a b/u generator's speed.
>>
>> Suggestions?
> 
> All the "frequency" oriented things I have seen with SPI
> in the PI universe are pulse train oriented. If you can get the
> AC waveform down to pulses, that might work. But that's out
> of the frying pan into the fire.

The problem with a "generic" frequency/period measurement
device is they aren't aware of the types of "transition events"
that are often associated with power events.  I.e., *might* be
good when the genset is running steady-state (and able to
keep up with the load) but potentially confused by the
genset's coming on line, power falling away, etc.

I almost always include a "line frequency clock" in my (mains
powered) designs.  Its job is just to watch the zero-crossings
of the mains.  From this, it can tell me:
- power is available
- nominal mains frequency (for dual 50/60Hz deployments)
- actual instantaneous mains frequency (to frequency lock certain
   sensor/display technologies to reject interference from line
   noise, display beating, etc.)
- long term timebase reference (over the course of a day or twenty,
   the AC mains are a remarkably stable reference; computers can count
   over long intervals just as easily as over short!  :> )

But, more importantly, you can create very effective, narrow band filters
that reject signal components that aren't part of the desired signal
E.g., if you have deduced that you are operating on a particular mains
frequency, you can ignore zero crossings that happen too close to -- or
too far FROM -- the most recent zero-crossing (think "bounce" in
the transfer switch's contacts or a utilities "dying gasps" as it
tries valiantly to remain on-line despite network events).

How do you tell a generic sensor which of these individual events
to ignore in its frequency reporting?

> You might be able to make do with a lesser processor; not sure.
> 
> Clip the waveform, use a diode pair after the clipper to
> feed two PIO - one for up, one for down. Be careful of voltage
> and current range on the PIO. I'd have to headscratch a bit
> on the clipper - you want a pretty hi-Z output.
> 
> http://www.electronics-tutorials.ws/diode/diode-clipping-circuits.html

If you design the power supply with this in mind, it usually
comes out (close to) "for free".  Presumably, his box has *some*
sort of power source...?

> I'd have to think isolation thru on something like this. Might use
> optos. Dunno yet.
> 
> You'd prefer that this turn on and off at pi/4, 3pi/4,
> 5pi/4 and 7pi/4. That's negotiable through oversampling. For
> production, I might use digital pots to tune the duty cycle.
> 
> I'd butch the clipper/diode setup up and watch it on a scope
> for a while to make sure it's not gonna damage the PIO or itself.
> Buy enough parts to make three. Again, not being a hardcore analog guy,
> I'd have to think about isolation and the like.
> 
> That gives you up to four time measurements per cycle. The critical
> design element then becomes choice of filters.
> 
> Arduino has a library function called "micros()" that returns a
> 32 bit upcounter w/ resolution of 4 or 8 microseconds. It rolls over at like 70 
> seconds @ 16MHz.
> 
> https://www.arduino.cc/en/Reference/Micros
> 
> 8x oversampling for 60Hz is 960Hz - a very long time @ 16MHz.
> That should satisfy Nyquist although the duty cycle might be
> off. You'll have to consider the time to output to the
> USB serial port...

[toc] | [prev] | [next] | [standalone]


#466658

FromLes Cargill <lcargill99@comcast.com>
Date2017-07-03 00:51 -0500
Message-ID<ojclmr$run$1@dont-email.me>
In reply to#466570
Don Y wrote:
> On 7/2/2017 10:40 AM, Les Cargill wrote:
>> David Lesher wrote:
>>> Seeking a packaged line (~~60hz) frequency [or period] counter
>>> with I2C or SPI output to feed a Mega2560 box. The goal is to
>>> monitor a b/u generator's speed.
>>>
>>> Suggestions?
>>
>> All the "frequency" oriented things I have seen with SPI in the PI
>> universe are pulse train oriented. If you can get the AC waveform
>> down to pulses, that might work. But that's out of the frying pan
>> into the fire.
>
> The problem with a "generic" frequency/period measurement device is
> they aren't aware of the types of "transition events" that are often
> associated with power events.  I.e., *might* be good when the genset
> is running steady-state (and able to keep up with the load) but
> potentially confused by the genset's coming on line, power falling
> away, etc.
>
> I almost always include a "line frequency clock" in my (mains
> powered) designs.  Its job is just to watch the zero-crossings of the
> mains.  From this, it can tell me: - power is available - nominal
> mains frequency (for dual 50/60Hz deployments) - actual instantaneous
> mains frequency (to frequency lock certain sensor/display
> technologies to reject interference from line noise, display beating,
> etc.) - long term timebase reference (over the course of a day or
> twenty, the AC mains are a remarkably stable reference; computers can
> count over long intervals just as easily as over short!  :> )
>
> But, more importantly, you can create very effective, narrow band
> filters that reject signal components that aren't part of the desired
> signal E.g., if you have deduced that you are operating on a
> particular mains frequency, you can ignore zero crossings that happen
> too close to -- or too far FROM -- the most recent zero-crossing
> (think "bounce" in the transfer switch's contacts or a utilities
> "dying gasps" as it tries valiantly to remain on-line despite network
> events).
>
> How do you tell a generic sensor which of these individual events to
> ignore in its frequency reporting?
>

Ignore? Those sound like the signal :) ; the steady-state operation is 
the noise[1]. And I'd think in terms of plant characterization for that.

[1] er, carrier perhaps...

>> You might be able to make do with a lesser processor; not sure.
>>
>> Clip the waveform, use a diode pair after the clipper to feed two
>> PIO - one for up, one for down. Be careful of voltage and current
>> range on the PIO. I'd have to headscratch a bit on the clipper -
>> you want a pretty hi-Z output.
>>
>> http://www.electronics-tutorials.ws/diode/diode-clipping-circuits.html
>
>>
> If you design the power supply with this in mind, it usually comes
> out (close to) "for free".  Presumably, his box has *some* sort of
> power source...?
>

I bet so.

>> I'd have to think isolation thru on something like this. Might use
>> optos. Dunno yet.
>>
>> You'd prefer that this turn on and off at pi/4, 3pi/4, 5pi/4 and
>> 7pi/4. That's negotiable through oversampling. For production, I
>> might use digital pots to tune the duty cycle.
>>
>> I'd butch the clipper/diode setup up and watch it on a scope for a
>> while to make sure it's not gonna damage the PIO or itself. Buy
>> enough parts to make three. Again, not being a hardcore analog
>> guy, I'd have to think about isolation and the like.
>>
>> That gives you up to four time measurements per cycle. The
>> critical design element then becomes choice of filters.
>>
>> Arduino has a library function called "micros()" that returns a 32
>> bit upcounter w/ resolution of 4 or 8 microseconds. It rolls over
>> at like 70 seconds @ 16MHz.
>>
>> https://www.arduino.cc/en/Reference/Micros
>>
>> 8x oversampling for 60Hz is 960Hz - a very long time @ 16MHz. That
>> should satisfy Nyquist although the duty cycle might be off. You'll
>> have to consider the time to output to the USB serial port...

-- 
Les Cargill

[toc] | [prev] | [standalone]


Page 4 of 4 — ← Prev page 1 2 3 [4]

Back to top | Article view | sci.electronics.design


csiph-web