NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » RPM to MPH

April 19, 2011
by trapperj86
trapperj86's Avatar

Hi, I have not posted in a while or done anything with my nerdkit, to busy with school(Biomedical) but I'm done in two weeks so I wanted to start learning to program more. My speed sensor in my car is broke, so instead of spending $200 on the sensor I wanted to try to do something else. What I'm wondering is if it is possible to wright a program that will convert RPM into Mph based on gear ratio,and the gear I am in? If its possible I'm not sure where to even begin, other then gathering all the data. Any help would be appreciated. Thanks, Matt

April 19, 2011
by BobaMosfet
BobaMosfet's Avatar

RPM is independent of gear ratio in a vehicle with an automatic transmission (if that's what you have) because the transmission is hydraulic (in order to physically disconnect the drive shaft and torque issues from the engine). So, the simple answer is, not really.

However, you could put a magnet on your drive-shaft, and use a hall-effect sensor to count rotations. Just jack the back-end up (if it's rear-wheel drive), mark the drive-shaft and mark the tire. Rotate the tire (and wheel) as far as it takes to turn the driveshaft once. Measure how far the tire went (radius), and convert driveshaft revolutions into distance traveled. Add a time-constant and voila, you have speed.

next step-- turn your project into cruise-control.

BM

April 19, 2011
by BobaMosfet
BobaMosfet's Avatar

Or, better than radius, use circumference because that's a direct conversion to distance.

BM

April 19, 2011
by trapperj86
trapperj86's Avatar

It is a manual transmission. My thought was that the car will go X mph at Y rpm in Z gear. When I'm cruising at 4k RPM in 5th gear I'm at ~65 That does not change, in 4th gear it would be ~6k RPM ect. I was thinking I could base it off of that somehow. Am I wrong in my thinking? Thanks,Matt

April 19, 2011
by missle3944
missle3944's Avatar

You should take a look at the OBD || car computer tut on the nerdkits website.

April 20, 2011
by 6ofhalfdozen
6ofhalfdozen's Avatar

Heya Trapper,

If you know your car model year and such, there are listing of the speedometer settings and matching ratios, they will get you almost there. For instance, on my car's speedometer it uses a magnetic pickup from the cable to the dial, so 1024rpm of the speedometer cable is 60mph. This works great if your speedometer is broken but the cable is fine. simple to set up a pulse counter and output it...

On the other hand if the cable is broken and you can find your gear ratios and tire dimensions, you can make up tables of XXX rpm in YYY gear equals ZZZ mph. Putting it on an mcu shouldn't be too tough.

As usual, it is always better to cough up the cash and buy the proper parts.. But it is definately possible... a good idea?? dunno, but possible, yes..

April 20, 2011
by mongo
mongo's Avatar

I just stick a GPS receiver on the dash and it tells me how fast I am going, down to the tenth of a mile per hour.

April 20, 2011
by trapperj86
trapperj86's Avatar

Yea, i could use a GPS or my phone. I just wanted a project to do. Im not sure if this will work because the sensor is broke from the tranny. Thanks,Matt

May 20, 2011
by huzbum
huzbum's Avatar

Should be simple.

You'll have to start out with a basic tach. I have working tach code here: http://www.nerdkits.com/forum/thread/1258/ You'll have to modify it to your purpose.

Next you'll need a tach pulse. As suggested by other members a hall effect switch is probably the most effective. You could attach your own hall switch to the output shaft of the transmission, but I would suggest using something already integrated into the car so you don't have to mess with anything mechanical. You could pull wheel speed directly from the ABS which is basically a hall switch inside the wheel hub, or you could use the engine tach signal on the distributor to determine engine speed and multiply by different ratios for different gears.

Then you'll have to determine the tach pulse to MPH ratio and divide in software.

I work at an auto shop, so if you tell me what kind of car you have, I might be of more help in determining the best tach option and gear ratios.

I have been thinking about doing something similar on my motor cycle, but I haven't gotten around to it. Been thinking I could use the MCU to drive a vintage engine tach as the speedometer.

May 20, 2011
by Ralphxyz
Ralphxyz's Avatar

Hey huzbum, great to hear from you again.

How about using OBD-II for engine speed?

Of course I am also looking for brake pressure hoping that might be a OBD-II function also.

I need to sense it independently coming and slowing.

Ralph

May 25, 2011
by huzbum
huzbum's Avatar

reading OBD II data is much more complex than just picking up a tach signal. It's supposed to be standard, but things are still different from car to car and module to module. We use a scan tool from snap-on that costs about $5000 and requires $1000 in software updates every year to be able to read all the data on new models. They all have the same connector, but each make requires a different "key" (small circuit board) to communicate and have different addresses for data.

You can pick up engine speed from the OBD II data, and probably brake on/off data if you can communicate with the ABS module (and figure out all the addresses), but probably not brake pressure, as I don't believe there is a pressure sensor anywhere in the brake system.

What would be incredibly useful, is if you can read wheel speed information from the ABS module and produce an adjusted average output and feed it back to the car as the transmission speed sensor signal. Not sure what effect the delay from this loop would have on vehicle performance, but it would fix the speedometer problem.

Ralph I'm not sure what your project is or requires, but you can more easily obtain engine speed from the tach circuit and brake on/off status can more easily be obtained from the brake pedal switch. If you require brake pressure, I think your best bet would be to attach a linear potentiometer next to the brake pedal switch.

May 25, 2011
by Ralphxyz
Ralphxyz's Avatar

Thanks, huzbum. I do not really really have a specific project in mind.

The Nerdkit OBD-II tutorial just intrigued me and then some of the other talk here in the forum just added to my curiosity.

I do need a speedometer for my 199 Ford Ranger 4x4, so that lead me to thinking aout OBD-II.

It would be interesting to see how much OBD-II generic information one could see with just a mcu and programming.

This thread got me thinking about brake pressure.

This would be fairly easy if I could read pressure. Using a pot would force it to being a one of a kind custom type thing.

Ralph

Post a Reply

Please log in to post a reply.

Did you know that our customers love us? Learn more...