Shop OBEX P1 Docs P2 Docs Learn Events
Counting voltage Spikes — Parallax Forums

Counting voltage Spikes

ArchiverArchiver Posts: 46,084
edited 2004-04-18 17:26 in General Discussion
I want to count every time the voltage goes above 1 volt. I have a
BS II and a ADC0804 Annalog to digital converter, but I am a nubie to
all this. Can somebody give me some advice.

I am not set on using the BS II or the ADC0804 if anybody knows an
easier way to accomplish this please tell me.

Thank you,

Nick

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-04-15 19:47
    My suggestion is to use an op-amp comparitor to sense when the spike goes
    above 1 volt, and have the output of the op-amp comparitor trigger a 555 timer
    configured to monostable mode (one-shot) with an output pusle of 10 mS or so.

    But this 10 mS time may be too long depending on how often your voltage spike
    occur.
    Do you know how often the voltage spike will occur?

    If you need further help with any aspect of this, write back

    ken

    ==================================
    I want to count every time the voltage goes above 1 volt. I have a
    BS II and a ADC0804 Annalog to digital converter, but I am a nubie to
    all this. Can somebody give me some advice.

    I am not set on using the BS II or the ADC0804 if anybody knows an
    easier way to accomplish this please tell me.

    Thank you,

    Nick


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-15 19:50
    --- In basicstamps@yahoogroups.com, "Nick" <nickvanlan@h...> wrote:
    > I want to count every time the voltage goes above 1 volt. I have a
    > BS II and a ADC0804 Annalog to digital converter, but I am a
    > nubie to all this. Can somebody give me some advice.

    Much depends on the characteristics of the signal in
    question. "Spikes" are generally short duration - a few nanoseconds
    to perhaps tens of nanoseconds. That is way too short for many A/D
    converters to produce a result much less for a relatively slow
    microcontroller to respond. If you mean "pulses" which are typically
    longer you may be able to accomplish your goal using the BS2 but I
    would suggest that the A/D converter is not necessary unless you also
    need to know the magnitude of the pulse as opposed to just
    above/below the threshold.

    Secondly, there is the issue of the repetition rate. If the spikes
    or pulses happen faster than the microcontroller is able to register
    them you'll be unsuccessful. In this case, you might be able to add
    an external counter which will accumulate a count of the pulses that
    occur. The Stamp can reset the counter, wait for a period of time
    and then read the counter to get a measure of the average frequency
    of the pulses.

    Lastly, if the 1V threshold is important, you'll likely want to use a
    comparator so that you can get logic levels representing over/under
    conditions. Moreover, you probably also want the comparator to have
    hysteresis to avoid false logic transistions when the signal is near
    the threshold. How much hysteresis you need depends on the signal's
    rate of change and how noisy (electrically) the environment is. For
    example, you might add hysterisis that causes the comparator to
    output logic 1 when the input is above 1.25 volts but doesn't change
    back to logic 0 until the input falls below 0.75 volts. Perhaps 0.9V-
    1.1V is the right amount of hysteresis. You'll have to decide.
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-16 05:58
    I follow others and ask quantitative questions, things like the pulse
    frequency and duration and the expected pulse characteristics in
    general.

    At a minimum, if you can count pulses that are 1.3 volts threshold
    instead of 1 volt, you might just feed them into a stamp input, and
    use its built-in 1.3 volt threshold and the COUNT command. If the
    signal is noisy, you might have to add an RC filter. If the 1 volt
    threshold is necessary, you might be able to couple the signal in
    through a capacitor.

    The ADC will be useful only for very long events, not "spikes" in the
    way we usually think of that term.

    And it is a different thing if the spikes only occur once every hour,
    or if they occur a million times a second. Or if you have to
    distinguish between those that are 0.99 volt and others are 1.01
    volt. More detail please.



    >I want to count every time the voltage goes above 1 volt. I have a
    >BS II and a ADC0804 Annalog to digital converter, but I am a nubie to
    >all this. Can somebody give me some advice.
    >
    >I am not set on using the BS II or the ADC0804 if anybody knows an
    >easier way to accomplish this please tell me.
    >
    >Thank you,
    >
    >Nick
    >
    >
    >
    >To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    >from the same email address that you subscribed. Text in the
    >Subject and Body of the message will be ignored.
    >
    >Yahoo! Groups Links
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-18 00:01
    Thank you all for the helpful responces. All those who responded
    have inquired further about the characteristics of my "spike". I may
    be using the term incorrectly, but what I mean by a "spike" is
    probably more of an irratic distrubance (very noisy). This
    distrubance occurs at a variable rate. When viewed on a scope this
    signal looks like a big blob of fluctuating voltage (-1.4v to
    +1.4v). It lasts any where from 3 seconds to .003 second (depending
    on the rotational speed of my water velocity meter).

    Sombody mentioned the concept of hysteresis. This is something that
    I am strongly considering but don't understand. I was thinking of
    using a Schmitt trigger to help me count these repetitious voltage
    disturbances, but I really don't know much about them. It is my
    symplistic understanding that a Schmitt trigger could be turned on at
    a set voltage and turned off a a set voltage. This would be good!

    In any case I plan on using a diode to constrain the voltage to
    positive values.

    I would greatly appreciate continued advice regarding this problem.

    Thank you,

    Nick
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-18 17:26
    --- In basicstamps@yahoogroups.com, "Nick" <nickvanlan@h...> wrote:
    > I was thinking of using a Schmitt trigger to help me count these
    > repetitious voltage disturbances...

    A Schmitt trigger is a comparator with hysteresis. You still have to
    decide what the transition voltage will be and choose the resistor
    values to realize them. This link may help.

    http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/schmitt.html

    If your signal is noise as you describe, the transitions are likely
    to be much too fast for a BS to respond to them individually. You
    may need external circuitry to count them as I mentioned earlier.
Sign In or Register to comment.