Shop OBEX P1 Docs P2 Docs Learn Events
using an accelerometer to measure speed and distance — Parallax Forums

using an accelerometer to measure speed and distance

JWFJWF Posts: 4
edited 2008-04-21 00:15 in BASIC Stamp
Hi all,
I would like to use the basic stamp and the accelerometer (dual axis) to make a speed and distance data logger fro my car. Just like the ones that can be bought for around $300.. I want to be able to do 0-60 times and 1/4 mile times in my car to determine if a particular performance mod really helped where it counts. I did some forum searching and was not able find any projects like this. If anyone has already built something like this and would like to share, I would appreciate it. I'm not looking to reinvent the wheel, just want to tinker a bit and build something that I can use...
thanks in advance.
-John

Comments

  • FranklinFranklin Posts: 4,747
    edited 2008-04-19 14:14
    Neither of the things you want to measure can be done with an accelerometer. You might be able toi get that information from the cars computer by reading from the diagnostic plug but that would be the only way I could see it being done without adding some 'fifth wheel' device.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • HumanoidoHumanoido Posts: 5,770
    edited 2008-04-19 15:23
    You might try a simple magnetic Hall effect sensor
    device reading rpm off one of the wheels. A Basic
    Stamp can calculate speed and distance and report
    to a serial two line display or do some data logging.

    humanoido
  • ercoerco Posts: 20,260
    edited 2008-04-19 16:15
    Fun project. You're probably referring to the G-Tech Pro RR Meter shown at http://www.jegs.com/p/G-Tech/755819/10002/-1·. These are fun to play with, but the results aren't very accurate. We've used this particular·model a while. It's novel because it gets RPM info through the ciggie lighter connection and takes a stab at generating dyno info (HP and torque values during acceleration) and cornering G-force info as well. The heart of it is an accelerometer which gets "zeroed-out" in some fixed position/attitude in the car. You get some values that are relative, but not particularly accurate. Any body roll, suspension travel, nose lift/dive affects the accelerometer and its accumulated data calculations. The "zero position" is always drifting and never quite comes back to the origin. That kills overall accuracy.

    BTW, I'm sure you know that·rear-wheel HP is·always significantly·less than advertised engine specs. Always quite depressing to account for that discrepancy.

    Nonetheless, if you want to use an accelerometer to read your car's acceleration, it is a fun and worthwhile project, you'll learn a ton. You'll be able to test engine mods for relative improvement, but·all your test runs must be 100% identical for any meaningful comparison. Same street, same distance, same direction, same driving style, same wind, fuel, weather, plug condition, vehicle weight (fuel+passengers), tire pressure/condition, etc. Only·your test·variable can change, everything else must be controlled. And even identical runs will vary, so you'll need to make·several runs in each configuration and average them together.

    Now the bad news. All that careful testing I just described as necessary is the·hardest part to implement. The best results you will ever get with a properly-working accelerometer·will never be as·good as if you just used a simple stopwatch over a fixed distance. Reality often deals us a cold hard slap in the face.

    Not that I'm advocating street racing, but if you're after real·timing results,·you efforts might be better spent building an accurate·stopwatch that gets started and stopped by breaking a laser beam at the start and finish. Use wireless communication to send the finish signal back to a stamp-controlled timer at the start line. Your own personal drag strip. Make small paint marks on the street/curb to place your sensors in consistent locations. Aligning the laser will be the hardest part, but it can be done with a screw-adjustable platform. Don't ask me how I know, as·I will deny any and all allegations of impropriety. BTW, we never had this conversation.

    Alternatively, you could mount the timer in the car, and use wide reflective tape for your start/finish lines. You'll shoot an IR beam downward and look for a reflection to start & stop your timer.

    As always, drive responsibly and keep the·rubber side down.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."

    Post Edited (erco) : 4/19/2008 4:27:21 PM GMT
  • ercoerco Posts: 20,260
    edited 2008-04-19 16:24
    Good call, humanoido. I love your Hall sensor idea, a wheel encoder for your car. Front wheel drive cars are perfect, mount the sensor on a rear wheel so that spinning your front tires doesn't affect accuracy. This could yield accurate results, if calibrated. Just keep consistent tire pressure.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • JWFJWF Posts: 4
    edited 2008-04-19 17:44
    The 'test car' is a 2006 chrysler 300 srt8. All of this could be made much easier by tapping the CAN bus and just reading the vehical speed and then perhaps getting the distance from a gps (the one built in perhaps. But the problem with that is the CAN bus codes are not openly available. The companies that have hacked them for there tuners may not come off the codes (i haven't asked yet) because of the work and effort they put into hacking them. I guess I coud ask. I'm not interested in creating my own tuner, I just want to be able to do as described in the 1st post. It would be killer if I could link into the CAN bus, gather all the engine params and then display them back on the nav screen... I think the propellor would work great for that. Do we have any CAN bus experts out there?
    -John
    p.s. Thanks for all the great input
  • achilles03achilles03 Posts: 247
    edited 2008-04-21 00:15
    Franklin said...
    Neither of the things you want to measure can be done with an accelerometer. You might be able toi get that information from the cars computer by reading from the diagnostic plug but that would be the only way I could see it being done without adding some 'fifth wheel' device.

    You CAN approximate velocity with an accelerometer by integrating it once, and distance by integrating it twice:

    velocity=previous velocity (in units/sec) + acceleration (same units/sec^2) * sample time
    distance=previous distance (in units) + velocity (same units/sec) * sample time + 1/2 *acceleration (same units/sec^2) * sample time^2

    You'd also need a real-time clock that the stamp could access to figure out accurate time intervals.

    Measuring distance, and even velocity, with a noisy accelerometer is difficult. And almost all chip-based accelerometers are noisier than more traditional accelerometer technologies.

    Hope that helps,
    Dave
Sign In or Register to comment.