Shop OBEX P1 Docs P2 Docs Learn Events
Pulse Conditioning for BS2 — Parallax Forums

Pulse Conditioning for BS2

ArchiverArchiver Posts: 46,084
edited 2002-01-01 14:45 in General Discussion
I am in the process of building a data logger for my car. It has an
onboard computer already, so many of the signals are there just
waiting to be logged. One of the more challenging channels has
turned out to be the rpm's. After toying with other ideas, I found
the signal going to the tach as the likely (relatively transient
free) signal source.

Here is what I know about the signal:

It is a square wave of some kind (per the cryptic manual), although I
do not know if it drives the tach via pulse width modulation or
frequency of pulses.

I probed the signal and found this:

at 850 rpms: 9.5vdc per multimeter, 85% duty cycle, 30ms positive
pulse, 5.2ms negative pulse

at 2000 rpms: 8.4vdc on multimeter, 75% duty cycle, 11.2ms pos pulse,
3.8ms neg pulse

at 3000 rpms: 7.2vdc, 63.5% duty cycle, 6.4/3.7 pos/neg pulses.

4 cylinder car, two sparks per revolution. Can anyone tell me how
the signal relates to rpms? Once I understand the signal, I need to
scale it down to fit into a BS2 input pin. ANy suggestions there?
Two resistors in series and a zener diode?

