electronics project: collect mph data
-kevin

Or you could buy a Gtech on ebay for $60. It uses an accelerometer and integrates to find speed and distance. 0-60 is just a statistic invented by car magazines anyways... 1/4 mile ET/mph is more important.
I have very little electronic knowhow but I've always wanted to have a device with preset cruise speeds.
I use the cruise a lot to help avoid speeding fines, it's so great to go past the speed camera and see the digital readout and know I'm safe.
As I pass from one speed limit to another, instead of continually resetting the cruise, I would just press a preset button and smoothly go up or down to the setting - if you get your device working, you may discover enough knowledge to make my idea work too.
What do you reckon?
S'nut
This is what the recorded .wav file looks like. The red is the VSS signal and the blue is the RPM signal.
I wrote a program that analyze the recorded VSS signal and calculate some data.
This is a printout from the program.
======================================== ======================================
60ft Time: 2.34[s] Speed: 14.18[m/s] 51.05[km/h] 31.72[mph]
330ft Time: 5.94[s] Speed: 29.87[m/s] 107.55[km/h] 66.83[mph]
594ft Time: 8.34[s] Speed: 36.77[m/s] 132.39[km/h] 82.26[mph]
1/8 mile Time: 8.88[s] Speed: 37.99[m/s] 136.76[km/h] 84.98[mph]
1/8 mile Trap Speed (last 66ft) Speed: 37.42[m/s] 134.71[km/h] 83.70[mph]
1000ft Time: 11.42[s] Speed: 43.35[m/s] 156.04[km/h] 96.96[mph]
1254ft Time: 13.15[s] Speed: 46.51[m/s] 167.43[km/h] 104.04[mph]
1/4 mile Time: 13.58[s] Speed: 47.20[m/s] 169.92[km/h] 105.58[mph]
1/4 mile Trap Speed (last 66ft) Speed: 46.87[m/s] 168.74[km/h] 104.85[mph]
------------------------------------------------------------------------------
10m Time: 1.66[s] Speed: 10.35[m/s] 37.25[km/h] 23.15[mph]
50m Time: 4.04[s] Speed: 22.83[m/s] 82.18[km/h] 51.06[mph]
100m Time: 5.93[s] Speed: 29.83[m/s] 107.40[km/h] 66.73[mph]
500m Time: 15.59[s] Speed: 48.73[m/s] 175.44[km/h] 109.01[mph]
------------------------------------------------------------------------------
0-40[km/h] Time: 1.80[s] Distance: 11.50[m] 37.7[ft]
0-50[km/h] Time: 2.29[s] Distance: 17.60[m] 57.7[ft]
0-70[km/h] Time: 3.33[s] Distance: 35.00[m] 114.8[ft]
0-90[km/h] Time: 4.55[s] Distance: 62.40[m] 204.7[ft]
0-60[mph] Time: 5.06[s] Distance: 75.50[m] 247.7[ft]
0-100[km/h] Time: 5.34[s] Distance: 83.20[m] 273.0[ft]
0-130[km/h] Time: 8.06[s] Distance: 170.90[m] 560.7[ft]
0-150[km/h] Time: 10.59[s] Distance: 269.51[m] 884.3[ft]
0-100[mph] Time: 12.14[s] Distance: 336.31[m] 1103.4[ft]
------------------------------------------------------------------------------
40-70[km/h] Time: 1.52[s] Distance: 23.50[m] 77.1[ft]
40-100[km/h] Time: 3.54[s] Distance: 71.70[m] 235.2[ft]
40-130[km/h] Time: 6.26[s] Distance: 159.40[m] 523.0[ft]
40-150[km/h] Time: 8.79[s] Distance: 258.01[m] 846.5[ft]
70-100[km/h] Time: 2.01[s] Distance: 48.20[m] 158.1[ft]
100-150[km/h] Time: 5.25[s] Distance: 186.31[m] 611.3[ft]
------------------------------------------------------------------------------
Last edited by JoBy; Jan 12, 2006 at 09:47 AM.
Nice Data! You're obviously more experienced than I with this!
Centralcoaster:
Thanks for the info- looks like I have my answer! 0-60 is a nice figure 'cause I can derive it pretty easily from only the speed data and there's no need to set up a 1/4 mile course/timer. I agree, the 1/4mi # is more relevant, but in this case its about simplicity and convenience.
A86:
That 'Moates' program- it gets all its input from an accelerometer? I'd think it would be more accurate to get it (in my application) from speed sensor on the car.
stingray:
yeah, it wouldn't be too tough to tap into the cruise control advance/decrease contacts and activate them accordingly. First things first though. If I ever make this work, and have spare time available, then I'll start thinking about other features.
Thanks all!
-kevin
That 'Moates' program- it gets all its input from an accelerometer? I'd think it would be more accurate to get it (in my application) from speed sensor on the car.

