Shop OBEX P1 Docs P2 Docs Learn Events
Debounce and count commands — Parallax Forums

Debounce and count commands

ArchiverArchiver Posts: 46,084
edited 2001-12-13 17:20 in General Discussion
Hello all;

We are trying to make an anemometer from a motor,
so that we can spin it a certain amount of times and
then calibrate that to a wind speed. We wired it up so
that every time the motor completes a rotation, it
should give one increment in the count command. But
whenever we test this, it reads out either very low (0
most of the time) or very high (sometimes over 100).
We think we may need to use the debounce command, but
we dont know what else to do.

Any ideas on what we can do?

Thank you,
Arundel Tech Department

__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-12-12 15:41
    It isn't clear to me how you'd use a motor and the count command. Most
    anemometers that use a motor use them as generators (a motor and a
    generator are -- in theory -- the same thing although in practice you
    optimize a motor differently than a generator). So when the motor turns
    you generate a voltage that you could measure to find the speed. With
    the count command, you'd just connect the vane to a shaft and count
    rotations using an optical or magnetic sensor. What are you actually
    measuring?


    Al Williams
    AWC
    * Easy RS-232 Prototyping
    http://www.al-williams.com/awce/rs1.htm

    >
    Original Message
    > From: Arundel High [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=t5Efm_IF6feBEwBB3XRSYbLStKi05XtXgb2Kqun0bQVD9IJQ1_OshnKO0zBMGTxTq8hDJ0j98EphPyteH-I]arundelstamp@y...[/url
    > Sent: Wednesday, December 12, 2001 8:55 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Debounce and count commands
    >
    >
    > Hello all;
    >
    > We are trying to make an anemometer from a motor,
    > so that we can spin it a certain amount of times and
    > then calibrate that to a wind speed. We wired it up so
    > that every time the motor completes a rotation, it
    > should give one increment in the count command. But
    > whenever we test this, it reads out either very low (0
    > most of the time) or very high (sometimes over 100).
    > We think we may need to use the debounce command, but
    > we dont know what else to do.
    >
    > Any ideas on what we can do?
    >
    > Thank you,
    > Arundel Tech Department
    >
    > __________________________________________________
    > Do You Yahoo!?
    > Check out Yahoo! Shopping and Yahoo! Auctions for all of
    > your unique holiday gifts! Buy at http://shopping.yahoo.com
    > or bid at http://auctions.yahoo.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-12 17:04
    This motor you are using is an AC motor with a permanant magnet,
    right, and no commutator? Then it should also work as a tachometer.
    Tachometers are quite often used as the sensor for anemometers, but
    to interface to the stamp requires signal conditioner to square up
    the pulses. At low windspeeds the amplitude of the signal is low,
    only 10s of millivolts. That is for a standard anemometer tach. I
    don't know about your motor, but that may be a problem.

    If you have an oscilloscope hooked to it, you would see both the
    amplitude and the frequency of the voltage signal increase as you
    increase the rate of rotation. Hooked directly to a stamp pin, it
    would have to get up to 1.3 volts before it would even start to
    trigger, and then the speed would already be pretty high. Maybe you
    already have a circuit there, as you say, "...wired it up..."?

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com

    >Hello all;
    >
    > We are trying to make an anemometer from a motor,
    >so that we can spin it a certain amount of times and
    >then calibrate that to a wind speed. We wired it up so
    >that every time the motor completes a rotation, it
    >should give one increment in the count command. But
    >whenever we test this, it reads out either very low (0
    >most of the time) or very high (sometimes over 100).
    >We think we may need to use the debounce command, but
    >we dont know what else to do.
    >
    >Any ideas on what we can do?
    >
    >Thank you,
    >Arundel Tech Department
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-13 00:17
    You may also use an optical encoder instead a motor. There will be less
    drag and depending of resolution it will be very sensitive in low rpm.
    Any old PC mouse have 2 free encoders inside. If you want I can send a
    schematic and a code to reading.
    ACJacques

    > >
    Original Message
    > > From: Arundel High [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=NCc_ST4XezM_kUpw2Rlka05RvSOJyFpasYJ0PGD8Y7kr6Sq7KLsKKsX-jQl2jw_byKozhriEVRUdDmCrdsc]arundelstamp@y...[/url
    > > Sent: Wednesday, December 12, 2001 8:55 AM
    > > To: basicstamps@yahoogroups.com
    > > Subject: [noparse][[/noparse]basicstamps] Debounce and count commands
    > >
    > >
    > > Hello all;
    > >
    > > We are trying to make an anemometer from a motor,
    > > so that we can spin it a certain amount of times and
    > > then calibrate that to a wind speed. We wired it up so
    > > that every time the motor completes a rotation, it
    > > should give one increment in the count command. But
    > > whenever we test this, it reads out either very low (0
    > > most of the time) or very high (sometimes over 100).
    > > We think we may need to use the debounce command, but
    > > we dont know what else to do.
    > >
    > > Any ideas on what we can do?
    > >
    > > Thank you,
    > > Arundel Tech Department
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-13 00:31
    I'm interested.

    Thanks
    John

    ACJacques <acjacques@i...> wrote:

    >You may also use an optical encoder instead a motor. There will be less
    >drag and depending of resolution it will be very sensitive in low rpm.
    >Any old PC mouse have 2 free encoders inside. If you want I can send a
    >schematic and a code to reading.
    >ACJacques
    >
    >> >
    Original Message
    >> > From: Arundel High [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=uZob4zXvKdwLv5EeSGf6dmVZHUluI0vT0uoqN0drtN5JGPWRvCUmRxa2DHkCDx3BOhV4gYph-Wn7BuxDRGa2-g]arundelstamp@y...[/url
    >> > Sent: Wednesday, December 12, 2001 8:55 AM
    >> > To: basicstamps@yahoogroups.com
    >> > Subject: [noparse][[/noparse]basicstamps] Debounce and count commands
    >> >
    >> >
    >> > Hello all;
    >> >
    >> > We are trying to make an anemometer from a motor,
    >> > so that we can spin it a certain amount of times and
    >> > then calibrate that to a wind speed. We wired it up so
    >> > that every time the motor completes a rotation, it
    >> > should give one increment in the count command. But
    >> > whenever we test this, it reads out either very low (0
    >> > most of the time) or very high (sometimes over 100).
    >> > We think we may need to use the debounce command, but
    >> > we dont know what else to do.
    >> >
    >> > Any ideas on what we can do?
    >> >
    >> > Thank you,
    >> > Arundel Tech Department
    >
    >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-13 14:28
    our circuit looks like this:

    vdd____motor_________10k resistor_____vss
    |
    |
    I/O pin

    the motor is part of a complete circuit, so we want to
    count the number of pulses generated by each rotation
    of the motor.

    does this make sense?
    can the count command be used this way, and if so how
    do we debounce it?


    --- Tracy Allen <tracy@e...> wrote:
    >
    > This motor you are using is an AC motor with a
    > permanant magnet,
    > right, and no commutator? Then it should also work
    > as a tachometer.
    > Tachometers are quite often used as the sensor for
    > anemometers, but
    > to interface to the stamp requires signal
    > conditioner to square up
    > the pulses. At low windspeeds the amplitude of the
    > signal is low,
    > only 10s of millivolts. That is for a standard
    > anemometer tach. I
    > don't know about your motor, but that may be a
    > problem.
    >
    > If you have an oscilloscope hooked to it, you would
    > see both the
    > amplitude and the frequency of the voltage signal
    > increase as you
    > increase the rate of rotation. Hooked directly to a
    > stamp pin, it
    > would have to get up to 1.3 volts before it would
    > even start to
    > trigger, and then the speed would already be pretty
    > high. Maybe you
    > already have a circuit there, as you say, "...wired
    > it up..."?
    >
    > -- regards,
    > Tracy Allen
    > electronically monitored ecosystems
    > mailto:tracy@e...
    > http://www.emesystems.com
    >
    > >Hello all;
    > >
    > > We are trying to make an anemometer from a
    > motor,
    > >so that we can spin it a certain amount of times
    > and
    > >then calibrate that to a wind speed. We wired it up
    > so
    > >that every time the motor completes a rotation, it
    > >should give one increment in the count command. But
    > >whenever we test this, it reads out either very low
    > (0
    > >most of the time) or very high (sometimes over
    > 100).
    > >We think we may need to use the debounce command,
    > but
    > >we dont know what else to do.
    > >
    > >Any ideas on what we can do?
    > >
    > >Thank you,
    > >Arundel Tech Department
    >
    >
    > 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/
    >
    >


    __________________________________________________
    Do You Yahoo!?
    Check out Yahoo! Shopping and Yahoo! Auctions for all of
    your unique holiday gifts! Buy at http://shopping.yahoo.com
    or bid at http://auctions.yahoo.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-13 14:34
    we are definitly interested, thank you very much.

    -Arundel Tech
    --- ACJacques <acjacques@i...> wrote:
    > You may also use an optical encoder instead a
    > motor. There will be less
    > drag and depending of resolution it will be very
    > sensitive in low rpm.
    > Any old PC mouse have 2 free encoders inside. If you
    > want I can send a
    > schematic and a code to reading.
    > ACJacques
    >
    > > >
    Original Message
    > > > From: Arundel High
    > [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=ivvkryAwHZmmZq22I4Ds5vNAsxfD-Byrostt86n-Qk73PTA4ODjEptjrCUs48fgdAS1z6xZ0pHRXJh3uVw]arundelstamp@y...[/url
    > > > Sent: Wednesday, December 12, 2001 8:55 AM
    > > > To: basicstamps@yahoogroups.com
    > > > Subject: [noparse][[/noparse]basicstamps] Debounce and count
    > commands
    > > >
    > > >
    > > > Hello all;
    > > >
    > > > We are trying to make an anemometer from a
    > motor,
    > > > so that we can spin it a certain amount of times
    > and
    > > > then calibrate that to a wind speed. We wired it
    > up so
    > > > that every time the motor completes a rotation,
    > it
    > > > should give one increment in the count command.
    > But
    > > > whenever we test this, it reads out either very
    > low (0
    > > > most of the time) or very high (sometimes over
    > 100).
    > > > We think we may need to use the debounce
    > command, but
    > > > we dont know what else to do.
    > > >
    > > > Any ideas on what we can do?
    > > >
    > > > Thank you,
    > > > Arundel Tech Department
    >
    > 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/
    >
    >


    __________________________________________________
    Do You Yahoo!?
    Check out Yahoo! Shopping and Yahoo! Auctions for all of
    your unique holiday gifts! Buy at http://shopping.yahoo.com
    or bid at http://auctions.yahoo.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-13 14:47
    Just as an aside, this is a good use for a PAK-VI. You can read the
    mouse with it (http://www.al-williams.com/awce/pak6mou.htm) and get two
    encoders that have terrific resolution. However, you have to figure out
    how to couple the mouse mechanism to your device mechanically. Luckily,
    mice are cheap -- you can usually find them around here for a few bucks
    or even free after rebate.

    Al Williams
    AWC
    * Control 8 servos at once
    http://www.al-williams.com/awce/pak8.htm

    >
    Original Message
    > From: Arundel High [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=wqxUhDEmHgBWrS5DfPafigt8vmOkTcEzN3UB0jIbYBp54bE6S6jvndWH8ci0YjnzYCURcfMT906DZ41hILhGQmY]arundelstamp@y...[/url
    > Sent: Thursday, December 13, 2001 8:35 AM
    > To: basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] Debounce and count commands
    >
    >
    > we are definitly interested, thank you very much.
    >
    > -Arundel Tech
    > --- ACJacques <acjacques@i...> wrote:
    > > You may also use an optical encoder instead a
    > > motor. There will be less
    > > drag and depending of resolution it will be very
    > > sensitive in low rpm.
    > > Any old PC mouse have 2 free encoders inside. If you
    > > want I can send a
    > > schematic and a code to reading.
    > > ACJacques
    > >
    > > > >
    Original Message
    > > > > From: Arundel High
    > > [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=wqxUhDEmHgBWrS5DfPafigt8vmOkTcEzN3UB0jIbYBp54bE6S6jvndWH8ci0YjnzYCURcfMT906DZ41hILhGQmY]arundelstamp@y...[/url
    > > > > Sent: Wednesday, December 12, 2001 8:55 AM
    > > > > To: basicstamps@yahoogroups.com
    > > > > Subject: [noparse][[/noparse]basicstamps] Debounce and count
    > > commands
    > > > >
    > > > >
    > > > > Hello all;
    > > > >
    > > > > We are trying to make an anemometer from a
    > > motor,
    > > > > so that we can spin it a certain amount of times
    > > and
    > > > > then calibrate that to a wind speed. We wired it
    > > up so
    > > > > that every time the motor completes a rotation,
    > > it
    > > > > should give one increment in the count command.
    > > But
    > > > > whenever we test this, it reads out either very
    > > low (0
    > > > > most of the time) or very high (sometimes over
    > > 100).
    > > > > We think we may need to use the debounce
    > > command, but
    > > > > we dont know what else to do.
    > > > >
    > > > > Any ideas on what we can do?
    > > > >
    > > > > Thank you,
    > > > > Arundel Tech Department
    > >
    > > 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/
    > >
    > >
    >
    >
    > __________________________________________________
    > Do You Yahoo!?
    > Check out Yahoo! Shopping and Yahoo! Auctions for all of
    > your unique holiday gifts! Buy at http://shopping.yahoo.com
    > or bid at http://auctions.yahoo.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-13 17:20
    There should be no need for the resistor, that is, if the motor has
    its own magnet inside. The motor acts as a generator. A tachometer
    is basically a coil of wire that encircles a magnet that is spinning
    on a shaft, and it takes very little torque to turn it. It generates
    its own voltage, a sine wave that increases both amplitude and
    frequency as the shaft spins faster. For use with the Stamp it needs
    a comparator circuit to square up the signal to 0-5 volts. To use a
    motor, it has to be the right kind of motor. Any motor with a magnet
    inside will generate voltages on its wires as the shaft turns. If it
    is a DC motor with brushes and a commutator, that will both increase
    the necessary torque and also make the signal more complicated.

    The encoder wheel from a mouse would be a good alternative.

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com


    >our circuit looks like this:
    >
    >vdd____motor_________10k resistor_____vss
    > |
    > |
    > I/O pin
    >
    >the motor is part of a complete circuit, so we want to
    >count the number of pulses generated by each rotation
    >of the motor.
    >
    >does this make sense?
    >can the count command be used this way, and if so how
    >do we debounce it?
    >
    >
    >--- Tracy Allen <tracy@e...> wrote:
    > >
    > > This motor you are using is an AC motor with a
    > > permanant magnet,
    > > right, and no commutator? Then it should also work
    > > as a tachometer.
    > > Tachometers are quite often used as the sensor for
    > > anemometers, but
    > > to interface to the stamp requires signal
    > > conditioner to square up
    > > the pulses. At low windspeeds the amplitude of the
    > > signal is low,
    > > only 10s of millivolts. That is for a standard
    > > anemometer tach. I
    > > don't know about your motor, but that may be a
    > > problem.
    > >
    > > If you have an oscilloscope hooked to it, you would
    > > see both the
    > > amplitude and the frequency of the voltage signal
    > > increase as you
    > > increase the rate of rotation. Hooked directly to a
    > > stamp pin, it
    > > would have to get up to 1.3 volts before it would
    > > even start to
    > > trigger, and then the speed would already be pretty
    > > high. Maybe you
    > > already have a circuit there, as you say, "...wired
    > > it up..."?
    > >
    > > -- regards,
    > > Tracy Allen
    > > electronically monitored ecosystems
    > > mailto:tracy@e...
    > > http://www.emesystems.com
    > >
    > > >Hello all;
    > > >
    > > > We are trying to make an anemometer from a
    > > motor,
    > > >so that we can spin it a certain amount of times
    > > and
    > > >then calibrate that to a wind speed. We wired it up
    > > so
    > > >that every time the motor completes a rotation, it
    > > >should give one increment in the count command. But
    > > >whenever we test this, it reads out either very low
    > > (0
    > > >most of the time) or very high (sometimes over
    > > 100).
    > > >We think we may need to use the debounce command,
    > > but
    > > >we dont know what else to do.
    > > >
    > > >Any ideas on what we can do?
    > > >
    > > >Thank you,
    > > >Arundel Tech Department
Sign In or Register to comment.