Shop OBEX P1 Docs P2 Docs Learn Events
Senior design project — Parallax Forums

Senior design project

gtchiefgtchief Posts: 7
edited 2005-03-23 15:28 in Learn with BlocklyProp
Hello all,
I'm a student at PSU and am looking into using a BASIC stamp for the first time. Our project we're doing is a speedometer for an r/c car. I have an idea of what I want to do, but was hoping for assistance. We only have about 8 weeks·to build this whole thing so its kind of a pain. We're hooking a hall effect transistor up by the wheel and a magnet·on the wheel so each passing will drive the transistor output low. I want to record the time for each occurance and subtract successive times and compare times for the quickest. Once this is found it would all be a matter of calculations. We're going to display this on an LCD once the car has stopped. Our main thing now is what is the best way to get these time values? Thanks

Comments

  • steve_bsteve_b Posts: 1,563
    edited 2005-02-16 14:48
    Download the PBasic editor and go through the help file.· Look for a command called "COUNT".·

    It will 'count' the 0-1-0 or 1-0-1 transitions for a given duration (you decide) and then you can manipulate as you please.

    Take the time to read through some of the 'FREE' documents that Parallax offers.· The "What's a Microcontroller" text is a good choice for beginners.

    ...and by recording "TIMES" you are interested in knowing the daily times of occurances...or how fast the wheel is turning.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • gtchiefgtchief Posts: 7
    edited 2005-02-16 14:57
    We read through and from what we understand is says we cannot access the internal clock through any of the PBASIC commands. Does this mean we cant use the internal clock times to record them?
  • steve_bsteve_b Posts: 1,563
    edited 2005-02-16 15:06
    Ok...it's a clock as in an oscillator...not as in 1AM....12:30pm.

    It's a steady pulse that clocks the chips for their operation.

    The COUNT funciton basically will monitor the defined pin for the transitions over a defined duration.· This duration is taken from the clock speed of the stamp.· I BELIEVE, on the BS2 the duration is in increments of 2uS.· So if you define the count command to monitor for a duration of 10 (no units) and it returns a 100 as far as counts....then you have had 100 revolutions for 20uS (duration value X time increment; 10 X 2uS).

    so you should be able to determine RPMs from that.· Then, if you know the circumference of your wheel, you'd be able to determine ground speed and distance traveled...etc...

    But if you want to know that the car left the gate at 10:00.00 and arrived at the finish line at 10:01.00 (fast car) then you'd need a timer IC.

    Parallax carry's them.http://www.parallax.com/detail.asp?product_id=604-00005·· Here's the link.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • gtchiefgtchief Posts: 7
    edited 2005-02-16 15:13
    I am fully aware that the clock is an oscillator. What I was saying is that from how we read it, it didnt seem like we would be able to use the oscillator for our needs. We were confused over this. Thank you for your help.
  • steve_bsteve_b Posts: 1,563
    edited 2005-02-16 15:48
    Because the stamp is a single tasker....it can't keep track of the oscillator while it's doing other things.

    So, you'd need to know how long it takes to issue a count command on it's own.·

    Here's a link to a page (from someone on the boards here) that took the time to determine how long it takes to start a function.

    http://www.emesystems.com/BS2speed.htm

    With a few added components the stamp becomes quite versatile....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • achilles03achilles03 Posts: 247
    edited 2005-02-16 16:21
    gtchief,
    You don't need to access the oscillator directly. With the COUNT command, you specify the time duration to sample, and the COUNT command basically "keeps an eye on the oscillator" for you, so to speak. If you have a count of 8 during a sample period of 250ms, then you're looking at 1920 RPM on the wheels. If you increase your sample duration, you get more resolution, but less samples/sec.

    The best solution to get a good sample rate AND resolution is to place more magnets on the wheel (approximately equally spaced, but it doesn't have to be perfect).

    Say if you have 4 magnets on the wheel, and you get a count of 21 for a sample period of 100ms, then that's 3150 RPM on the wheels. You have a resolution of 150RPM with 4 magnets and a sample period of 100ms. 5 magnets and 100ms gives a resolution of 120, and so on. If the speed isn't going to be varying greatly from one fraction of a second to the next, go with a higher sample period... 4 magnets and a 200 or 250ms sample period should probably give good results for an RC car.

    Hope that helps,
    Dave
  • Beau SchwabeBeau Schwabe Posts: 6,547
    edited 2005-02-16 17:00
    gtchief said...
    We're hooking a hall effect transistor up by the wheel and a magnet on the wheel

    gtchief,

    You might consider 2 magnets opposite of each other to "balance" the wheel..... Otherwise I might consider
    an optical approach.

    There is a slight possibility you could detect the RPM of the motor by monitoring the voltage spikes from the
    motor contacts as the motor rotates. This depends on the type of motor...

    (quick test if you have access to a scope)... place a scope across the terminals of a running motor, if it's going to
    work this way you should see definite "spikes" proportionally spaced apart depending on the motor speed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe - Mask Designer III

    National Semiconductor Corporation
    (Communication Interface Division)
    500 Pinnacle Court, Suite 525
    Mail Stop GA1
    Norcross,GA 30071
  • achilles03achilles03 Posts: 247
    edited 2005-02-16 18:37
    There is a slight possibility you could detect the RPM of the motor by monitoring the voltage spikes from the
    motor contacts as the motor rotates. This depends on the type of motor...
    THAT is a cool idea.· Or, along a similar line of thought, monitor the current from the battery pack, or the voltage across a very low value resistor (.1 Ohm?) ·in series with the motor.· The rate that it fluctuates above (or below) a threshold should be proportional to the motor's speed.

    Dave
  • gtchiefgtchief Posts: 7
    edited 2005-03-02 13:24
    We are using a gas engine and we saw that there is a command that counts how long the input pin is high.· How is this command implemented in a program?
  • Beau SchwabeBeau Schwabe Posts: 6,547
    edited 2005-03-02 16:28
    gtchief said...
    ...gas engine...

    Why not pick a signal off of the ignition spark to get your motor RPM. Seems as though
    there are several circuits on the web to do this. I would think you could use something
    as simple as a short lead on the gate of a MPF102 transistor in proximity of the spark plug
    wire. You shouldn't even need to touch the ignition wire at all to detect a signal.

    MPF102 Datasheet


    This is something like what I would have in mind...
    Spark Detector

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe - Mask Designer III

    National Semiconductor Corporation
    (Communication Interface Division)
    500 Pinnacle Court, Suite 525
    Mail Stop GA1
    Norcross,GA 30071
  • steve_bsteve_b Posts: 1,563
    edited 2005-03-02 18:07
    Could you use something along the lines of an inductive pickup?!· I'm certain these are what you can buy at Canadian Tire to test timing and such.

    But, like those "Fox & Hound" (wire sniffing) units....it's basically a wound coil put close to the selected noise source.· You could probably get enough power to light a lamp (incandescent or LED--would need power massaging) but then you could use an opto to isolate the noise from your stamp setup.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://ca.geocities.com/steve.brady@rogers.com/index.html
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • gtchiefgtchief Posts: 7
    edited 2005-03-23 13:32
    We have our program written and have been testing the microcontroller with a function genertator and we are outputing back to the computer and the count command seems to be missing pulses.· It will output a few zeros then output a few of the right amount of pulses during a second.· It will continue this pattern.· Does anyone know what could· be causing this?
  • edited 2005-03-23 15:28
    If your COUNT value goes above 65535, the command will return zero. You can reduce the·COUNT command's·Duration argument to a smaller value, like half a second. If that doesn't appear to solve it, there may be one or more flow control problems in the test progam. Post it and we can take a look.
Sign In or Register to comment.