Counter

ArchiverArchiver Posts: 46,084
edited 2000-03-18 - 06:01:00 in Microcontrollers
I have a project idea that's going through my head but I have a number of
stopping points.
What I would like to do is have two IR TX and RX modules, when an object passes
the first IR
light the stamp will turn on a counter and count pulses, then when the object
passes the
second IR light, the stamp will stop the counter from counting, get the value,
do the math
and get the speed of the object, then log to EEprom. My problem is most IR
modules need to
be pulsed to be used in high powermode, so if sending 1 and then 0 how could I
detect a
droped beam (object passing through). The next problem is the counter, Is there
a counter
that will give at least 8 to 10 bit results, that I can turn on and off using a
stamp, that
is capable of 1mhz input pulses. What is the best way of getting pulses? crystal
oscillator?
and the third or forth question is HOW any drawings, chip ideas, oscillator
ideas, ect. I
don't think I can use the count command because I need to drop out of the count
loop after
seeing the second light beam being broken.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-03-17 - 04:42:00
    At 06:53 PM 3/16/00 -0800, you wrote:

    >I have a project idea that's going through my head but I have a number of
    stopping points.
    >What I would like to do is have two IR TX and RX modules, when an object
    passes the first IR
    >light the stamp will turn on a counter and count pulses, then when the
    object passes the
    >second IR light, the stamp will stop the counter from counting, get the
    value, do the math
    >and get the speed of the object, then log to EEprom. My problem is most IR
    modules need to
    >be pulsed to be used in high powermode, so if sending 1 and then 0 how
    could I detect a
    >droped beam (object passing through). The next problem is the counter, Is
    there a counter
    >that will give at least 8 to 10 bit results, that I can turn on and off
    using a stamp, that
    >is capable of 1mhz input pulses. What is the best way of getting pulses?
    crystal oscillator?
    >and the third or forth question is HOW any drawings, chip ideas,
    oscillator ideas, ect. I
    >don't think I can use the count command because I need to drop out of the
    count loop after
    >seeing the second light beam being broken.

    Hi Larry,
    I don't know if you're on the BasicX list. The BX24 has a real
    time clock, multitasking and some other features that would be useful for
    this project. I don't like to plug it on the parallax list, but I've been
    using it alot and it's way more powerful than anything they have. Check:

    http://www.basicx.com

    I have questions, but I'll post them to the list.

    Best, Duncan
  • ArchiverArchiver Posts: 46,084
    edited 2000-03-17 - 20:47:00
    Larry:
    I have a model train speedometer that runs off two IR beams. Since the
    range is only 4", I operate the IR emitters continuously at low power.
    Recalling your previous posting, I believe you had a big range and needed
    pulsed high power, so this is no help. However, I wonder if you could use a
    timing loop in your program. When the 1st beam is broken, the state is
    latched, and starts the timing loop. When the second beam is interrupted,
    we exit the loop, & the total count is used to compute & display speed. The
    program was developed on a BS1 & transferred to a PIC. The PIC is crystal
    clocked, so it is accurate. The loop speed, (430 Hz including a pause-2 and
    two IF-THENs), was determined by measurement with a stop watch over a large
    count. Resolution ranges from 8 to 12 bit accuracy, depending on elapsed
    time. After a time-out, the beam latches are reset.

    If this is not applicable, I would use one of the crystal oscillators from
    Digikey and gate it with an AND or OR gate controlled by the IR beams.
    These oscillators are cheap & accurate & run off 5V. The oscillator
    frequency used depends on time interval/resolution required..

    What time intervals do you need to measure? If it is long compared to pulse
    rate of your transmitter, the error is negligible. The rx could average
    over the time of one or two pulse intervals and detect interrupt if several
    cycles are lost. Even faster 1 pulse response can be obtained by using
    synchronous detection as Ron suggested.

    Just a few thoughts,
    Ray McArthur

    Original Message
    From: LarryGaminde <lgaminde@t...>
    To: 1 BASIC STAMP <basicstamps@egroups.com>
    Sent: Thursday, March 16, 2000 9:53 PM
    Subject: [noparse][[/noparse]basicstamps] Counter


    > I have a project idea that's going through my head but I have a number of
    stopping points.
    > What I would like to do is have two IR TX and RX modules, when an object
    passes the first IR
    > light the stamp will turn on a counter and count pulses, then when the
    object passes the
    > second IR light, the stamp will stop the counter from counting, get the
    value, do the math
    > and get the speed of the object, then log to EEprom. My problem is most IR
    modules need to
    > be pulsed to be used in high powermode, so if sending 1 and then 0 how
    could I detect a
    > droped beam (object passing through). The next problem is the counter, Is
    there a counter
    > that will give at least 8 to 10 bit results, that I can turn on and off
    using a stamp, that
    > is capable of 1mhz input pulses. What is the best way of getting pulses?
    crystal oscillator?
    > and the third or forth question is HOW any drawings, chip ideas,
    oscillator ideas, ect. I
    > don't think I can use the count command because I need to drop out of the
    count loop after
    > seeing the second light beam being broken.
    >
    >
    >
    > eGroups.com home: http://www.egroups.com/group/basicstamps
    > http://www.egroups.com - Simplifying group communications
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-03-17 - 22:33:00
    This is a thought, I think I will need higher than the 430 htz, Ill have do the
    math. I was
    looking at 10khz to 1 mhz for the counter. now where in digi key is the crystal
    oscillators
    you are talking about.
    This is a way that could be used, I could open the distance between beams and
    use a slower
    oscillator.
    Im really not sure how fast I could pulse the IR transmitter and not overdrive
    it ( they
    have no current limit resistors for the IR led). I was looking at measuring
    Maybe 100 mph
    within a 2 ft span of IR transmitters and having a counter count somewhere
    between 250
    pulses to 1000 pulses the higher the resolution the better. Would it be possible
    to see what
    you have done ?

    rjmca wrote:
    >
    > Larry:
    > I have a model train speedometer that runs off two IR beams. Since the
    > range is only 4", I operate the IR emitters continuously at low power.
    > Recalling your previous posting, I believe you had a big range and needed
    > pulsed high power, so this is no help. However, I wonder if you could use a
    > timing loop in your program. When the 1st beam is broken, the state is
    > latched, and starts the timing loop. When the second beam is interrupted,
    > we exit the loop, & the total count is used to compute & display speed. The
    > program was developed on a BS1 & transferred to a PIC. The PIC is crystal
    > clocked, so it is accurate. The loop speed, (430 Hz including a pause-2 and
    > two IF-THENs), was determined by measurement with a stop watch over a large
    > count. Resolution ranges from 8 to 12 bit accuracy, depending on elapsed
    > time. After a time-out, the beam latches are reset.
    >
    > If this is not applicable, I would use one of the crystal oscillators from
    > Digikey and gate it with an AND or OR gate controlled by the IR beams.
    > These oscillators are cheap & accurate & run off 5V. The oscillator
    > frequency used depends on time interval/resolution required..
    >
    > What time intervals do you need to measure? If it is long compared to pulse
    > rate of your transmitter, the error is negligible. The rx could average
    > over the time of one or two pulse intervals and detect interrupt if several
    > cycles are lost. Even faster 1 pulse response can be obtained by using
    > synchronous detection as Ron suggested.
    >
    > Just a few thoughts,
    > Ray McArthur
    >
    >
    Original Message
    > From: LarryGaminde <lgaminde@t...>
    > To: 1 BASIC STAMP <basicstamps@egroups.com>
    > Sent: Thursday, March 16, 2000 9:53 PM
    > Subject: [noparse][[/noparse]basicstamps] Counter
    >
    > > I have a project idea that's going through my head but I have a number of
    > stopping points.
    > > What I would like to do is have two IR TX and RX modules, when an object
    > passes the first IR
    > > light the stamp will turn on a counter and count pulses, then when the
    > object passes the
    > > second IR light, the stamp will stop the counter from counting, get the
    > value, do the math
    > > and get the speed of the object, then log to EEprom. My problem is most IR
    > modules need to
    > > be pulsed to be used in high powermode, so if sending 1 and then 0 how
    > could I detect a
    > > droped beam (object passing through). The next problem is the counter, Is
    > there a counter
    > > that will give at least 8 to 10 bit results, that I can turn on and off
    > using a stamp, that
    > > is capable of 1mhz input pulses. What is the best way of getting pulses?
    > crystal oscillator?
    > > and the third or forth question is HOW any drawings, chip ideas,
    > oscillator ideas, ect. I
    > > don't think I can use the count command because I need to drop out of the
    > count loop after
    > > seeing the second light beam being broken.
    > >
    > >
    > >
    > > eGroups.com home: http://www.egroups.com/group/basicstamps
    > > http://www.egroups.com - Simplifying group communications
    > >
    > >
    > >
    > >
    >
    >
    >
    > eGroups.com home: http://www.egroups.com/group/basicstamps
    > http://www.egroups.com - Simplifying group communications
  • ArchiverArchiver Posts: 46,084
    edited 2000-03-18 - 04:19:00
    After doing some quick math this approach should work even at 100hz. How far
    apart are
    your transmitter beams from each other

    rjmca wrote:
    >
    > Larry:
    > I have a model train speedometer that runs off two IR beams. Since the
    > range is only 4", I operate the IR emitters continuously at low power.
    > Recalling your previous posting, I believe you had a big range and needed
    > pulsed high power, so this is no help. However, I wonder if you could use a
    > timing loop in your program. When the 1st beam is broken, the state is
    > latched, and starts the timing loop. When the second beam is interrupted,
    > we exit the loop, & the total count is used to compute & display speed. The
    > program was developed on a BS1 & transferred to a PIC. The PIC is crystal
    > clocked, so it is accurate. The loop speed, (430 Hz including a pause-2 and
    > two IF-THENs), was determined by measurement with a stop watch over a large
    > count. Resolution ranges from 8 to 12 bit accuracy, depending on elapsed
    > time. After a time-out, the beam latches are reset.
    >
    > If this is not applicable, I would use one of the crystal oscillators from
    > Digikey and gate it with an AND or OR gate controlled by the IR beams.
    > These oscillators are cheap & accurate & run off 5V. The oscillator
    > frequency used depends on time interval/resolution required..
    >
    > What time intervals do you need to measure? If it is long compared to pulse
    > rate of your transmitter, the error is negligible. The rx could average
    > over the time of one or two pulse intervals and detect interrupt if several
    > cycles are lost. Even faster 1 pulse response can be obtained by using
    > synchronous detection as Ron suggested.
    >
    > Just a few thoughts,
    > Ray McArthur
    >
    >
    Original Message
    > From: LarryGaminde <lgaminde@t...>
    > To: 1 BASIC STAMP <basicstamps@egroups.com>
    > Sent: Thursday, March 16, 2000 9:53 PM
    > Subject: [noparse][[/noparse]basicstamps] Counter
    >
    > > I have a project idea that's going through my head but I have a number of
    > stopping points.
    > > What I would like to do is have two IR TX and RX modules, when an object
    > passes the first IR
    > > light the stamp will turn on a counter and count pulses, then when the
    > object passes the
    > > second IR light, the stamp will stop the counter from counting, get the
    > value, do the math
    > > and get the speed of the object, then log to EEprom. My problem is most IR
    > modules need to
    > > be pulsed to be used in high powermode, so if sending 1 and then 0 how
    > could I detect a
    > > droped beam (object passing through). The next problem is the counter, Is
    > there a counter
    > > that will give at least 8 to 10 bit results, that I can turn on and off
    > using a stamp, that
    > > is capable of 1mhz input pulses. What is the best way of getting pulses?
    > crystal oscillator?
    > > and the third or forth question is HOW any drawings, chip ideas,
    > oscillator ideas, ect. I
    > > don't think I can use the count command because I need to drop out of the
    > count loop after
    > > seeing the second light beam being broken.
    > >
    > >
    > >
    > > eGroups.com home: http://www.egroups.com/group/basicstamps
    > > http://www.egroups.com - Simplifying group communications
    > >
    > >
    > >
    > >
    >
    >
    >
    > eGroups.com home: http://www.egroups.com/group/basicstamps
    > http://www.egroups.com - Simplifying group communications
  • ArchiverArchiver Posts: 46,084
    edited 2000-03-18 - 06:01:00
    Larry:
    I am presently falling asleep at the switch, (it's ~1am). Tomorrow I will
    mail you a copy of the BS1 program off list. The sensors are 10" apart.

    Regards,
    Ray McArthur
Sign In or Register to comment.