p.s. I am not sure I understand my multimeter pulse units. It
says "ms" but also seems to be auto-ranging (range 4? --Fluke), so it
may be some multiple of 10 times the readings quoted above.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-12-29 04:04
    Ok, sorry I rambled below. The signal I found generates one full
    cycle for each half revlotion of the motor. The math works perfectly.
    (At 2k rpms for example, the cycle is 15ms. Since there are 60k ms in
    a minute, there are 4k cycles in the signal per minute, or 2k rpms
    per minute. Same math works for other data given below as well.)

    BS2 questions:

    1) I would like to use pulsin to measure the pulse width on this
    signal, although I will need to read the entire cycle and not just
    the "on" time. How do I read the complete cycle time on a BS2? (I
    want to measure the time it takes go from one "low to high" to the
    next "low to high." ) Do I need to set up a flip flop? Any easier all-
    software way?

    2) The peak voltage of the signal is probably 12vdc, although the
    pulsing makes it read lower on the multimeter. Is it safe to read
    this signal directly to a BS2 input pin for the pulsin command?
    Assuming not, can anyone suggest a means of reducing the peak voltage
    to 5 volts without affecting the pulse cycle time?

    Thanks!



    --- In basicstamps@y..., "tomatlarge" <tomatlarge@y...> wrote:
    > I am in the process of building a data logger for my car. It has an
    > onboard computer already, so many of the signals are there just
    > waiting to be logged. One of the more challenging channels has
    > turned out to be the rpm's. After toying with other ideas, I found
    > the signal going to the tach as the likely (relatively transient
    > free) signal source.
    >
    > Here is what I know about the signal:
    >
    > It is a square wave of some kind (per the cryptic manual), although
    I
    > do not know if it drives the tach via pulse width modulation or
    > frequency of pulses.
    >
    > I probed the signal and found this:
    >
    > at 850 rpms: 9.5vdc per multimeter, 85% duty cycle, 30ms positive
    > pulse, 5.2ms negative pulse
    >
    > at 2000 rpms: 8.4vdc on multimeter, 75% duty cycle, 11.2ms pos
    pulse,
    > 3.8ms neg pulse
    >
    > at 3000 rpms: 7.2vdc, 63.5% duty cycle, 6.4/3.7 pos/neg pulses.
    >
    > 4 cylinder car, two sparks per revolution. Can anyone tell me how
    > the signal relates to rpms? Once I understand the signal, I need to
    > scale it down to fit into a BS2 input pin. ANy suggestions there?
    > Two resistors in series and a zener diode?
    >
    > p.s. I am not sure I understand my multimeter pulse units. It
    > says "ms" but also seems to be auto-ranging (range 4? --Fluke), so
    it
    > may be some multiple of 10 times the readings quoted above.
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-29 07:58
    Tom,
    Take two Pulsin measurements, one with the hi/low setting set to 0, and the
    other set to 1. Add the values, and you'll have a cycle length. Those two
    measurements won't be from the same cycle, but they'll be close enough for
    what you are doing.

    Use a voltage divider, a series of diodes, or an attenuator to drop the
    voltage. You'll want to make sure your circuit doesn't affect your tach.

    By the way, for solving problems you mentioned in your first email, I've
    found that Excel helps a lot to find out if signals are linear. You can
    punch in the pulse times for your three tach readings and look at a graph.

    Cliff


    Original Message
    From: "tomatlarge" <tomatlarge@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Friday, December 28, 2001 8:04 PM
    Subject: [noparse][[/noparse]basicstamps] Re: Pulse Conditioning for BS2



    Ok, sorry I rambled below. The signal I found generates one full
    cycle for each half revlotion of the motor. The math works perfectly.
    (At 2k rpms for example, the cycle is 15ms. Since there are 60k ms in
    a minute, there are 4k cycles in the signal per minute, or 2k rpms
    per minute. Same math works for other data given below as well.)

    BS2 questions:

    1) I would like to use pulsin to measure the pulse width on this
    signal, although I will need to read the entire cycle and not just
    the "on" time. How do I read the complete cycle time on a BS2? (I
    want to measure the time it takes go from one "low to high" to the
    next "low to high." ) Do I need to set up a flip flop? Any easier all-
    software way?

    2) The peak voltage of the signal is probably 12vdc, although the
    pulsing makes it read lower on the multimeter. Is it safe to read
    this signal directly to a BS2 input pin for the pulsin command?
    Assuming not, can anyone suggest a means of reducing the peak voltage
    to 5 volts without affecting the pulse cycle time?

    Thanks!



    --- In basicstamps@y..., "tomatlarge" <tomatlarge@y...> wrote:
    > I am in the process of building a data logger for my car. It has an
    > onboard computer already, so many of the signals are there just
    > waiting to be logged. One of the more challenging channels has
    > turned out to be the rpm's. After toying with other ideas, I found
    > the signal going to the tach as the likely (relatively transient
    > free) signal source.
    >
    > Here is what I know about the signal:
    >
    > It is a square wave of some kind (per the cryptic manual), although
    I
    > do not know if it drives the tach via pulse width modulation or
    > frequency of pulses.
    >
    > I probed the signal and found this:
    >
    > at 850 rpms: 9.5vdc per multimeter, 85% duty cycle, 30ms positive
    > pulse, 5.2ms negative pulse
    >
    > at 2000 rpms: 8.4vdc on multimeter, 75% duty cycle, 11.2ms pos
    pulse,
    > 3.8ms neg pulse
    >
    > at 3000 rpms: 7.2vdc, 63.5% duty cycle, 6.4/3.7 pos/neg pulses.
    >
    > 4 cylinder car, two sparks per revolution. Can anyone tell me how
    > the signal relates to rpms? Once I understand the signal, I need to
    > scale it down to fit into a BS2 input pin. ANy suggestions there?
    > Two resistors in series and a zener diode?
    >
    > p.s. I am not sure I understand my multimeter pulse units. It
    > says "ms" but also seems to be auto-ranging (range 4? --Fluke), so
    it
    > may be some multiple of 10 times the readings quoted above.


    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.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-29 08:34
    >Ok, sorry I rambled below. The signal I found generates one full
    >cycle for each half revlotion of the motor. The math works perfectly.
    >(At 2k rpms for example, the cycle is 15ms. Since there are 60k ms in
    >a minute, there are 4k cycles in the signal per minute, or 2k rpms
    >per minute. Same math works for other data given below as well.)
    >
    >BS2 questions:
    >
    >1) I would like to use pulsin to measure the pulse width on this
    >signal, although I will need to read the entire cycle and not just
    >the "on" time. How do I read the complete cycle time on a BS2? (I
    >want to measure the time it takes go from one "low to high" to the
    >next "low to high." ) Do I need to set up a flip flop? Any easier all-
    >software way?

    It is really a question of two full cycles. That could be handled by
    a divide-by-four circuit, or by one of the available pulse
    measurement modules. To do it all-software, you have to do four
    pulse measurements in succession and then combine them,assuming that
    the rpm does not change much in 2 revolutions.
    pulsin 0,0,[noparse][[/noparse]H1]
    pulsin 0,0,[noparse][[/noparse]H2]
    pulsin 0,1,[noparse][[/noparse]L1]
    pulsin 0,1,[noparse][[/noparse]L2]
    totalpulse=H1+H2+L1+L2


    >2) The peak voltage of the signal is probably 12vdc, although the
    >pulsing makes it read lower on the multimeter. Is it safe to read
    >this signal directly to a BS2 input pin for the pulsin command?
    >Assuming not, can anyone suggest a means of reducing the peak voltage
    >to 5 volts without affecting the pulse cycle time?

    You can connect it to the stamp through a voltage divider
    12v---/\/\-o-/\/\---Vss
    20k | 10k
    `
    p0

    In a pinch you can connect it through a single resistor
    12v
    /\/\
    P0
    47k to 100k

    But do _*not*_ connect it direct without a resistor or some kind of
    protection. If there is noise on the signal, you can put a small
    capacitor (~100pf or 1000pf) from the Stamp input to Vss to help.

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-29 09:35
    Can you identify the onboard computer at all? When my engine management
    system failed I did a search for the model number and came up with a whole
    pile of info about the diagnostics, including pinout details.

    Regards,

    Tony Wells


    Original Message
    From: "tomatlarge" <tomatlarge@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Saturday, December 29, 2001 3:20 AM
    Subject: [noparse][[/noparse]basicstamps] Pulse Conditioning for BS2


    > I am in the process of building a data logger for my car. It has an
    > onboard computer already, so many of the signals are there just
    > waiting to be logged. One of the more challenging channels has
    > turned out to be the rpm's. After toying with other ideas, I found
    > the signal going to the tach as the likely (relatively transient
    > free) signal source.
    >
    > Here is what I know about the signal:
    >
    > It is a square wave of some kind (per the cryptic manual), although I
    > do not know if it drives the tach via pulse width modulation or
    > frequency of pulses.
    >
    > I probed the signal and found this:
    >
    > at 850 rpms: 9.5vdc per multimeter, 85% duty cycle, 30ms positive
    > pulse, 5.2ms negative pulse
    >
    > at 2000 rpms: 8.4vdc on multimeter, 75% duty cycle, 11.2ms pos pulse,
    > 3.8ms neg pulse
    >
    > at 3000 rpms: 7.2vdc, 63.5% duty cycle, 6.4/3.7 pos/neg pulses.
    >
    > 4 cylinder car, two sparks per revolution. Can anyone tell me how
    > the signal relates to rpms? Once I understand the signal, I need to
    > scale it down to fit into a BS2 input pin. ANy suggestions there?
    > Two resistors in series and a zener diode?
    >
    > p.s. I am not sure I understand my multimeter pulse units. It
    > says "ms" but also seems to be auto-ranging (range 4? --Fluke), so it
    > may be some multiple of 10 times the readings quoted above.
    >
    >
    > 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.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-29 19:38
    Thanks for the suggestions. Why would I need 4 pulsin commands to get
    the time from one "low to high" to the next "low to high"? Isn't
    that just two pulsin commands? (Maybe I confused things by using the
    word "cycle" -- I meant one high pulse and one low pulse.) As for a
    voltage divider, my concern is that I not draw current from the car's
    signal. I'd like the stamp to behave as much like a high-impedance
    multi-meter as possible, to avoid any issues with the car's computer.
    How much current does the stamp need to register a high state?
    Could I, for example, use resistors near 1meg for the voltage divider?

    --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
    > >Ok, sorry I rambled below. The signal I found generates one full
    > >cycle for each half revlotion of the motor. The math works
    perfectly.
    > >(At 2k rpms for example, the cycle is 15ms. Since there are 60k ms
    in
    > >a minute, there are 4k cycles in the signal per minute, or 2k rpms
    > >per minute. Same math works for other data given below as well.)
    > >
    > >BS2 questions:
    > >
    > >1) I would like to use pulsin to measure the pulse width on this
    > >signal, although I will need to read the entire cycle and not just
    > >the "on" time. How do I read the complete cycle time on a BS2? (I
    > >want to measure the time it takes go from one "low to high" to the
    > >next "low to high." ) Do I need to set up a flip flop? Any easier
    all-
    > >software way?
    >
    > It is really a question of two full cycles. That could be handled
    by
    > a divide-by-four circuit, or by one of the available pulse
    > measurement modules. To do it all-software, you have to do four
    > pulse measurements in succession and then combine them,assuming
    that
    > the rpm does not change much in 2 revolutions.
    > pulsin 0,0,[noparse][[/noparse]H1]
    > pulsin 0,0,[noparse][[/noparse]H2]
    > pulsin 0,1,[noparse][[/noparse]L1]
    > pulsin 0,1,[noparse][[/noparse]L2]
    > totalpulse=H1+H2+L1+L2
    >
    >
    > >2) The peak voltage of the signal is probably 12vdc, although the
    > >pulsing makes it read lower on the multimeter. Is it safe to read
    > >this signal directly to a BS2 input pin for the pulsin command?
    > >Assuming not, can anyone suggest a means of reducing the peak
    voltage
    > >to 5 volts without affecting the pulse cycle time?
    >
    > You can connect it to the stamp through a voltage divider
    > 12v---/\/\-o-/\/\---Vss
    > 20k | 10k
    > `
    p0
    >
    > In a pinch you can connect it through a single resistor
    > 12v
    /\/\
    P0
    > 47k to 100k
    >
    > But do _*not*_ connect it direct without a resistor or some kind of
    > protection. If there is noise on the signal, you can put a small
    > capacitor (~100pf or 1000pf) from the Stamp input to Vss to help.
    >
    > -- regards,
    > Tracy Allen
    > electronically monitored ecosystems
    > mailto:tracy@e...
    > http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-29 20:50
    >Thanks for the suggestions. Why would I need 4 pulsin commands to get
    >the time from one "low to high" to the next "low to high"? Isn't
    >that just two pulsin commands? (Maybe I confused things by using the
    >word "cycle" -- I meant one high pulse and one low pulse.)

    I thought what you want is the time for one revolution. According to
    your data, the electrical signal has two full cycles during each
    revolution of the shaft. So to get the time for one full revolution,
    you have to measure two LOW times and two HIGH times.

    Here was your data:
    >at 2000 rpms: 8.4vdc on multimeter, 75% duty cycle, 11.2ms pos pulse,
    >3.8ms neg pulse

    The 11.2ms plus 3.8 ms add up to 15 ms. But the time for one
    revolution at 2000rpm is 30 milliseconds. That is where the factor
    of two comes from. I don't know how this is tied together
    mechanically. You might get away with timing one cycle and
    multiplying by two.

    The program works by sampling low and high pulses over two revolutions:
    (view with monospace font)

    |.....2 revs....|
    ---_---_---_---_---_---_---_---_---_
    a b c d e f g h

    pulsin 0,1,[noparse][[/noparse]H1] ' measures HIGH pulse a
    pulsin 0,1,[noparse][[/noparse]H2] ' measures HIGH pulse c
    pulsin 0,0,[noparse][[/noparse]L1] ' measures LOW pulse f
    pulsin 0,0,[noparse][[/noparse]L2] ' measures LOW pulse h
    totalpulse=H1+H2+L1+L2

    that should be the same as a+b+c+d for one revolution.

    >As for a
    >voltage divider, my concern is that I not draw current from the car's
    >signal. I'd like the stamp to behave as much like a high-impedance
    >multi-meter as possible, to avoid any issues with the car's computer.
    >How much current does the stamp need to register a high state?
    >Could I, for example, use resistors near 1meg for the voltage divider?

    You can try an experiment by putting a 100kohm resistor across the
    tach signal, and see on your voltmeter if there is any change. (This
    is another instance of measuring output resistance of the "black
    box", like we talked about earlier in this thread.) My guess is that
    the tach signal is at a low impedance level and 100kohm would not
    load it significantly. Its sourcing and sinking capabilities may be
    different. A bigger issue is ground loop noise in the nasty
    automotive environment. It might be wise to use an opto isolator;
    the tach would have to be able to source or sink a couple of
    milliamps to make that feasible.

    The stamp input is very high impedance, which means it needs
    practically zero current to register a high state. You can try it
    with one megaohm, but the signal might be too sluggish, due to stray
    capacitance in the circuit.

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-29 23:13
    I see. I was content timing half a revolution (i.e. from one "low to
    high" to the next "low to high") and you were trying to get the time
    for the complete revolution. I think I'll be fine just multiplying
    the half rev time by 2, but I think I understand it now, so thank you
    very much.

    When we last spoke of impedance, we were talking about an input on a
    black box. I put a resistor between my voltage signal and the black
    box and confirmed that there was no difference in voltage on either
    side of the resistor, and concluded it was a high impendance input,
    which gave me comfort that I would not blow it out by feeding it too
    much current. This time around, we are talking about an output on the
    same black box. Where are you suggesting I put the 100k resistor for
    this purpose? Just hang it off the end of the tach signal and see if
    I get less voltage on either side of the resistor? If the voltage is
    the same, then are you saying that the output from the black box
    is "low impendance?" And, if so, does that necessarily mean it can
    handle a voltage divider using resistors more in the 10k range? To
    me, logically, it just means that the voltage divider will not throw
    off the voltage signal running to the rest of the original circuit,
    but does not necessarily mean the black box's output can provide the
    current needed to run the voltage divider.

    And, to check my understanding, when I ran the first test to conclude
    the black box input was high impedance, then I think I also obtained
    evidence (unknowingly at the time) that the output of the voltage
    follower ciruit was low impedance. Yes?

    --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
    >
    > >Thanks for the suggestions. Why would I need 4 pulsin commands to
    get
    > >the time from one "low to high" to the next "low to high"? Isn't
    > >that just two pulsin commands? (Maybe I confused things by using
    the
    > >word "cycle" -- I meant one high pulse and one low pulse.)
    >
    > I thought what you want is the time for one revolution. According
    to
    > your data, the electrical signal has two full cycles during each
    > revolution of the shaft. So to get the time for one full
    revolution,
    > you have to measure two LOW times and two HIGH times.
    >
    > Here was your data:
    > >at 2000 rpms: 8.4vdc on multimeter, 75% duty cycle, 11.2ms pos
    pulse,
    > >3.8ms neg pulse
    >
    > The 11.2ms plus 3.8 ms add up to 15 ms. But the time for one
    > revolution at 2000rpm is 30 milliseconds. That is where the factor
    > of two comes from. I don't know how this is tied together
    > mechanically. You might get away with timing one cycle and
    > multiplying by two.
    >
    > The program works by sampling low and high pulses over two
    revolutions:
    > (view with monospace font)
    >
    > |.....2 revs....|
    > ---_---_---_---_---_---_---_---_---_
    > a b c d e f g h
    >
    > pulsin 0,1,[noparse][[/noparse]H1] ' measures HIGH pulse a
    > pulsin 0,1,[noparse][[/noparse]H2] ' measures HIGH pulse c
    > pulsin 0,0,[noparse][[/noparse]L1] ' measures LOW pulse f
    > pulsin 0,0,[noparse][[/noparse]L2] ' measures LOW pulse h
    > totalpulse=H1+H2+L1+L2
    >
    > that should be the same as a+b+c+d for one revolution.
    >
    > >As for a
    > >voltage divider, my concern is that I not draw current from the
    car's
    > >signal. I'd like the stamp to behave as much like a high-impedance
    > >multi-meter as possible, to avoid any issues with the car's
    computer.
    > >How much current does the stamp need to register a high state?
    > >Could I, for example, use resistors near 1meg for the voltage
    divider?
    >
    > You can try an experiment by putting a 100kohm resistor across the
    > tach signal, and see on your voltmeter if there is any change.
    (This
    > is another instance of measuring output resistance of the "black
    > box", like we talked about earlier in this thread.) My guess is
    that
    > the tach signal is at a low impedance level and 100kohm would not
    > load it significantly. Its sourcing and sinking capabilities may
    be
    > different. A bigger issue is ground loop noise in the nasty
    > automotive environment. It might be wise to use an opto isolator;
    > the tach would have to be able to source or sink a couple of
    > milliamps to make that feasible.
    >
    > The stamp input is very high impedance, which means it needs
    > practically zero current to register a high state. You can try it
    > with one megaohm, but the signal might be too sluggish, due to
    stray
    > capacitance in the circuit.
    >
    > -- regards,
    > Tracy Allen
    > electronically monitored ecosystems
    > mailto:tracy@e...
    > http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-30 00:41
    Well, I put a 100k resistor on the tach signal and there was about
    a .1volt difference on the voltmeter on either side of the resistor.
    (The volt reading reflects an 85% "on" pulsed 12vdc signal, so the
    actual voltage drop may be slightly greater.) For reference, the tach
    signal is still fully functioning in its circuit. It goes from the
    black box directly to the tach, and also directly to another black
    box that uses it to create the ignition timing signal. I just tapped
    into it to check the voltage/pulse. The voltage was .1vdc lower when
    I checked it through a 100k resistor.


    --- In basicstamps@y..., "tomatlarge" <tomatlarge@y...> wrote:
    > I see. I was content timing half a revolution (i.e. from one "low
    to
    > high" to the next "low to high") and you were trying to get the
    time
    > for the complete revolution. I think I'll be fine just multiplying
    > the half rev time by 2, but I think I understand it now, so thank
    you
    > very much.
    >
    > When we last spoke of impedance, we were talking about an input on
    a
    > black box. I put a resistor between my voltage signal and the black
    > box and confirmed that there was no difference in voltage on either
    > side of the resistor, and concluded it was a high impendance input,
    > which gave me comfort that I would not blow it out by feeding it
    too
    > much current. This time around, we are talking about an output on
    the
    > same black box. Where are you suggesting I put the 100k resistor
    for
    > this purpose? Just hang it off the end of the tach signal and see
    if
    > I get less voltage on either side of the resistor? If the voltage
    is
    > the same, then are you saying that the output from the black box
    > is "low impendance?" And, if so, does that necessarily mean it can
    > handle a voltage divider using resistors more in the 10k range? To
    > me, logically, it just means that the voltage divider will not
    throw
    > off the voltage signal running to the rest of the original circuit,
    > but does not necessarily mean the black box's output can provide
    the
    > current needed to run the voltage divider.
    >
    > And, to check my understanding, when I ran the first test to
    conclude
    > the black box input was high impedance, then I think I also
    obtained
    > evidence (unknowingly at the time) that the output of the voltage
    > follower ciruit was low impedance. Yes?
    >
    > --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
    > >
    > > >Thanks for the suggestions. Why would I need 4 pulsin commands
    to
    > get
    > > >the time from one "low to high" to the next "low to high"? Isn't
    > > >that just two pulsin commands? (Maybe I confused things by
    using
    > the
    > > >word "cycle" -- I meant one high pulse and one low pulse.)
    > >
    > > I thought what you want is the time for one revolution. According
    > to
    > > your data, the electrical signal has two full cycles during each
    > > revolution of the shaft. So to get the time for one full
    > revolution,
    > > you have to measure two LOW times and two HIGH times.
    > >
    > > Here was your data:
    > > >at 2000 rpms: 8.4vdc on multimeter, 75% duty cycle, 11.2ms pos
    > pulse,
    > > >3.8ms neg pulse
    > >
    > > The 11.2ms plus 3.8 ms add up to 15 ms. But the time for one
    > > revolution at 2000rpm is 30 milliseconds. That is where the
    factor
    > > of two comes from. I don't know how this is tied together
    > > mechanically. You might get away with timing one cycle and
    > > multiplying by two.
    > >
    > > The program works by sampling low and high pulses over two
    > revolutions:
    > > (view with monospace font)
    > >
    > > |.....2 revs....|
    > > ---_---_---_---_---_---_---_---_---_
    > > a b c d e f g h
    > >
    > > pulsin 0,1,[noparse][[/noparse]H1] ' measures HIGH pulse a
    > > pulsin 0,1,[noparse][[/noparse]H2] ' measures HIGH pulse c
    > > pulsin 0,0,[noparse][[/noparse]L1] ' measures LOW pulse f
    > > pulsin 0,0,[noparse][[/noparse]L2] ' measures LOW pulse h
    > > totalpulse=H1+H2+L1+L2
    > >
    > > that should be the same as a+b+c+d for one revolution.
    > >
    > > >As for a
    > > >voltage divider, my concern is that I not draw current from the
    > car's
    > > >signal. I'd like the stamp to behave as much like a high-
    impedance
    > > >multi-meter as possible, to avoid any issues with the car's
    > computer.
    > > >How much current does the stamp need to register a high state?
    > > >Could I, for example, use resistors near 1meg for the voltage
    > divider?
    > >
    > > You can try an experiment by putting a 100kohm resistor across
    the
    > > tach signal, and see on your voltmeter if there is any change.
    > (This
    > > is another instance of measuring output resistance of the "black
    > > box", like we talked about earlier in this thread.) My guess is
    > that
    > > the tach signal is at a low impedance level and 100kohm would not
    > > load it significantly. Its sourcing and sinking capabilities may
    > be
    > > different. A bigger issue is ground loop noise in the nasty
    > > automotive environment. It might be wise to use an opto
    isolator;
    > > the tach would have to be able to source or sink a couple of
    > > milliamps to make that feasible.
    > >
    > > The stamp input is very high impedance, which means it needs
    > > practically zero current to register a high state. You can try
    it
    > > with one megaohm, but the signal might be too sluggish, due to
    > stray
    > > capacitance in the circuit.
    > >
    > > -- regards,
    > > Tracy Allen
    > > electronically monitored ecosystems
    > > mailto:tracy@e...
    > > http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-30 06:57
    >Well, I put a 100k resistor on the tach signal and there was about
    >a .1volt difference on the voltmeter on either side of the resistor.
    >(The volt reading reflects an 85% "on" pulsed 12vdc signal, so the
    >actual voltage drop may be slightly greater.) For reference, the tach
    >signal is still fully functioning in its circuit. It goes from the
    >black box directly to the tach, and also directly to another black
    >box that uses it to create the ignition timing signal. I just tapped
    >into it to check the voltage/pulse. The voltage was .1vdc lower when
    >I checked it through a 100k resistor.

    That experiment allows you to estimate the input resistance. I think
    you added the 100k resistor as follows:

    "black box 1 output" ----/\/\---- "black box 2+3 input"
    100k

    The voltage on the left side of the resistor was about 0.1 volt
    greater than the voltage on the right, say 10 volts and 9.9 volts.
    Yes? That lets you estimate the input resistance of black box 2+3.
    The current through the 100kohm resistor is V/R = 0.1/100000 =~ 1
    microamp. That 1 microamp also flows through the input resistance of
    black box #2+3, which has 9.9 volts across it. So the input
    resistance is, R=V/I=9.9 megaohms. Roughly 10 megaohms, give or take
    a few. Pretty high.

    To measure the output resistance of black box 1, connect the 100kohms
    as follows:

    "black box 1 output" --o
    "black box 2+3 input"
    |
    |
    Vss---/\/\
    '
    100kohm

    That is, direct from the output to ground. What is the voltage
    before and after you connect in the resistor? E.g., 10.0 before, 9.9
    after. If there is no change, then try 10k or even 1k. If there is
    no change at all, then the output resistance is much much less than
    the value of resistance you are trying. If the output drops to 1/2
    of its original value, then the output resistance equals the added
    resistance. The point is, if you add your own "black box" to the
    circuit, you do not want to load it down too much. The test give you
    an estimate of how much is too much.

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-30 10:43
    Oops, I think I mistook your original suggestion. I connected a wire
    to the tach signal going from one black box to the other. Using a
    multimeter on the tapped line (red lead to tapped line, black lead to
    ground), I found the pulse and voltages I listed yesterday. Today, I
    put a 100k resistor on the end of the tapped line (in series between
    the tapped line and the red lead of the multimeter). With the
    resistor in place, I have about.1vdc less than without the resistor.
    I thought about doing it like your second suggestion (100k to ground)
    but got paramoid. At any rate, I ended up making a voltage follower
    out of an LM358, and sent my tach signal to it through a 100k
    resistor. I then used a voltage divider on the 12v output of the
    LM358, and everything seems to be working fine. I assumed (hopefully
    correctly) that the LM358 with 100k resistor would have virtually no
    effect on the rest of the circuit, and that the votage divider on the
    output side of the LM358 (using 10k and 20k resistors) would not over-
    tax the LM358 output. At least it all seems to work...sound ok? I am
    reading up on basic electronics and am admittedly a bit stumped on
    the impedance concept. Your help has been invaluable...I'll get
    there. Now, I am starting to struggle with BS2 math calculations to
    turn my pulse readings into actual rpms. I found your write-up in the
    FAQ, but may be looking for help soon. I need to divide 30000 by the
    pulse width (in milliseconds) I measure, and I'm trying to do it
    without taking up too much cpu time. I'll play with that tomorrow.
    Thanks again.

    --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
    > >Well, I put a 100k resistor on the tach signal and there was about
    > >a .1volt difference on the voltmeter on either side of the
    resistor.
    > >(The volt reading reflects an 85% "on" pulsed 12vdc signal, so the
    > >actual voltage drop may be slightly greater.) For reference, the
    tach
    > >signal is still fully functioning in its circuit. It goes from the
    > >black box directly to the tach, and also directly to another black
    > >box that uses it to create the ignition timing signal. I just
    tapped
    > >into it to check the voltage/pulse. The voltage was .1vdc lower
    when
    > >I checked it through a 100k resistor.
    >
    > That experiment allows you to estimate the input resistance. I
    think
    > you added the 100k resistor as follows:
    >
    > "black box 1 output" ----/\/\---- "black box 2+3 input"
    > 100k
    >
    > The voltage on the left side of the resistor was about 0.1 volt
    > greater than the voltage on the right, say 10 volts and 9.9 volts.
    > Yes? That lets you estimate the input resistance of black box 2+3.
    > The current through the 100kohm resistor is V/R = 0.1/100000 =~ 1
    > microamp. That 1 microamp also flows through the input resistance
    of
    > black box #2+3, which has 9.9 volts across it. So the input
    > resistance is, R=V/I=9.9 megaohms. Roughly 10 megaohms, give or
    take
    > a few. Pretty high.
    >
    > To measure the output resistance of black box 1, connect the
    100kohms
    > as follows:
    >
    > "black box 1 output" --o
    "black box 2+3 input"
    > |
    > |
    > Vss---/\/\
    '
    > 100kohm
    >
    > That is, direct from the output to ground. What is the voltage
    > before and after you connect in the resistor? E.g., 10.0 before,
    9.9
    > after. If there is no change, then try 10k or even 1k. If there
    is
    > no change at all, then the output resistance is much much less than
    > the value of resistance you are trying. If the output drops to 1/2
    > of its original value, then the output resistance equals the added
    > resistance. The point is, if you add your own "black box" to the
    > circuit, you do not want to load it down too much. The test give
    you
    > an estimate of how much is too much.
    >
    > -- regards,
    > Tracy Allen
    > electronically monitored ecosystems
    > mailto:tracy@e...
    > http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-30 12:00
    Hi ,

    Perhaps I've missed something here. Forgive me if I have.

    Wouldn't it be easier to count the number of cpu cycles between each pulse?
    If the pulses are too short an interval, use a divide by 10 or divide by 100
    counter.

    Yes, you would have to calibrate it, but the code would be simpler, and you
    can choose when to sample - say once per second.

    Regards,

    Tony

    Original Message
    From: "tomatlarge" <tomatlarge@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Sunday, December 30, 2001 10:43 AM
    Subject: [noparse][[/noparse]basicstamps] Re: Pulse Conditioning for BS2


    > Oops, I think I mistook your original suggestion. I connected a wire
    > to the tach signal going from one black box to the other. Using a
    > multimeter on the tapped line (red lead to tapped line, black lead to
    > ground), I found the pulse and voltages I listed yesterday. Today, I
    > put a 100k resistor on the end of the tapped line (in series between
    > the tapped line and the red lead of the multimeter). With the
    > resistor in place, I have about.1vdc less than without the resistor.
    > I thought about doing it like your second suggestion (100k to ground)
    > but got paramoid. At any rate, I ended up making a voltage follower
    > out of an LM358, and sent my tach signal to it through a 100k
    > resistor. I then used a voltage divider on the 12v output of the
    > LM358, and everything seems to be working fine. I assumed (hopefully
    > correctly) that the LM358 with 100k resistor would have virtually no
    > effect on the rest of the circuit, and that the votage divider on the
    > output side of the LM358 (using 10k and 20k resistors) would not over-
    > tax the LM358 output. At least it all seems to work...sound ok? I am
    > reading up on basic electronics and am admittedly a bit stumped on
    > the impedance concept. Your help has been invaluable...I'll get
    > there. Now, I am starting to struggle with BS2 math calculations to
    > turn my pulse readings into actual rpms. I found your write-up in the
    > FAQ, but may be looking for help soon. I need to divide 30000 by the
    > pulse width (in milliseconds) I measure, and I'm trying to do it
    > without taking up too much cpu time. I'll play with that tomorrow.
    > Thanks again.
    >
    > --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
    > > >Well, I put a 100k resistor on the tach signal and there was about
    > > >a .1volt difference on the voltmeter on either side of the
    > resistor.
    > > >(The volt reading reflects an 85% "on" pulsed 12vdc signal, so the
    > > >actual voltage drop may be slightly greater.) For reference, the
    > tach
    > > >signal is still fully functioning in its circuit. It goes from the
    > > >black box directly to the tach, and also directly to another black
    > > >box that uses it to create the ignition timing signal. I just
    > tapped
    > > >into it to check the voltage/pulse. The voltage was .1vdc lower
    > when
    > > >I checked it through a 100k resistor.
    > >
    > > That experiment allows you to estimate the input resistance. I
    > think
    > > you added the 100k resistor as follows:
    > >
    > > "black box 1 output" ----/\/\---- "black box 2+3 input"
    > > 100k
    > >
    > > The voltage on the left side of the resistor was about 0.1 volt
    > > greater than the voltage on the right, say 10 volts and 9.9 volts.
    > > Yes? That lets you estimate the input resistance of black box 2+3.
    > > The current through the 100kohm resistor is V/R = 0.1/100000 =~ 1
    > > microamp. That 1 microamp also flows through the input resistance
    > of
    > > black box #2+3, which has 9.9 volts across it. So the input
    > > resistance is, R=V/I=9.9 megaohms. Roughly 10 megaohms, give or
    > take
    > > a few. Pretty high.
    > >
    > > To measure the output resistance of black box 1, connect the
    > 100kohms
    > > as follows:
    > >
    > > "black box 1 output" --o
    "black box 2+3 input"
    > > |
    > > |
    > > Vss---/\/\
    '
    > > 100kohm
    > >
    > > That is, direct from the output to ground. What is the voltage
    > > before and after you connect in the resistor? E.g., 10.0 before,
    > 9.9
    > > after. If there is no change, then try 10k or even 1k. If there
    > is
    > > no change at all, then the output resistance is much much less than
    > > the value of resistance you are trying. If the output drops to 1/2
    > > of its original value, then the output resistance equals the added
    > > resistance. The point is, if you add your own "black box" to the
    > > circuit, you do not want to load it down too much. The test give
    > you
    > > an estimate of how much is too much.
    > >
    > > -- regards,
    > > Tracy Allen
    > > electronically monitored ecosystems
    > > mailto:tracy@e...
    > > http://www.emesystems.com
    >
    >
    > 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.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-30 20:16
    >Today, I
    >put a 100k resistor on the end of the tapped line (in series between
    >the tapped line and the red lead of the multimeter). With the
    >resistor in place, I have about.1vdc less than without the resistor.

    You have measured the input resistance of your multimeter!

    >I thought about doing it like your second suggestion (100k to ground)
    >but got paramoid.

    All advice here is taken strictly at your own risk!

    >At any rate, I ended up making a voltage follower
    >out of an LM358, and sent my tach signal to it through a 100k
    >resistor. I then used a voltage divider on the 12v output of the
    >LM358, and everything seems to be working fine. I assumed (hopefully
    >correctly) that the LM358 with 100k resistor would have virtually no
    >effect on the rest of the circuit, and that the votage divider on the
    >output side of the LM358 (using 10k and 20k resistors) would not over-
    >tax the LM358 output. At least it all seems to work...sound ok?

    Yes.

    >Now, I am starting to struggle with BS2 math calculations to
    >turn my pulse readings into actual rpms. I found your write-up in the
    >FAQ, but may be looking for help soon. I need to divide 30000 by the
    >pulse width (in milliseconds) I measure, and I'm trying to do it
    >without taking up too much cpu time.

    E.g., 30000/15=2000 rpm, but 30000/14=2143rpm, quite a big unit step
    of 143, no? What resolution do you expect?

    The pulse width from the pulsin commnad will be in units of 2
    microseconds, e.g. 15 milliseconds will come out as PW=7500 counts.
    The measurement of pulse width has lots of resolution, 4 digits. On
    the face of it, 15000000/7500 = 2000 but the numerator is too big for
    the Stamp to handle in one step. The Stamp can handle it as
    (shortcut #2 at <http://www.emesystems.com/BS2math2.htm>)
    ' 150000/(PW/100) = 600000/(PW/25)
    PW=PW/25 ' scale down
    RPM = 60000/PW*10+(60000//PW*10/PW)

    Thus when PW=7500, PW/25=300, RPM=2000
    and when PW=7475, PW/25=299, RPM=2006
    A unit step of 6.
    There are more accurate methods, but they would take more CPU time.

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-30 23:06
    That math works great. A resolution of 6 rpms is better than good
    enough. I seem to be having some real word "issues" however,
    probably relating to my voltage follower. First, the program does not
    want to work in the car unless I touch either or both of the power
    supply leads...makes me think I need a capacitor somewhere. Second,
    when the program is running, the pulsin command generates slightly
    smaller pulse times than is actually on the tach signal (according to
    my Fluke), resulting in slightly higher than real rpms. As I
    mentioned, I used an LM358 as a voltage follower, and split the
    output of the LM358 with a 10k and 20k resistor. Could that be
    throwing off the timing? I am measuring one low and one high pulse
    and adding them together, so I would think the result should be the
    same even if the output is shifted a bit. For what it is worth, I may
    try smaller resistors on the voltage dividers, since I cannot get my
    Fluke to pick up the pulse at all when measuring in the middle of the
    divider (which is where the Stamp is getting the pulse). I'm getting
    there! Thanks.

    --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
    > >Today, I
    > >put a 100k resistor on the end of the tapped line (in series
    between
    > >the tapped line and the red lead of the multimeter). With the
    > >resistor in place, I have about.1vdc less than without the
    resistor.
    >
    > You have measured the input resistance of your multimeter!
    >
    > >I thought about doing it like your second suggestion (100k to
    ground)
    > >but got paramoid.
    >
    > All advice here is taken strictly at your own risk!
    >
    > >At any rate, I ended up making a voltage follower
    > >out of an LM358, and sent my tach signal to it through a 100k
    > >resistor. I then used a voltage divider on the 12v output of the
    > >LM358, and everything seems to be working fine. I assumed
    (hopefully
    > >correctly) that the LM358 with 100k resistor would have virtually
    no
    > >effect on the rest of the circuit, and that the votage divider on
    the
    > >output side of the LM358 (using 10k and 20k resistors) would not
    over-
    > >tax the LM358 output. At least it all seems to work...sound ok?
    >
    > Yes.
    >
    > >Now, I am starting to struggle with BS2 math calculations to
    > >turn my pulse readings into actual rpms. I found your write-up in
    the
    > >FAQ, but may be looking for help soon. I need to divide 30000 by
    the
    > >pulse width (in milliseconds) I measure, and I'm trying to do it
    > >without taking up too much cpu time.
    >
    > E.g., 30000/15=2000 rpm, but 30000/14=2143rpm, quite a big unit
    step
    > of 143, no? What resolution do you expect?
    >
    > The pulse width from the pulsin commnad will be in units of 2
    > microseconds, e.g. 15 milliseconds will come out as PW=7500 counts.
    > The measurement of pulse width has lots of resolution, 4 digits.
    On
    > the face of it, 15000000/7500 = 2000 but the numerator is too big
    for
    > the Stamp to handle in one step. The Stamp can handle it as
    > (shortcut #2 at <http://www.emesystems.com/BS2math2.htm>)
    > ' 150000/(PW/100) = 600000/(PW/25)
    > PW=PW/25 ' scale down
    > RPM = 60000/PW*10+(60000//PW*10/PW)
    >
    > Thus when PW=7500, PW/25=300, RPM=2000
    > and when PW=7475, PW/25=299, RPM=2006
    > A unit step of 6.
    > There are more accurate methods, but they would take more CPU time.
    >
    > -- regards,
    > Tracy Allen
    > electronically monitored ecosystems
    > mailto:tracy@e...
    > http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-30 23:12
    I'm not sure I follow this suggestion. The pulse is, for example, on
    for 30ms and off for 5ms, repeating, or faster. SO, I think I measure
    the on or off pulses, or some collection of on and off pulses, and
    calculate an rpm from that. I'm not sure what you mean when you
    say "between each pulse"? The signal is plus 12 volts for a few ms
    and 0 volts for a few milliseconds, over and over. Am I missing your
    point?

    --- In basicstamps@y..., tony.wells@a... wrote:
    > Hi ,
    >
    > Perhaps I've missed something here. Forgive me if I have.
    >
    > Wouldn't it be easier to count the number of cpu cycles between
    each pulse?
    > If the pulses are too short an interval, use a divide by 10 or
    divide by 100
    > counter.
    >
    > Yes, you would have to calibrate it, but the code would be simpler,
    and you
    > can choose when to sample - say once per second.
    >
    > Regards,
    >
    > Tony
    >
    >
    Original Message
    > From: "tomatlarge" <tomatlarge@y...>
    > To: <basicstamps@y...>
    > Sent: Sunday, December 30, 2001 10:43 AM
    > Subject: [noparse][[/noparse]basicstamps] Re: Pulse Conditioning for BS2
    >
    >
    > > Oops, I think I mistook your original suggestion. I connected a
    wire
    > > to the tach signal going from one black box to the other. Using a
    > > multimeter on the tapped line (red lead to tapped line, black
    lead to
    > > ground), I found the pulse and voltages I listed yesterday.
    Today, I
    > > put a 100k resistor on the end of the tapped line (in series
    between
    > > the tapped line and the red lead of the multimeter). With the
    > > resistor in place, I have about.1vdc less than without the
    resistor.
    > > I thought about doing it like your second suggestion (100k to
    ground)
    > > but got paramoid. At any rate, I ended up making a voltage
    follower
    > > out of an LM358, and sent my tach signal to it through a 100k
    > > resistor. I then used a voltage divider on the 12v output of the
    > > LM358, and everything seems to be working fine. I assumed
    (hopefully
    > > correctly) that the LM358 with 100k resistor would have virtually
    no
    > > effect on the rest of the circuit, and that the votage divider on
    the
    > > output side of the LM358 (using 10k and 20k resistors) would not
    over-
    > > tax the LM358 output. At least it all seems to work...sound ok?
    I am
    > > reading up on basic electronics and am admittedly a bit stumped on
    > > the impedance concept. Your help has been invaluable...I'll get
    > > there. Now, I am starting to struggle with BS2 math calculations
    to
    > > turn my pulse readings into actual rpms. I found your write-up in
    the
    > > FAQ, but may be looking for help soon. I need to divide 30000 by
    the
    > > pulse width (in milliseconds) I measure, and I'm trying to do it
    > > without taking up too much cpu time. I'll play with that tomorrow.
    > > Thanks again.
    > >
    > > --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
    > > > >Well, I put a 100k resistor on the tach signal and there was
    about
    > > > >a .1volt difference on the voltmeter on either side of the
    > > resistor.
    > > > >(The volt reading reflects an 85% "on" pulsed 12vdc signal, so
    the
    > > > >actual voltage drop may be slightly greater.) For reference,
    the
    > > tach
    > > > >signal is still fully functioning in its circuit. It goes from
    the
    > > > >black box directly to the tach, and also directly to another
    black
    > > > >box that uses it to create the ignition timing signal. I just
    > > tapped
    > > > >into it to check the voltage/pulse. The voltage was .1vdc lower
    > > when
    > > > >I checked it through a 100k resistor.
    > > >
    > > > That experiment allows you to estimate the input resistance. I
    > > think
    > > > you added the 100k resistor as follows:
    > > >
    > > > "black box 1 output" ----/\/\---- "black box 2+3 input"
    > > > 100k
    > > >
    > > > The voltage on the left side of the resistor was about 0.1 volt
    > > > greater than the voltage on the right, say 10 volts and 9.9
    volts.
    > > > Yes? That lets you estimate the input resistance of black box
    2+3.
    > > > The current through the 100kohm resistor is V/R = 0.1/100000 =~
    1
    > > > microamp. That 1 microamp also flows through the input
    resistance
    > > of
    > > > black box #2+3, which has 9.9 volts across it. So the input
    > > > resistance is, R=V/I=9.9 megaohms. Roughly 10 megaohms, give or
    > > take
    > > > a few. Pretty high.
    > > >
    > > > To measure the output resistance of black box 1, connect the
    > > 100kohms
    > > > as follows:
    > > >
    > > > "black box 1 output" --o
    "black box 2+3 input"
    > > > |
    > > > |
    > > > Vss---/\/\
    '
    > > > 100kohm
    > > >
    > > > That is, direct from the output to ground. What is the voltage
    > > > before and after you connect in the resistor? E.g., 10.0
    before,
    > > 9.9
    > > > after. If there is no change, then try 10k or even 1k. If
    there
    > > is
    > > > no change at all, then the output resistance is much much less
    than
    > > > the value of resistance you are trying. If the output drops to
    1/2
    > > > of its original value, then the output resistance equals the
    added
    > > > resistance. The point is, if you add your own "black box" to
    the
    > > > circuit, you do not want to load it down too much. The test
    give
    > > you
    > > > an estimate of how much is too much.
    > > >
    > > > -- regards,
    > > > Tracy Allen
    > > > electronically monitored ecosystems
    > > > mailto:tracy@e...
    > > > http://www.emesystems.com
    > >
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@y...
    > > from the same email address that you subscribed. Text in the
    Subject and
    > Body of the message will be ignored.
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
    > >
    > >
    > >
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-31 02:31
    Hi Tom,

    I may have missed some earlier postings, and I am a bit sleepy today (5
    day-old baby). So if I'm just talking rubbish or repeating other posts then
    just ignore me ;-)

    This is a long posting......

    What I'm trying to say is that for a given engine speed, the pulses are
    occuring at a rate which is related to the engine speed - which you know
    already. Using your example, you get an ON for 30ms then an OFF for 5 ms at
    say 1000 rpm. If the speed is 2000 rpm then the pulses occur as an ON at
    15ms and OFF for 5ms.

    If this is the case, what you *can* do, is to cycle the CPU (eg count up
    some variable) during the ON period and count the CPU cycles when the pin is
    ON, and stop when the pin is OFF.

    The CPU cycles, or count variable value then has a relationship to the
    rpm.

    Now the Basic stamp is slower than Mr. Tortoise in Tortoiseville. It is
    entirely likely that it won't be able to cycle a counter many times at 30ms
    or less, so the accuracy will be poo. The classic way of solving this is to
    put the On/Off pulses into a divider chain - say a divide by 100.

    This has three effects. Firstly it makes the on-off ratio of the pulses
    50:50 - which can be quite handy when counting numbers. Secondly, and more
    importantly, the pulses are now streeeeeeched out, and the slow CPU can
    increment a counter more times during the ON period.

    The third effect is extremely interesting. Because it will take 100 on/offs
    as input before you get an output, and because the on/offs are never going
    to be the same value (as the engine revs are never constant) then the
    divider chain will sort of average up the values. This will produce a sort
    of hysteresis effect, similar to a real needle on a analogue tacho.

    Now, once you have installed the divide by 100 counter and identified the
    count values for given rpms, you can then work out the relationship between
    counts and RPM. You might have to fiddle with a timing constant when
    counting to make the values neat.

    Once the counting routine is ok, all you have to do is (say) once a second
    run the counting routine - make the routine wait until a new pulse comes in,
    then do your counting.


    I hope all this makes sense.....

    Regards,

    Toyn Wells

    Original Message
    From: "tomatlarge" <tomatlarge@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Sunday, December 30, 2001 11:12 PM
    Subject: [noparse][[/noparse]basicstamps] Re: Pulse Conditioning for BS2


    > I'm not sure I follow this suggestion. The pulse is, for example, on
    > for 30ms and off for 5ms, repeating, or faster. SO, I think I measure
    > the on or off pulses, or some collection of on and off pulses, and
    > calculate an rpm from that. I'm not sure what you mean when you
    > say "between each pulse"? The signal is plus 12 volts for a few ms
    > and 0 volts for a few milliseconds, over and over. Am I missing your
    > point?
    >
    > --- In basicstamps@y..., tony.wells@a... wrote:
    > > Hi ,
    > >
    > > Perhaps I've missed something here. Forgive me if I have.
    > >
    > > Wouldn't it be easier to count the number of cpu cycles between
    > each pulse?
    > > If the pulses are too short an interval, use a divide by 10 or
    > divide by 100
    > > counter.
    > >
    > > Yes, you would have to calibrate it, but the code would be simpler,
    > and you
    > > can choose when to sample - say once per second.
    > >
    > > Regards,
    > >
    > > Tony
    > >
    > >
    Original Message
    > > From: "tomatlarge" <tomatlarge@y...>
    > > To: <basicstamps@y...>
    > > Sent: Sunday, December 30, 2001 10:43 AM
    > > Subject: [noparse][[/noparse]basicstamps] Re: Pulse Conditioning for BS2
    > >
    > >
    > > > Oops, I think I mistook your original suggestion. I connected a
    > wire
    > > > to the tach signal going from one black box to the other. Using a
    > > > multimeter on the tapped line (red lead to tapped line, black
    > lead to
    > > > ground), I found the pulse and voltages I listed yesterday.
    > Today, I
    > > > put a 100k resistor on the end of the tapped line (in series
    > between
    > > > the tapped line and the red lead of the multimeter). With the
    > > > resistor in place, I have about.1vdc less than without the
    > resistor.
    > > > I thought about doing it like your second suggestion (100k to
    > ground)
    > > > but got paramoid. At any rate, I ended up making a voltage
    > follower
    > > > out of an LM358, and sent my tach signal to it through a 100k
    > > > resistor. I then used a voltage divider on the 12v output of the
    > > > LM358, and everything seems to be working fine. I assumed
    > (hopefully
    > > > correctly) that the LM358 with 100k resistor would have virtually
    > no
    > > > effect on the rest of the circuit, and that the votage divider on
    > the
    > > > output side of the LM358 (using 10k and 20k resistors) would not
    > over-
    > > > tax the LM358 output. At least it all seems to work...sound ok?
    > I am
    > > > reading up on basic electronics and am admittedly a bit stumped on
    > > > the impedance concept. Your help has been invaluable...I'll get
    > > > there. Now, I am starting to struggle with BS2 math calculations
    > to
    > > > turn my pulse readings into actual rpms. I found your write-up in
    > the
    > > > FAQ, but may be looking for help soon. I need to divide 30000 by
    > the
    > > > pulse width (in milliseconds) I measure, and I'm trying to do it
    > > > without taking up too much cpu time. I'll play with that tomorrow.
    > > > Thanks again.
    > > >
    > > > --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
    > > > > >Well, I put a 100k resistor on the tach signal and there was
    > about
    > > > > >a .1volt difference on the voltmeter on either side of the
    > > > resistor.
    > > > > >(The volt reading reflects an 85% "on" pulsed 12vdc signal, so
    > the
    > > > > >actual voltage drop may be slightly greater.) For reference,
    > the
    > > > tach
    > > > > >signal is still fully functioning in its circuit. It goes from
    > the
    > > > > >black box directly to the tach, and also directly to another
    > black
    > > > > >box that uses it to create the ignition timing signal. I just
    > > > tapped
    > > > > >into it to check the voltage/pulse. The voltage was .1vdc lower
    > > > when
    > > > > >I checked it through a 100k resistor.
    > > > >
    > > > > That experiment allows you to estimate the input resistance. I
    > > > think
    > > > > you added the 100k resistor as follows:
    > > > >
    > > > > "black box 1 output" ----/\/\---- "black box 2+3 input"
    > > > > 100k
    > > > >
    > > > > The voltage on the left side of the resistor was about 0.1 volt
    > > > > greater than the voltage on the right, say 10 volts and 9.9
    > volts.
    > > > > Yes? That lets you estimate the input resistance of black box
    > 2+3.
    > > > > The current through the 100kohm resistor is V/R = 0.1/100000 =~
    > 1
    > > > > microamp. That 1 microamp also flows through the input
    > resistance
    > > > of
    > > > > black box #2+3, which has 9.9 volts across it. So the input
    > > > > resistance is, R=V/I=9.9 megaohms. Roughly 10 megaohms, give or
    > > > take
    > > > > a few. Pretty high.
    > > > >
    > > > > To measure the output resistance of black box 1, connect the
    > > > 100kohms
    > > > > as follows:
    > > > >
    > > > > "black box 1 output" --o
    "black box 2+3 input"
    > > > > |
    > > > > |
    > > > > Vss---/\/\
    '
    > > > > 100kohm
    > > > >
    > > > > That is, direct from the output to ground. What is the voltage
    > > > > before and after you connect in the resistor? E.g., 10.0
    > before,
    > > > 9.9
    > > > > after. If there is no change, then try 10k or even 1k. If
    > there
    > > > is
    > > > > no change at all, then the output resistance is much much less
    > than
    > > > > the value of resistance you are trying. If the output drops to
    > 1/2
    > > > > of its original value, then the output resistance equals the
    > added
    > > > > resistance. The point is, if you add your own "black box" to
    > the
    > > > > circuit, you do not want to load it down too much. The test
    > give
    > > > you
    > > > > an estimate of how much is too much.
    > > > >
    > > > > -- regards,
    > > > > Tracy Allen
    > > > > electronically monitored ecosystems
    > > > > mailto:tracy@e...
    > > > > http://www.emesystems.com
    > > >
    > > >
    > > > To UNSUBSCRIBE, just send mail to:
    > > > basicstamps-unsubscribe@y...
    > > > from the same email address that you subscribed. Text in the
    > Subject and
    > > Body of the message will be ignored.
    > > >
    > > >
    > > > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    > > >
    > > >
    > > >
    >
    >
    > 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.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-31 03:19
    Ah, I see what you are saying. Very clear. Thanks. Not bad for a guy
    with a 5 day old baby. I assumed that the pulsin command was the most
    accurate way of timing a pulse in the 30ms range, so it did not occur
    to me to bypass that command in favor of manual counting. Stretching
    the pulse is an appealing idea. I started toying with a flip flop
    circuit yesterday, but managed to fry the only chip I had for that. I
    do like the idea of taking many pulses at a time, to smooth out the
    reading, but do worry about using too much cpu time. The overall plan
    is to build a data logger for my car (DME controlled Porsche), so I
    would not want to hamper the sampling rate just to calculate rpms.
    Right now, I want to get a BS2 tach working in the car (have LCD
    panel for read-out) so I know there are no issues with the sampling.
    But, once I put the rest of the pieces in place, I may just have the
    data logger capture the raw data (pulse time--raw or stretched), and
    let a PC do the calculations after the fact at the time the results
    are displayed. I'm still working on getting reliable data using 2
    pulsin commands, but if that proves too unstable, I may very well
    think along the lines you are suggesting.

    Thanks!
    --- In basicstamps@y..., <tony.wells@a...> wrote:
    > Hi Tom,
    >
    > I may have missed some earlier postings, and I am a bit sleepy
    today (5
    > day-old baby). So if I'm just talking rubbish or repeating other
    posts then
    > just ignore me ;-)
    >
    > This is a long posting......
    >
    > What I'm trying to say is that for a given engine speed, the pulses
    are
    > occuring at a rate which is related to the engine speed - which you
    know
    > already. Using your example, you get an ON for 30ms then an OFF for
    5 ms at
    > say 1000 rpm. If the speed is 2000 rpm then the pulses occur as an
    ON at
    > 15ms and OFF for 5ms.
    >
    > If this is the case, what you *can* do, is to cycle the CPU (eg
    count up
    > some variable) during the ON period and count the CPU cycles when
    the pin is
    > ON, and stop when the pin is OFF.
    >
    > The CPU cycles, or count variable value then has a relationship to
    the
    > rpm.
    >
    > Now the Basic stamp is slower than Mr. Tortoise in Tortoiseville.
    It is
    > entirely likely that it won't be able to cycle a counter many times
    at 30ms
    > or less, so the accuracy will be poo. The classic way of solving
    this is to
    > put the On/Off pulses into a divider chain - say a divide by 100.
    >
    > This has three effects. Firstly it makes the on-off ratio of the
    pulses
    > 50:50 - which can be quite handy when counting numbers. Secondly,
    and more
    > importantly, the pulses are now streeeeeeched out, and the slow CPU
    can
    > increment a counter more times during the ON period.
    >
    > The third effect is extremely interesting. Because it will take 100
    on/offs
    > as input before you get an output, and because the on/offs are
    never going
    > to be the same value (as the engine revs are never constant) then
    the
    > divider chain will sort of average up the values. This will produce
    a sort
    > of hysteresis effect, similar to a real needle on a analogue tacho.
    >
    > Now, once you have installed the divide by 100 counter and
    identified the
    > count values for given rpms, you can then work out the relationship
    between
    > counts and RPM. You might have to fiddle with a timing constant when
    > counting to make the values neat.
    >
    > Once the counting routine is ok, all you have to do is (say) once a
    second
    > run the counting routine - make the routine wait until a new pulse
    comes in,
    > then do your counting.
    >
    >
    > I hope all this makes sense.....
    >
    > Regards,
    >
    > Toyn Wells
    >
    >
    Original Message
    > From: "tomatlarge" <tomatlarge@y...>
    > To: <basicstamps@y...>
    > Sent: Sunday, December 30, 2001 11:12 PM
    > Subject: [noparse][[/noparse]basicstamps] Re: Pulse Conditioning for BS2
    >
    >
    > > I'm not sure I follow this suggestion. The pulse is, for example,
    on
    > > for 30ms and off for 5ms, repeating, or faster. SO, I think I
    measure
    > > the on or off pulses, or some collection of on and off pulses, and
    > > calculate an rpm from that. I'm not sure what you mean when you
    > > say "between each pulse"? The signal is plus 12 volts for a few
    ms
    > > and 0 volts for a few milliseconds, over and over. Am I missing
    your
    > > point?
    > >
    > > --- In basicstamps@y..., tony.wells@a... wrote:
    > > > Hi ,
    > > >
    > > > Perhaps I've missed something here. Forgive me if I have.
    > > >
    > > > Wouldn't it be easier to count the number of cpu cycles between
    > > each pulse?
    > > > If the pulses are too short an interval, use a divide by 10 or
    > > divide by 100
    > > > counter.
    > > >
    > > > Yes, you would have to calibrate it, but the code would be
    simpler,
    > > and you
    > > > can choose when to sample - say once per second.
    > > >
    > > > Regards,
    > > >
    > > > Tony
    > > >
    > > >
    Original Message
    > > > From: "tomatlarge" <tomatlarge@y...>
    > > > To: <basicstamps@y...>
    > > > Sent: Sunday, December 30, 2001 10:43 AM
    > > > Subject: [noparse][[/noparse]basicstamps] Re: Pulse Conditioning for BS2
    > > >
    > > >
    > > > > Oops, I think I mistook your original suggestion. I connected
    a
    > > wire
    > > > > to the tach signal going from one black box to the other.
    Using a
    > > > > multimeter on the tapped line (red lead to tapped line, black
    > > lead to
    > > > > ground), I found the pulse and voltages I listed yesterday.
    > > Today, I
    > > > > put a 100k resistor on the end of the tapped line (in series
    > > between
    > > > > the tapped line and the red lead of the multimeter). With the
    > > > > resistor in place, I have about.1vdc less than without the
    > > resistor.
    > > > > I thought about doing it like your second suggestion (100k to
    > > ground)
    > > > > but got paramoid. At any rate, I ended up making a voltage
    > > follower
    > > > > out of an LM358, and sent my tach signal to it through a 100k
    > > > > resistor. I then used a voltage divider on the 12v output of
    the
    > > > > LM358, and everything seems to be working fine. I assumed
    > > (hopefully
    > > > > correctly) that the LM358 with 100k resistor would have
    virtually
    > > no
    > > > > effect on the rest of the circuit, and that the votage
    divider on
    > > the
    > > > > output side of the LM358 (using 10k and 20k resistors) would
    not
    > > over-
    > > > > tax the LM358 output. At least it all seems to work...sound
    ok?
    > > I am
    > > > > reading up on basic electronics and am admittedly a bit
    stumped on
    > > > > the impedance concept. Your help has been invaluable...I'll
    get
    > > > > there. Now, I am starting to struggle with BS2 math
    calculations
    > > to
    > > > > turn my pulse readings into actual rpms. I found your write-
    up in
    > > the
    > > > > FAQ, but may be looking for help soon. I need to divide 30000
    by
    > > the
    > > > > pulse width (in milliseconds) I measure, and I'm trying to do
    it
    > > > > without taking up too much cpu time. I'll play with that
    tomorrow.
    > > > > Thanks again.
    > > > >
    > > > > --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
    > > > > > >Well, I put a 100k resistor on the tach signal and there
    was
    > > about
    > > > > > >a .1volt difference on the voltmeter on either side of the
    > > > > resistor.
    > > > > > >(The volt reading reflects an 85% "on" pulsed 12vdc
    signal, so
    > > the
    > > > > > >actual voltage drop may be slightly greater.) For
    reference,
    > > the
    > > > > tach
    > > > > > >signal is still fully functioning in its circuit. It goes
    from
    > > the
    > > > > > >black box directly to the tach, and also directly to
    another
    > > black
    > > > > > >box that uses it to create the ignition timing signal. I
    just
    > > > > tapped
    > > > > > >into it to check the voltage/pulse. The voltage was .1vdc
    lower
    > > > > when
    > > > > > >I checked it through a 100k resistor.
    > > > > >
    > > > > > That experiment allows you to estimate the input
    resistance. I
    > > > > think
    > > > > > you added the 100k resistor as follows:
    > > > > >
    > > > > > "black box 1 output" ----/\/\---- "black box 2+3 input"
    > > > > > 100k
    > > > > >
    > > > > > The voltage on the left side of the resistor was about 0.1
    volt
    > > > > > greater than the voltage on the right, say 10 volts and 9.9
    > > volts.
    > > > > > Yes? That lets you estimate the input resistance of black
    box
    > > 2+3.
    > > > > > The current through the 100kohm resistor is V/R =
    0.1/100000 =~
    > > 1
    > > > > > microamp. That 1 microamp also flows through the input
    > > resistance
    > > > > of
    > > > > > black box #2+3, which has 9.9 volts across it. So the input
    > > > > > resistance is, R=V/I=9.9 megaohms. Roughly 10 megaohms,
    give or
    > > > > take
    > > > > > a few. Pretty high.
    > > > > >
    > > > > > To measure the output resistance of black box 1, connect the
    > > > > 100kohms
    > > > > > as follows:
    > > > > >
    > > > > > "black box 1 output" --o
    "black box 2+3 input"
    > > > > > |
    > > > > > |
    > > > > > Vss---/\/\
    '
    > > > > > 100kohm
    > > > > >
    > > > > > That is, direct from the output to ground. What is the
    voltage
    > > > > > before and after you connect in the resistor? E.g., 10.0
    > > before,
    > > > > 9.9
    > > > > > after. If there is no change, then try 10k or even 1k. If
    > > there
    > > > > is
    > > > > > no change at all, then the output resistance is much much
    less
    > > than
    > > > > > the value of resistance you are trying. If the output
    drops to
    > > 1/2
    > > > > > of its original value, then the output resistance equals the
    > > added
    > > > > > resistance. The point is, if you add your own "black box"
    to
    > > the
    > > > > > circuit, you do not want to load it down too much. The test
    > > give
    > > > > you
    > > > > > an estimate of how much is too much.
    > > > > >
    > > > > > -- regards,
    > > > > > Tracy Allen
    > > > > > electronically monitored ecosystems
    > > > > > mailto:tracy@e...
    > > > > > http://www.emesystems.com
    > > > >
    > > > >
    > > > > To UNSUBSCRIBE, just send mail to:
    > > > > basicstamps-unsubscribe@y...
    > > > > from the same email address that you subscribed. Text in the
    > > Subject and
    > > > Body of the message will be ignored.
    > > > >
    > > > >
    > > > > Your use of Yahoo! Groups is subject to
    > > http://docs.yahoo.com/info/terms/
    > > > >
    > > > >
    > > > >
    > >
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@y...
    > > from the same email address that you subscribed. Text in the
    Subject and
    > Body of the message will be ignored.
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
    > >
    > >
    > >
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-31 05:02
    Well folks, it works like a champ! I reduced the values of the
    resistors (both in the voltage divider and on the signal from the
    black box), and added a cap across the BS2 input as Tracy suggested,
    and the tach now reads extremely stable and accurate on my LCD. The
    timing problem I mentioned earlier was a software glitch (forgot to
    add the negative pulse.) Many thanks for all the help. Next up:
    injector pulse timing, and a host of switch and voltage-based
    sensors. Then I'll need to tackle writing data to BS2 memory for
    later PC processing. [noparse]:)[/noparse]

    --- In basicstamps@y..., "tomatlarge" <tomatlarge@y...> wrote:
    > Ah, I see what you are saying. Very clear. Thanks. Not bad for a
    guy
    > with a 5 day old baby. I assumed that the pulsin command was the
    most
    > accurate way of timing a pulse in the 30ms range, so it did not
    occur
    > to me to bypass that command in favor of manual counting.
    Stretching
    > the pulse is an appealing idea. I started toying with a flip flop
    > circuit yesterday, but managed to fry the only chip I had for that.
    I
    > do like the idea of taking many pulses at a time, to smooth out the
    > reading, but do worry about using too much cpu time. The overall
    plan
    > is to build a data logger for my car (DME controlled Porsche), so I
    > would not want to hamper the sampling rate just to calculate rpms.
    > Right now, I want to get a BS2 tach working in the car (have LCD
    > panel for read-out) so I know there are no issues with the
    sampling.
    > But, once I put the rest of the pieces in place, I may just have
    the
    > data logger capture the raw data (pulse time--raw or stretched),
    and
    > let a PC do the calculations after the fact at the time the results
    > are displayed. I'm still working on getting reliable data using 2
    > pulsin commands, but if that proves too unstable, I may very well
    > think along the lines you are suggesting.
    >
    > Thanks!
    > --- In basicstamps@y..., <tony.wells@a...> wrote:
    > > Hi Tom,
    > >
    > > I may have missed some earlier postings, and I am a bit sleepy
    > today (5
    > > day-old baby). So if I'm just talking rubbish or repeating other
    > posts then
    > > just ignore me ;-)
    > >
    > > This is a long posting......
    > >
    > > What I'm trying to say is that for a given engine speed, the
    pulses
    > are
    > > occuring at a rate which is related to the engine speed - which
    you
    > know
    > > already. Using your example, you get an ON for 30ms then an OFF
    for
    > 5 ms at
    > > say 1000 rpm. If the speed is 2000 rpm then the pulses occur as
    an
    > ON at
    > > 15ms and OFF for 5ms.
    > >
    > > If this is the case, what you *can* do, is to cycle the CPU (eg
    > count up
    > > some variable) during the ON period and count the CPU cycles when
    > the pin is
    > > ON, and stop when the pin is OFF.
    > >
    > > The CPU cycles, or count variable value then has a relationship
    to
    > the
    > > rpm.
    > >
    > > Now the Basic stamp is slower than Mr. Tortoise in Tortoiseville.
    > It is
    > > entirely likely that it won't be able to cycle a counter many
    times
    > at 30ms
    > > or less, so the accuracy will be poo. The classic way of solving
    > this is to
    > > put the On/Off pulses into a divider chain - say a divide by 100.
    > >
    > > This has three effects. Firstly it makes the on-off ratio of the
    > pulses
    > > 50:50 - which can be quite handy when counting numbers. Secondly,
    > and more
    > > importantly, the pulses are now streeeeeeched out, and the slow
    CPU
    > can
    > > increment a counter more times during the ON period.
    > >
    > > The third effect is extremely interesting. Because it will take
    100
    > on/offs
    > > as input before you get an output, and because the on/offs are
    > never going
    > > to be the same value (as the engine revs are never constant) then
    > the
    > > divider chain will sort of average up the values. This will
    produce
    > a sort
    > > of hysteresis effect, similar to a real needle on a analogue
    tacho.
    > >
    > > Now, once you have installed the divide by 100 counter and
    > identified the
    > > count values for given rpms, you can then work out the
    relationship
    > between
    > > counts and RPM. You might have to fiddle with a timing constant
    when
    > > counting to make the values neat.
    > >
    > > Once the counting routine is ok, all you have to do is (say) once
    a
    > second
    > > run the counting routine - make the routine wait until a new
    pulse
    > comes in,
    > > then do your counting.
    > >
    > >
    > > I hope all this makes sense.....
    > >
    > > Regards,
    > >
    > > Toyn Wells
    > >
    > >
    Original Message
    > > From: "tomatlarge" <tomatlarge@y...>
    > > To: <basicstamps@y...>
    > > Sent: Sunday, December 30, 2001 11:12 PM
    > > Subject: [noparse][[/noparse]basicstamps] Re: Pulse Conditioning for BS2
    > >
    > >
    > > > I'm not sure I follow this suggestion. The pulse is, for
    example,
    > on
    > > > for 30ms and off for 5ms, repeating, or faster. SO, I think I
    > measure
    > > > the on or off pulses, or some collection of on and off pulses,
    and
    > > > calculate an rpm from that. I'm not sure what you mean when you
    > > > say "between each pulse"? The signal is plus 12 volts for a
    few
    > ms
    > > > and 0 volts for a few milliseconds, over and over. Am I missing
    > your
    > > > point?
    > > >
    > > > --- In basicstamps@y..., tony.wells@a... wrote:
    > > > > Hi ,
    > > > >
    > > > > Perhaps I've missed something here. Forgive me if I have.
    > > > >
    > > > > Wouldn't it be easier to count the number of cpu cycles
    between
    > > > each pulse?
    > > > > If the pulses are too short an interval, use a divide by 10 or
    > > > divide by 100
    > > > > counter.
    > > > >
    > > > > Yes, you would have to calibrate it, but the code would be
    > simpler,
    > > > and you
    > > > > can choose when to sample - say once per second.
    > > > >
    > > > > Regards,
    > > > >
    > > > > Tony
    > > > >
    > > > >
    Original Message
    > > > > From: "tomatlarge" <tomatlarge@y...>
    > > > > To: <basicstamps@y...>
    > > > > Sent: Sunday, December 30, 2001 10:43 AM
    > > > > Subject: [noparse][[/noparse]basicstamps] Re: Pulse Conditioning for BS2
    > > > >
    > > > >
    > > > > > Oops, I think I mistook your original suggestion. I
    connected
    > a
    > > > wire
    > > > > > to the tach signal going from one black box to the other.
    > Using a
    > > > > > multimeter on the tapped line (red lead to tapped line,
    black
    > > > lead to
    > > > > > ground), I found the pulse and voltages I listed yesterday.
    > > > Today, I
    > > > > > put a 100k resistor on the end of the tapped line (in series
    > > > between
    > > > > > the tapped line and the red lead of the multimeter). With
    the
    > > > > > resistor in place, I have about.1vdc less than without the
    > > > resistor.
    > > > > > I thought about doing it like your second suggestion (100k
    to
    > > > ground)
    > > > > > but got paramoid. At any rate, I ended up making a voltage
    > > > follower
    > > > > > out of an LM358, and sent my tach signal to it through a
    100k
    > > > > > resistor. I then used a voltage divider on the 12v output
    of
    > the
    > > > > > LM358, and everything seems to be working fine. I assumed
    > > > (hopefully
    > > > > > correctly) that the LM358 with 100k resistor would have
    > virtually
    > > > no
    > > > > > effect on the rest of the circuit, and that the votage
    > divider on
    > > > the
    > > > > > output side of the LM358 (using 10k and 20k resistors)
    would
    > not
    > > > over-
    > > > > > tax the LM358 output. At least it all seems to work...sound
    > ok?
    > > > I am
    > > > > > reading up on basic electronics and am admittedly a bit
    > stumped on
    > > > > > the impedance concept. Your help has been invaluable...I'll
    > get
    > > > > > there. Now, I am starting to struggle with BS2 math
    > calculations
    > > > to
    > > > > > turn my pulse readings into actual rpms. I found your write-
    > up in
    > > > the
    > > > > > FAQ, but may be looking for help soon. I need to divide
    30000
    > by
    > > > the
    > > > > > pulse width (in milliseconds) I measure, and I'm trying to
    do
    > it
    > > > > > without taking up too much cpu time. I'll play with that
    > tomorrow.
    > > > > > Thanks again.
    > > > > >
    > > > > > --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
    > > > > > > >Well, I put a 100k resistor on the tach signal and there
    > was
    > > > about
    > > > > > > >a .1volt difference on the voltmeter on either side of
    the
    > > > > > resistor.
    > > > > > > >(The volt reading reflects an 85% "on" pulsed 12vdc
    > signal, so
    > > > the
    > > > > > > >actual voltage drop may be slightly greater.) For
    > reference,
    > > > the
    > > > > > tach
    > > > > > > >signal is still fully functioning in its circuit. It
    goes
    > from
    > > > the
    > > > > > > >black box directly to the tach, and also directly to
    > another
    > > > black
    > > > > > > >box that uses it to create the ignition timing signal. I
    > just
    > > > > > tapped
    > > > > > > >into it to check the voltage/pulse. The voltage
    was .1vdc
    > lower
    > > > > > when
    > > > > > > >I checked it through a 100k resistor.
    > > > > > >
    > > > > > > That experiment allows you to estimate the input
    > resistance. I
    > > > > > think
    > > > > > > you added the 100k resistor as follows:
    > > > > > >
    > > > > > > "black box 1 output" ----/\/\---- "black box 2+3 input"
    > > > > > > 100k
    > > > > > >
    > > > > > > The voltage on the left side of the resistor was about
    0.1
    > volt
    > > > > > > greater than the voltage on the right, say 10 volts and
    9.9
    > > > volts.
    > > > > > > Yes? That lets you estimate the input resistance of black
    > box
    > > > 2+3.
    > > > > > > The current through the 100kohm resistor is V/R =
    > 0.1/100000 =~
    > > > 1
    > > > > > > microamp. That 1 microamp also flows through the input
    > > > resistance
    > > > > > of
    > > > > > > black box #2+3, which has 9.9 volts across it. So the
    input
    > > > > > > resistance is, R=V/I=9.9 megaohms. Roughly 10 megaohms,
    > give or
    > > > > > take
    > > > > > > a few. Pretty high.
    > > > > > >
    > > > > > > To measure the output resistance of black box 1, connect
    the
    > > > > > 100kohms
    > > > > > > as follows:
    > > > > > >
    > > > > > > "black box 1 output" --o
    "black box 2+3 input"
    > > > > > > |
    > > > > > > |
    > > > > > > Vss---/\/\
    '
    > > > > > > 100kohm
    > > > > > >
    > > > > > > That is, direct from the output to ground. What is the
    > voltage
    > > > > > > before and after you connect in the resistor? E.g., 10.0
    > > > before,
    > > > > > 9.9
    > > > > > > after. If there is no change, then try 10k or even 1k.
    If
    > > > there
    > > > > > is
    > > > > > > no change at all, then the output resistance is much much
    > less
    > > > than
    > > > > > > the value of resistance you are trying. If the output
    > drops to
    > > > 1/2
    > > > > > > of its original value, then the output resistance equals
    the
    > > > added
    > > > > > > resistance. The point is, if you add your own "black
    box"
    > to
    > > > the
    > > > > > > circuit, you do not want to load it down too much. The
    test
    > > > give
    > > > > > you
    > > > > > > an estimate of how much is too much.
    > > > > > >
    > > > > > > -- regards,
    > > > > > > Tracy Allen
    > > > > > > electronically monitored ecosystems
    > > > > > > mailto:tracy@e...
    > > > > > > http://www.emesystems.com
    > > > > >
    > > > > >
    > > > > > To UNSUBSCRIBE, just send mail to:
    > > > > > basicstamps-unsubscribe@y...
    > > > > > from the same email address that you subscribed. Text in
    the
    > > > Subject and
    > > > > Body of the message will be ignored.
    > > > > >
    > > > > >
    > > > > > Your use of Yahoo! Groups is subject to
    > > > http://docs.yahoo.com/info/terms/
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >
    > > > To UNSUBSCRIBE, just send mail to:
    > > > basicstamps-unsubscribe@y...
    > > > from the same email address that you subscribed. Text in the
    > Subject and
    > > Body of the message will be ignored.
    > > >
    > > >
    > > > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    > > >
    > > >
    > > >
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-31 05:04
    >First, the program does not
    >want to work in the car unless I touch either or both of the power
    >supply leads...makes me think I need a capacitor somewhere.

    Hi again Tom,

    There should be a good bypass capacitor between pins 4 and 8 of the
    LM358. Be sure all the grounds are well connected.

    > Second,
    >when the program is running, the pulsin command generates slightly
    >smaller pulse times than is actually on the tach signal (according to
    >my Fluke), resulting in slightly higher than real rpms.

    How much slightly?

    >As I
    >mentioned, I used an LM358 as a voltage follower, and split the
    >output of the LM358 with a 10k and 20k resistor. Could that be
    >throwing off the timing? I am measuring one low and one high pulse
    >and adding them together, so I would think the result should be the
    >same even if the output is shifted a bit.

    The LM358 is a relatively slow op-amp, when used in this way as a
    comparator. Since this is a simple digital switch, a small signal
    mosfet would be simpler and faster to translate the levels:

    ;
    BS2 pin
    |
    ||
    o----/\/\----+5
    0- ||-; 5k
    +12--/\/\--||-o- Vss
    1k VN10

    Another option is the CD4050 hex cmos buffer. It can easily
    translate high speed signals from 12 volts down to 5 volts.

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-01 00:24
    Tracy,

    Thanks again for all your help. I may indeed try the other circuits
    you suggest below, but in the meantime, I was able to make things
    work very well. The timing issue was my own fault (silly me, forgot
    to add the neg pulse). And the capacitors seemed to fix the other
    problems. It is amazing to me how much can be done with the Stamp and
    the help of this list, with virtually no electronics training. I'm
    working on the other input channels now, and should have a
    functioning data logger shortly (with a little signal conditioning
    tossed in for drivability)! --Tom

    --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
    > >First, the program does not
    > >want to work in the car unless I touch either or both of the power
    > >supply leads...makes me think I need a capacitor somewhere.
    >
    > Hi again Tom,
    >
    > There should be a good bypass capacitor between pins 4 and 8 of the
    > LM358. Be sure all the grounds are well connected.
    >
    > > Second,
    > >when the program is running, the pulsin command generates slightly
    > >smaller pulse times than is actually on the tach signal (according
    to
    > >my Fluke), resulting in slightly higher than real rpms.
    >
    > How much slightly?
    >
    > >As I
    > >mentioned, I used an LM358 as a voltage follower, and split the
    > >output of the LM358 with a 10k and 20k resistor. Could that be
    > >throwing off the timing? I am measuring one low and one high pulse
    > >and adding them together, so I would think the result should be the
    > >same even if the output is shifted a bit.
    >
    > The LM358 is a relatively slow op-amp, when used in this way as a
    > comparator. Since this is a simple digital switch, a small signal
    > mosfet would be simpler and faster to translate the levels:
    >
    > ;
    BS2 pin
    > |
    > ||
    o----/\/\----+5
    > 0- ||-; 5k
    > +12--/\/\--||-o- Vss
    > 1k VN10
    >
    > Another option is the CD4050 hex cmos buffer. It can easily
    > translate high speed signals from 12 volts down to 5 volts.
    >
    > -- regards,
    > Tracy Allen
    > electronically monitored ecosystems
    > mailto:tracy@e...
    > http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-01 05:10
    Tom,
    After reviewing all of the responces of this thread I believe you would be
    very interested in Al Williams Pak VII. I have only reviewed these devices
    but I believe they are exactly what you need. It is a co-processor that can
    monitior the length of 8 diffeent pulses, HI/LO/ ,DURATION ,TOTALS,ETC. The
    stamp can then retrieve this info as neede with a serin command, useing very
    little of the stamps processing resources.

    Shannon


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-01 08:30
    Sounds interesting. Do you have a link?

    --- In basicstamps@y..., moretraction@a... wrote:
    > Tom,
    > After reviewing all of the responces of this thread I believe you
    would be
    > very interested in Al Williams Pak VII. I have only reviewed these
    devices
    > but I believe they are exactly what you need. It is a co-processor
    that can
    > monitior the length of 8 diffeent pulses,
    HI/LO/ ,DURATION ,TOTALS,ETC. The
    > stamp can then retrieve this info as neede with a serin command,
    useing very
    > little of the stamps processing resources.
    >
    > Shannon
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-01 10:17
    At 08:30 AM 1/1/2002 +0000, you wrote:


    >Sounds interesting. Do you have a link?
    > http://www.al-williams.com/awce/pak7.htm
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-01 14:45
    Just a slight correction to the below. The PAK-VII, like most of the
    PAKs, use SHIFTIN/SHIFTOUT for communications. People often ask why the
    PAKs don't use SERIN/SEROUT (the PAK-V and VI do because they have
    different requirements). One of the benefits of a PAK is that it allows
    a level of multitasking. If they used SERIN, the Stamp (and other non
    interrupt processors) would have to listen for incoming data. With the
    Shift scheme, you can issue a command, go do something, and then read
    the results later. You can read the result at your own speed, stop in
    the middle and result later, etc. You can't do that with SERIN.

    The PAK-V only accepts input, so SEROUT is fine. The PAK-VI's whole
    point is to convert PS/2 to RS232, so again, SERIN/SEROUT works there
    too. Otherwise, all the PAKs use the same protocol.

    You can find the manual and example code on our site.

    Al Williams
    AWC
    * 8 channels of PWM
    http://www.al-williams.com/awce/pak5.htm



    >
    Original Message
    > From: moretraction@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=iA5rf9Yi9Yum4khoxEUhd_jI7aCDKgvxL0-5_WB0zVcJZZSvdYdkuqx0RHkzQbNqYbu5Ri-SzPcqRw]moretraction@a...[/url
    > Sent: Monday, December 31, 2001 11:10 PM
    > To: basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] Re: Pulse Conditioning for BS2
    >
    >
    > Tom,
    > After reviewing all of the responces of this thread I believe
    > you would be
    > very interested in Al Williams Pak VII. I have only reviewed
    > these devices
    > but I believe they are exactly what you need. It is a
    > co-processor that can
    > monitior the length of 8 diffeent pulses, HI/LO/ ,DURATION
    > ,TOTALS,ETC. The
    > stamp can then retrieve this info as neede with a serin
    > command, useing very
    > little of the stamps processing resources.
    >
    > Shannon
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > 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.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
Sign In or Register to comment.