Barebones set up for reading MPH from car(and other basic funtions)

Hello, so I am basically wondering if anyone can tell me if this is possible or what I will need to do it. I have programmed and created projects using an arduino board, but this is the first time I want to try separating the chip from the board. The things my project will need to do are read the car's speed( I believe this will involve reading voltage pulses and maybe measuring how many over a period of time or something...I'm still figuring out exactly how that part works), read a switch as input and activate a couple relays. This seems like I shouldn't need more than just the minimum to run a chip, but I may be missing something. Also I will be programming it using an actual arduino board since I already have one. If anyone can tell me if this should work or what I need to do to make it work that would be greatly appreciated.

Also I plan on following the guides from this page : Arduino Playground - HomePage as the base for my setup.

Thank you!

but I may be missing something

I don't think so, this is very easy to do. You can get it working with your existing Arduino then transfer the processor to your own PCB if you like.

I'm still figuring out exactly how that part works

Put a magnet on a wheel or tail shaft and use a hall-effect sensor to read the revolutions. Then either time the period of the pulses (good for low speed) or the frequency of the pulses (good for high speed) and use some maths involving the rolling radius* of your wheel and the diff ratio (if you are using the tailshaft) to get the speed.

  • Rolling radius is the distance from the center of the hub to the ground, this is less than the normal radius of the wheel/tyre because the bottom of the tyre is compressed.

Rob

Graynomad:

but I may be missing something

I don't think so, this is very easy to do. You can get it working with your existing Arduino then transfer the processor to your own PCB if you like.

I'm still figuring out exactly how that part works

Put a magnet on a wheel or tail shaft and use a hall-effect sensor to read the revolutions. Then either time the period of the pulses (good for low speed) or the frequency of the pulses (good for high speed) and use some maths involving the rolling radius* of your wheel and the diff ratio (if you are using the tailshaft) to get the speed.

  • Rolling radius is the distance from the center of the hub to the ground, this is less than the normal radius of the wheel/tyre because the bottom of the tyre is compressed.

Rob

Wow, thank you for the very fast reply!

So I won't need any external timers or any little things like that that are on the arduino board? And thank you very much for the suggestion on measuring speed, but I kind of want to try and use the method described on this page: MPGuino - EcoModder Forum Wiki
What I mean't when I said "I'm still figuring this part out" was that I know what method I want to use I am just still trying to figure out how to properly implement that method.

But if you understand both methods, would your suggestion be just as reliable or easier to set up, etc.?

They don't seem to have a real answer for detecting speed though.

Unfortunately there isn't a generic way to do this. You have to locate a schematic for your vehicle and do some guessing and testing...

But if you have access to an appropriate signal then that is the way to do it.

would your suggestion be just as reliable or easier to set up, etc.?

IF there is an appropriate signal to tap then it's easier to use that, of not what I said is also easy but does require more work.

or any little things like that that are on the arduino board?

You still need the power supply components, crystal, and a few caps. And it's good practice to beef up the power supply as vehicle 12v systems are not a very good for microprocessors.


Rob

Ok so I guess I'll be looking into using the existing VSS(vehicle speed sensor). I think it is something like the car has a set number of pulses per mile and so I just need to use math to convert pulses per 100 ms or something to MPH. One question about that is: How do I read pulses that quickly? I know how to read on/off or 0/1, but I don't know how I would try to measure how many times a pin pulsed.
Actually another option might be a frequency to voltage convertor. Would this be a possible alternative? I would then have to be able to read voltage, but that might be simpler.

As for the other parts like crystals, capacitors etc. I think that guide has those in it and for voltage regulation, I actually recently made a 9v voltage regulator for use in a car for another project which should work as the power supply for this.

How do I read pulses that quickly?

Well we don't know how quick they are yet but I doubt they are very fast by microprocessor standards, normally I would run the signal into an external interrupt pin and use the ISR (Interrupt Service Routine) to update a counter. Then every (say) second read the value of the counter, reset it then do the maths.


Rob

cmat1120:
I actually recently made a 9v voltage regulator for use in a car for another project which should work as the power supply for this.

An ATMega chip would NOT fair well with a 9v regulator; the operating voltage only goes up to 5.5v.

ok, ya I thought of some type of counter thing earlier, but wasn't sure if it would work. If I can set up a frequency to voltage regulator then I could simply read the voltage with one analog pin. I'll probably try the converter and if it doesn't work as I need it to I'll resort to measuring pulses.

And ah! thank you Arrch for catching that 9v thing. I guess i didn't realize my 9v regulator was then going into the arduino board's pre-existing regulator. I should be able to switch the regulator out for the 5v one though and that should work.

Thank you so much for all the help.

Depending on the year/make/model of the car, there are a few places where you could potentially hijack the speed sensor. If the car has ABS, it has wheel speed sensors built into it. While you need to be very careful while messing with the ABS wiring, many cars run two rear wheel speed sensors and simply ignore one of them unless the sensor goes bad (and it would then trigger an ABS INOP light or BRAKE!).

The next option is the output shaft of the transmission - it should have a sensor at the same speed as the driveshaft - that usually works well (as it's used for vehicle speed), but on newer cars the sensor may be internal and hard to get to the wiring.

The third place is somewhere in the car's wiring harness. Newer cars multiplex the signals to the dashboard via networks like J1939, but older cars just ran wires - some even ran the speed sensor to the ECU and then did the math there and re-transmitted the signal to the gauge cluster.

Hopefully you can find good information online - though check out the megasquirt forums for someone who may have done a stand-alone conversion of your car (or using the same transmission) as they may have done the legwork already. Megasquirt also has some stuff on how to convert signals from one to another.

What other functions are you looking for? Anything in particular or just speed/mpg?

Another alternative is to read the speed from the OBD interface. Has the advantages that the calculation is done for you and there’s a large amount of additional data you can get if you need it: http://code.google.com/p/opengauge/wiki/OBDuino

The only two things I would need to know is when the car is going faster than say 30 mph(doesn't need to be too exact) and when the brake pedal is pushed. OBD may be a bit overkill, but it would be easier. And actually if OBD can tell me when the brake is being pushed then that might actually make it worth it. I'm not sure if it can though...back to researching haha.

Reading a VSS is fairly simple.
I have tried several methods and am sold on MAXIM's 99xx chips, 9924 for a single VSS or 9926 for dual. 3[6] resistors, 4[8] caps for a nice clean square wave.
The datasheets give the needed support info, the code is easy, just a few lines.
Unfortunately they are SMD chips, however Proto-Advantage.com can fix you up with a breakout pretty dog gone inexpensively.
Using external interrupts are the ONLY way to go IMNSHO, Makes for a nice even flowing loop.
To me the hardest part was the formulas ... I can barely add 2+2!
They are based on how many teeth are on the reluctor ring (gear teeth) as well as tire diameter and possibly ring and pinion ratio depending on sensor location.

if the vehicle is 90's or newer it likely has a VSS on the drive train someplace, typically they are installed to read the ring gear or reluctor on the transmission output.

What is the vehicle ??

-Enjoy
fh : )_~