View Single Post
Old 08-12-2020, 02:47 PM   #42
Second Series
Registered User
 
Second Series's Avatar
 
Join Date: May 2015
Location: Tukwila Washington
Posts: 373
Re: Mechanical speedometer drive solution

The arduino code for an exponent is: pow(base, exponent) so pow(Hz, -0.575). Three lines added to my code. It’s been awhile since I looked at my code. This curve will not be used under 25mph(14Hz). The results are way off due to the funky mechanical connection. The speedometer housing has a 5/8” threaded part. I have a ¾” hole punch that I used for the aluminum plate. I used a rubber gasket from a garden hose between the plate and speedometer. This left a gap between the threaded part and the hole in the mounting plate. If the motor is not perfectly centered, the shaft binds. I now have shimmed this gap with a strip of rubber adhesive, the motor spins freely and all my numbers are different. I took a new sample of numbers for PWM at every 5mph starting at 25mph. Calculated the multiplier by dividing this PWM by Hz. Made a new graph based on this updated data, and got a new equation of 10.45(Hz^-0.285). I put this in the code and it works. The needle is still off, but I’m getting closer to a working model. This spreadsheet shows the data for 25mph to 90mph. The Hz column represents the 2000ppm signal from the DRAC. PWM is the signal from the Arduino used to spin the motor. PWM is determined by the input frequency multiplied by a variable. The variable should be equal to PWM/Hz. but since Hz is the input signal and PWM is the output signal, I need another way to find the variable. Graph the values of PWM/Hz. and generate an equation. I put this equation on the spreadsheet, and the results are off from the PWM/Hz. I ran the motor, and recorded the speedometer readings at 5Hz. intervals starting at 15Hz. I then took the recorded MPH, and subtracted the Goal MPH to get the difference of how far off the display is. I made a graph of this set of numbers, and generated an equation. I’ll use this equation to smooth the other equation. This is convoluted, that’s why I’m writing in great detail. I think the first equation should be enough, but I’m not taking every data point, so it's off. If I try to use a greater dataset, the calculations should be more precise. Easier said than done. Look at 66 datapoints from 25mph to 90mph. The 2000ppm signal at 25mph is 13.89Hz. 26mph is 14.44Hz. 27mph is 15.00Hz. The Arduino is capable of handling floating point variables, but it doesn’t do so well. I might be able to multiply the 2000ppm signal by 100, run it through the code, and then divide the output by 100 to get the PWM values. I’ll look into that, but for now I’ll get this smoothing code working. I added this equation and add the results to the output, now the needle tracks as it should. I now have a working model. I’ll continue to make improvements, but it should work as is o.k. The bracket needs improvement. I need to order some electrical components to connect to the vehicle. I could look at the PID code. I’m not satisfied with the slower speeds, I might try a stronger motor. I’ll have to add an optical disk for that.
Attached Images
  
__________________
'47 Panel to '88 K2500 Frame Swap
Mechanical Speedometer Drive Solution
1947.2 1 ton Chevy Panel
1955.2 Chevy 6700 Bus/RV
1990 Chevy K1500
Second Series is offline   Reply With Quote