The Best of Corvette for Corvette Enthusiasts
As many data points as desired could easily be collected.
The data could be downloaded to a PC and another simple program could display the data and do the horsepower calculations based on an accurate weight of the vehicle input.
PIC's are IDEAL for projects like this and MUCH cheaper that the BASIC Stamps and Atmel stuff. MUCH cheaper!!
But the G-Tech is already bult and doesn't cost that much.
I have built a circuit/system that uses the VSS for input that displays the speed of the vehicle, elapsed time and odometer data using a Microchip PIC 16F628. It also stores the maximum speed obtained during the run. Code is pretty much ANSI C and the hardware is about as simple as it gets. I'm using 7 Segment LED's at the moment but am going to switch over to a EL Backlight 4x20 LCD.
I built this for my old '73 Chevy TPI truck.
The next feature to be added will read the injector pulse width, MAP and TPS to determine the fuel consumption. From there I'll use the fuel gauge as an input to compute the mileage to empty and run a low fuel warning. Probably will throw insome code to use the same device as a tachometer.
Much more than that and the 16F877 is a better choice.(I want to add digital display of the water temp, oil pressure, etc)
A lot of functionality for an old vehicle.
Just an interesting project while I'm outta 'real' work and starving to death. LOL
Most of the jobs for folks like me have been 'outsourced' to Pakistan and India where they can hire software engineers for 50 cents an hour:
Don't know if there's a market for such a device as I've built but it might be popular over on ChevyTalk.Com.
BTW, the VSS outputs either 2000ppm or 4000ppm. PPM = Pulses Per Mile. There are magnetic VSS generators and some optical ones out there. Most of the PIC chips have a Schmitt Trigger so no input waveshapping is necessary. Pretty much straight in from the VSS through a resistive isolation network.
BTW, Datamaster has a 1/4 mile calculator built into it.
Does most of what the original poster wanted to do.
Last edited by VetNutJim; Jan 12, 2006 at 08:39 PM.
It's pretty straightforward.
/*======================================= ========
Nov.25th,2005 J.Alford
This Data Is Useful For Building A Digital Speedometer
VSS Sensor Timing Data:
4000PPM VSS:
60mph @ 4000 pulses Per Hour = 240,000 Pulses Per Hour
30mph @ 4000 pulses Per Hour = 120,000 Pulses Per Hour
60mph = 240000/3600 = 66.66 Pulses Per Second or 66.66hz
30mph 120000/3600 = 33.33 Pulses Per Second or 33.33hz
-------------------------------------------------------
2000PPM VSS Calculations:
60mph @ 2000 Pulses Per Hour = 120,000 Pulses Per Hour
30mph @ 2000 Pulses Per Hour = 60,000 Pulses Per Hour
60mph 120000/3600 = 33.33 Pulses Per Second or 33.33hz
30mph 60000/3600 = 16.66 Pulses Per Second or 16.66hz
After 4000 Pulses, The Vehicle Has Traveled 1 Mile
1/10 of a Mile Is 400 Pulses
Every 400 Pulses, Update Mileage Accumalator By .1
======================================== ============*/
Last edited by VetNutJim; Jan 12, 2006 at 08:56 PM.
By recording the wav file using samples at 44.1 kHz the time axis is known.
In the program I set up two series of 'interesting' data points, one for distance and one for speed.
Each distance is a fixed number of pulses from the start.
Each speed is a fixed number of samples between two pulses.
When the program starts it first finds the first pulse in the file, and set that sample as time 0.0 and distance 0.0. Then it counts the samples, samples from previous pulse, and pulses. When a new pulse is detected a new data point is stored with the current time, distance and speed. By comparing current time and speed with the time and speed at the previous pulse acceleration is also calculated.
The data point is compared to the two lists of 'interesting' data points so see if a new distance or speed is reached.
Both data file with all pulses and a file with 'interesting' data points is stored to disk.
This is a example if a data file with all pulses:
http://www.joby.se/wavtrack/f2004-09...04-09-01_1.dat
This is the same data imported and graphed in excel:
http://www.joby.se/wavtrack/f2004-09...04-09-01_1.xls
This is the 'interesting ' data points:
http://www.joby.se/wavtrack/f2004-09...04-09-01_1.txt
This data was recorded on a friends IROC where we built a 'new' VSS sensor of from wheel to eliminate wheelspin problems with the data.
We used ten small magnets and a hall effect switch.
http://jobyteknik.homeip.net/fredrik...20_Hjulsensor/
We got about 4 times better resolution than the Corvette VSS signal.
There's not enough pulses/sec in the VSS signal to provide the resolution that we would like. It's pretty rough as you guys found.
I multiplied eash pulse by 8 in the PIC ISR (Interupt Service Routine) to get better 'psuedo' resolution.
ECM datastream offers much greater possibilities but with this device there's no need for a laptop in the vehicle.
My plan is to package and install it permanently in the vehicle.
I may use the datastream later as input for additional functions.
The fuel calculations are , I believe, made in the CCM which I don't have on my truck. So thought I'd add those calcs. later. Will probably use a comparator to run a low fuel warning system directly off the fuel gauge.
All this stuff can be bought but I've got more time than money and do a lot of this stuff just because I can.
Very similar to your projects, Joby. You carry out some very interesting projects.
There's not enough pulses/sec in the VSS signal to provide the resolution that we would like. It's pretty rough as you guys found.
I multiplied eash pulse by 8 in the PIC ISR (Interupt Service Routine) to get better 'psuedo' resolution.
ECM datastream offers much greater possibilities but with this device there's no need for a laptop in the vehicle.
My plan is to package and install it permanently in the vehicle.
I may use the datastream later as input for additional functions.
The fuel calculations are , I believe, made in the CCM which I don't have on my truck. So thought I'd add those calcs. later. Will probably use a comparator to run a low fuel warning system directly off the fuel gauge.
All this stuff can be bought but I've got more time than money and do a lot of this stuff just because I can.
Very similar to your projects, Joby. You carry out some very interesting projects.
Once the car is rolling the resolution is good enough. In my program I used a rolling average to smooth the data along the time axis. It is not difficult to calculate any distance between the pulses by interpolation. On the Corvette the pulse distance was a bit over a foot. On Fredriks Camaro it was about 4 inches.
The only real problem is to measure the start and there are two resons. The first is wheelspin because that will give you a false distance. We elimited that problem by using the front wheel on the Camaro. The second problem is that you don't know the time and distance from the actual starting point to where the first pulse is detected. It is like not knowing if you do a deep or shallow stage at the track. This is where you really benefit from higher pulse relolution.
On the 1984-1989 Corvete the MPG data is calculated by the dash computer from data provided from the ECM om the ALDL data line. The data that the ECM sends out are injector size, a distance counter, an injector time counter, and a few more data. Both counters count from 0 to 255 then it rolls over to 0 again.
Example where both speed and fuel comsumption is constant.
Between each sample the distanse has increased by 59 units and the fuel used has increased by 49 units.
Distance Fuel
130 38
189 87
248 136
51 185
110 234
169 27
228 76
The resolution is much better on the VSS signal than the data from the ECM.
Last edited by JoBy; Jan 15, 2006 at 06:44 AM.














