The 1947 - Present Chevrolet & GMC Truck Message Board Network







Register or Log In To remove these advertisements.

Go Back   The 1947 - Present Chevrolet & GMC Truck Message Board Network > General Truck Forums > Engine & Drivetrain > LSx Swaps

Web 67-72chevytrucks.com


Reply
 
Thread Tools Display Modes
Old 02-08-2020, 12:34 PM   #26
Jason Banks
Senior Member
 
Jason Banks's Avatar
 
Join Date: Dec 1999
Location: TX
Posts: 832
Re: Mechanical speedometer drive solution

I don't have them here right now, but I bought that 40tooth reluctor wheel and VSS from a 4L60 to make a test setup so I could see what the actual signal looked like and to use for testing. I don't have an operational vehicle with the right output right now.
Jason Banks is offline   Reply With Quote
Old 02-10-2020, 09:24 PM   #27
Second Series
Registered User
 
Second Series's Avatar
 
Join Date: May 2015
Location: Tukwila Washington
Posts: 190
Re: Mechanical speedometer drive solution

Jason, Thanks for sharing! It looks like you have a solid mechanical setup. I like the drive belt youíre using. I looked up the part number for the encoder you referenced, there were some documents about encoders, so I downloaded them. Iíve got some reading to do!

Iím using a bench power supply for the 12 volts. I had to set the current limit to 10 Amps to keep the 12v from dropping. The motor from the cordless driver is similar to the Mabuchi motor, they draw some current and have plenty of torque, more than enough. It may be better to under utilize a bigger motor(may run cooler, run more stable) than a smaller, but Iíll test the smaller ones that I have also.

My first attempt to run the motor fried a 6144 transistor with a TO-220 case, rated 10A, so I used another 6144 to drive a 7926 in a TO-3(metal can) case, rated 15A. These were just random components that I had on hand. I may choose an off the shelf alternative for a final build.

Today I spent some time modifying my code to use a switch case format. I added flags for reverse and stationary. Now the PWM for the motor is off until the 0 to 60Hz signal (from the 2000ppm) goes above 1Hz. and the PWM turns off when that signal goes below 1Hz. Speedometer wonít run when driving in Reverse. Some bugs at the upper end need to be worked out, the code for maximum speed is broken now. I donít have much experience with Floating-Point variables, but thatís what Iím using since the math to convert frequency to drive signal uses decimal places. I may be able to get away with less resolution if itís too much trouble.

After I fix the max speed issue, Iíll look at the optical disk motor that Dayj1 sent. The signal from the optical disk may be able to be used to throttle the motor supply, allowing control over the slow speed, and get it to run slower. I donít have any experience with that, but after all that is what the optical disc is for.
__________________
'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
Old 03-13-2020, 04:31 PM   #28
Second Series
Registered User
 
Second Series's Avatar
 
Join Date: May 2015
Location: Tukwila Washington
Posts: 190
Re: Mechanical speedometer drive solution

I keep meaning to post an update and have put it off three times now, so here is the progress:
I was able to get a consistent speed with the simple code for frequency input. The code for reading the optical disk is the same as the code for detecting input frequency, but I was having delay issues. I couldnít find any examples of code with both frequency input and an optical disk. I read that using Interrupts is the way to go for reading an encoder, so I implemented the code, sharing timer resources. The results were way off, then I remembered reading something about Floating-point variables taking too much time. I set the variables as Integers, and now the motor speed is controlled by the input frequency, and the optical disk produces a clean output frequency.
The next step is to scale the output frequency from the optical disk to the input drive frequency. This action will turn the dc motor into a Servo motor. The input frequency will determine the speed of the motor, the encoder frequency will be used to keep the speed consistent. This should translate to meaning the speedometer needle will not flutter or bounce.
I have yet to connect the speedometer to any motor as this programming is getting deep. The speedometer will be a light load that will not change, so the motor speed shouldnít be affected by the load. The motor speed might change after the motor gets hot, that is yet to be determined. The optical disk will help maintain a steady speed. Iím interested in using it to control the low end speed. I have read that speeds below 10mph can be problematic with the off-the-shelf products available. The motor needs to have a wide enough range for 0 to 90mph or higher, and be able to run slow. Using gears reduces the slow speed, but it also lowers the top speed.
The Arduino PWM is at a set frequency. The motor needs a minimum supply to start turning, that works out to be around 5mph. Iíll try to write some code that gets the motor spinning, but keeps it moving at a slower rpm. Basically, Iíll use the minimum PWM signal to get the motor spinning, and toggle the PWM off and on. If that doesnít work, Iíll get into PFM(Pulse Frequency Modulation). That will require manipulating the registers of the microproccessor on the Arduino to change the clock speed. Reclocking through machine language. This will also alter the clock signal that is used to read the input frequency, and optical disk, so that will have to be compensated. Murky territory that I would prefer to avoid.

I have been struggling with the code, but making some progress. The timing for the Optical read <+.3%error with using Interrupts. The timing for the input frequency was greater than up to 20% with using interrupts, may be due to to frequency range of 1Hz to 60Hz. Polling the pin state yields <+.1%error for the timing of the input frequency, so I wonít use interrupts to read the input frequency.
The Optical disk has 64 holes, so the ratio between optical disk frequency and the input frequency works out to something like 50:1. I wasnít seeing much servo action, the motor drive frequency is updated every second with the code, and the optical disk frequency is also updated every second. Iím using the arduino Serial Monitor on my pc to troubleshoot the code. The input frequency matches what the fuction generator is set at, 10Hz. The optical disk is fluctuating 414Hz. to 440Hz. That indicates the motor speed is fluctuating. I took about 10 samples at each input setting from 7Hz to 63Hz. I put all the data into a spreadsheet. Divide the optical disk frequency by 64 and get RPM of the motor. Then divide the input frequency by RPM to get the multiplier. There are 315 samples with a multiplier from 1.09 to 2.94, so Add all the multipliers and divide by 315 to get 1.39. Now I start the motor, and then divide the input frequency by 1.39 and multiply that by 64. This gives me the target frequency. Compare this target frequency to the optical disk frequency, and the drive signal adjusts up or down. I take more samples at each frequency, but the optical disk frequency is still fluctuating, maybe less than before, and the motor can start at a slightly slower speed. So some progress.
I thought a hydraulic motor might be a better solution. Run a couple lines from the power steering up under the dash, control the amount of pressure spinning the drive. The slow speeds wouldnít be a problem. Not finding any small hydraulic motors available, or economical. I did find some miniature RC excavators, that looks like an expensive hobby. I also found mention of PID controllers(Proportional/Integral/Derivative). So it looks like I am already building a PID controller, just didnít know it. Iíll keep hacking away on this.
Today, I decided to work on the slow speed. I turned off the PID part of the code. Using the optical count, a delay can be introduced at regular intervals. I tried a bunch of different combinations. With a delay of 30 microseconds every hole, the motor rotates at .308Hz, or 1.1mph. In effect it is a stepper motor. Now Iíll have to develop this slow speed code and incorporate it into the PID.
__________________
'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
Old 03-14-2020, 09:12 PM   #29
aknovaman
Registered User
 
Join Date: Aug 2013
Location: Tecumseh
Posts: 339
Re: Mechanical speedometer drive solution

Its not really that hard to do.

https://retromini.weebly.com/blog/arduino-speedometer

I am working on a prototype that uses a $4 gps module.
Put the servo motor behind and dash speedo faceplate and stick your needle on it. Adjust the code for your gears and tire size
__________________
Project GEZR WGN Volvo
FMCDH
GBU and GBA

http://www.youtube.com/user/aknovaman/videos
aknovaman is offline   Reply With Quote
Old 03-19-2020, 04:05 PM   #30
Second Series
Registered User
 
Second Series's Avatar
 
Join Date: May 2015
Location: Tukwila Washington
Posts: 190
Re: Mechanical speedometer drive solution

ANKNOVAMAN, Thanks for the link! Another link from that post: http://andydoz.blogspot.co.uk/2017/1...ronic-gps.html
Itís nice to see a working example of some code, the similarities show me Iím getting part of it right.
I have considered going this route, but I wanted to retain the mechanical odometer. My í88 GMC does have a motor for the odometer, so it could be done. I read through this epic thread started by ls1nova71: http://67-72chevytrucks.com/vboard/s...d.php?t=512751 before I decided to start This thread.
At first I thought about having a motor in a box connected to the speedometer cable. Thanks to Dayj1 for the motor, and Jason Banks for the mounting example now Iím getting the idea that the motor can be attached directly to the speedometer without gear reduction, or a cable.
__________________
'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
Old 03-19-2020, 04:12 PM   #31
aknovaman
Registered User
 
Join Date: Aug 2013
Location: Tecumseh
Posts: 339
Re: Mechanical speedometer drive solution

I have a functional stepper that responds to the analog input to the Arduino so I know my connections and code are good. Last night, I connected the stepper and GPS module, loaded the retro-mini code; looks good so far. I plan to test it outdoors this weekend.
__________________
Project GEZR WGN Volvo
FMCDH
GBU and GBA

http://www.youtube.com/user/aknovaman/videos
aknovaman is offline   Reply With Quote
Old 03-26-2020, 05:59 PM   #32
Second Series
Registered User
 
Second Series's Avatar
 
Join Date: May 2015
Location: Tukwila Washington
Posts: 190
Re: Mechanical speedometer drive solution

I rearranged the code and now it is working well. The motor does not run without input. Starts slow with the optical disk delay, and then seemlessly transitions to the PID code at around 5MPH, and then maxes out at full input.
I attached the motor to a speedometer. I anticipated less load, unfortunately the slow speeds canít overcome the resistance of the speedometer. It starts to spin at about 10MPH, but works above that.
I may be able to increase the power in the optical disk delay code, and also increase the range for that portion of the code, so it switches to PID after 10MPH instead of 5MPH. If that doesnít work, I will put an optical disk on the motor from the cordless drill and tune the code 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
Old 06-11-2020, 04:15 PM   #33
Second Series
Registered User
 
Second Series's Avatar
 
Join Date: May 2015
Location: Tukwila Washington
Posts: 190
Re: Mechanical speedometer drive solution

Iím still working on the code. The code overall is not too complex, and Iím trying to keep it as simple as possible. I am able to drive the speedometer across the entire range from Zero to 90MPH. I use the motor as a stepper below 25MPH. At 25MPH and above the motor should run with the PID control.
In an attempt to keep the code simple, I am using the MAP command to set the range of Input frequency vs. Microsecond delay(between holes in the optical disk) for the stepper motor code. The line looks like this: val2 = map(val2, 1, 14, 25, 1);// Input Range(Hz) - Output Range(uS)
Where val2 is the delay time, with an input from the 2000 pulse per mile signal of 1Hz, the delay is 25uS between 3 holes in the 64 hole optical disk. With an input of 14Hz, the delay is 1uS. The input range is scaled to the output range, and since the two ranges are not equal, or an even fraction, the output is granular. That is to say there are 14 steps from 1MPH to 25MPH. The limiting factor here is the MAP command as it does not handle floating point integers. If I want finer detail, I could code an array, or something, Iím not sure, but it would be more complex. As it is, the slow speed is working well, and I still need to dial it in.
The speed above 25MPH. Iím thinking about using the MAP command here also. The PWM is a range from 1 to 255. My simple code uses the equation (freqency x 5.1) to get the PWM signal. I found that with the speedometer connected to the motor, the maximum PWM of 255 drives the speedo at 90MPH. The 2000 pulse per mile signal will be 50Hz at 90MPH, so 255/50 = 5.1. Unfortunately when I plug a lower frequency into this equation, say 15Hz x 5.1 = 76.5 for the PWM signal. The motor wonít turn at that PWM signal, it will turn at 20MPH with 120 PWM. So the motor has more torque at higher speeds, DUH! I need a multiplier of about 9 with the input of 15Hz, so the MAP code would be something like this: val3 = map(val3, 15, 50, 9, 5);// Input Range(Hz) - Output Range(multiplier). So for the input frequency range of 15Hz to 50Hz, the variable(val3) would be 9 to 5. That variable could be used in the equation to determine what the PWM signal should be. There is another equation that determines what the optical disk frequency should be, and is used to adjust the PWM signal, that is the PID control. That needs to be fine tuned as well.


Well, the MAP command doesnít work well here. Iíll focus on getting the PID code solid.
It turns out that I know nothing about PID programming. I did find some useful information about it, I could make a career of learning how to implement it. I struggled with the code that I do have for awhile, and found a simple solution based on a PID concept. PID samples the system parameters, put that data in a buffer for a set period of time, samples again and compares the stored data to the current data. I figured out how to write the code to achieve this, and based on the difference between the previous input signal and the current input signal, I change the multiplier by a set amount. That line of code is: change = (diff * .09). Then I determine if the input frequency has increased, or decreased, and add, or subtract ďchangeĒ from the multiplier val3. Again, the output PWM is determined by multiplying the input frequency by val3. With this bit of code, I get a multiplier at val3 = 9 when the input frequency is 15Hz, and val3 = 5 @ 50Hz. Now I have the desired output of 25MPH with an input of 15Hz, and 90MPH with input of 50Hz. Unfortunately the multiplier is linear, so the intermediate readings are off. I need to put a curve on the multiplier. I know what the results should be, so I can create a graph. From the graph Iíll have to come up with an equation and put that in the code. I remember a math class that had me creating graphs from equations, so I know itís possible to draw a curved line and determine an equation equal to the curved line. Itís been a decade or twoÖ After I get this working, Iíll get on with figuring out PID programming. Ultimately Iíll need to have the feedback as I am seeing problems with my setup. I found that the motor can get bogged down if it is not lined up exactly with the speedometer. My linkage is not precision, and the bracket is flimsy, if I bump it the motor shifts slightly, and the code is thrown off. When it is aligned well, the speedometer spins freely. Iíll need to come up with a robust bracket to overcome that. Using PID would also adjust for mechanical variations.
__________________
'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
Old 06-11-2020, 05:26 PM   #34
kglowacky
Registered User
 
Join Date: Mar 2020
Location: The Woodlands,Tx
Posts: 226
Re: Mechanical speedometer drive solution

I went with having the tail shafted machined to install a old school mechanical worm gear. This is the second time I have done this on a 460E works great. It takes also installing a tail shaft gear next to the current one already there. kinda on the expensive side.
kglowacky is offline   Reply With Quote
Old 06-12-2020, 08:17 AM   #35
TrybalRage
Active Member
 
Join Date: Jun 2014
Location: Reading, PA
Posts: 153
Re: Mechanical speedometer drive solution

I think this is awesome. I mentioned a similar idea on the LS swapped squarebody facebook page. All the available solutions (Dakota, CableX) seem way, way too expensive for what they do... read a signal and spin an electric motor.

I proposed a Raspberry Pi setup, but same concept.
__________________
1985 C10 Silverado LWB
LS Swap in Progress
TrybalRage is offline   Reply With Quote
Old 06-12-2020, 05:49 PM   #36
Second Series
Registered User
 
Second Series's Avatar
 
Join Date: May 2015
Location: Tukwila Washington
Posts: 190
Re: Mechanical speedometer drive solution

I considered modifying the transmission output to run a mechanical cable. The original discussion about this that I found on another forum was actually started by someone who does modify transmission tail housings. That thread was taken over by a discussion on making a motor drive for a speedometer. There was no final answer to the speedometer drive on that discussion, it went on for a couple years and just fizzled out. I have something that kind of works, and I’ll keep improving it until it is a finished product. It would be easier to just buy an off the shelf solution, $300 is not bad for a working original speedometer considering all the time I have put in so far.
There are some detailed write-ups online about converting from mechanical to electric, so easy enough to do it in reverse. I’m working with the drivetrain from an ’88 K2500, so NP241 transfer case. I can get a rear housing from an ’88 to ’89 for mechanical speedo for $200? Drive gear $80, and driven gear $12. An in-line speed sensor can be placed on the speedometer cable to generate the 2000 pulse per mile for $100. I still need a DRAC since my DRAC is integrated with the gauge cluster in the ’88 GMC, so another $40? If I did this, I might be inclined to eliminate the slip yoke on the NP241, so $500 for that kit.
Klowacky, I read about thar mod on-line in a very detailed description. That looks like a clean solution.
TrybalRage, Thanks for the encouragement. I’m interested in that project, I’ll try to find it. I looked into RaspberryPi vs. Arduino, and found the RasperryPi is an entire computer, operating system and all. Arduino is just a microproccessor. They are both the same size. As this project evolves, I will do away with the arduino, and just use the IC with the code on a custom made pcb.
__________________
'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
Old 06-14-2020, 11:05 PM   #37
Factory Guy
Senior Member
 
Factory Guy's Avatar
 
Join Date: Jun 2019
Location: Overland Park, Kansas
Posts: 213
Re: Mechanical speedometer drive solution

Just stumbled across this thread you might want to go get a 95-97 S10 Speedo and convert it like LS1nova did.

http://67-72chevytrucks.com/vboard/s...d.php?t=512751
Factory Guy is offline   Reply With Quote
Old 06-21-2020, 05:52 PM   #38
TrybalRage
Active Member
 
Join Date: Jun 2014
Location: Reading, PA
Posts: 153
Re: Mechanical speedometer drive solution

Not exactly related to what you’re doing, but I was at the local pick n pull yesterday and on a whim grabbed a cluster from a 98 Silverado that looked similar in layout to what the thread by ls1nova, where he uses an s10 speedo retrofit to his gauges.

I disassembled it, just to get some ideas, and after looking things over I don’t think I’ll be able to use it due to the configuration of the board vs odometer, but really got me thinking more about solutions. I know you’re trying to drive a “cable” but how in the world does no one manufacture a little board to run one of these stepper motors like the stock layout? The whole doodad could be assembled for like $35. Especially since it seems like the 4K signal is pretty standard for gm.

I saw the video and other threads of folks using an arduino for that, but now one ever shows it working in a vehicle.
__________________
1985 C10 Silverado LWB
LS Swap in Progress
TrybalRage is offline   Reply With Quote
Old 07-24-2020, 12:41 PM   #39
Second Series
Registered User
 
Second Series's Avatar
 
Join Date: May 2015
Location: Tukwila Washington
Posts: 190
Re: Mechanical speedometer drive solution

Progress has been slow during the shutdown. I did find an epic description about PID on Arduino. http://brettbeauregard.com/blog/2011...-introduction/
Iím not sure what to do with all this information, itís a bit deep. I also found this site with a working example of a ballancing robot. https://www.robotshop.com/community/...tor-controller
I modified this code, removed the LCD part, and lined out the quadrature encoder parts. Iím not sure if it will work without the quadrature encoder, I know thatís for detecting direction, it can also be used for timing. I loaded my modified version of this code onto my test setup. It spins the speedometer, but not smooth. I need to understand whatís happening inorder to manipulate the code to do what I want. I also need to work on the equation for the torque line of the motor. Once I get a grasp on this PID code, Iíll incorporate it with my working code.
__________________
'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
Old 08-06-2020, 01:17 PM   #40
Second Series
Registered User
 
Second Series's Avatar
 
Join Date: May 2015
Location: Tukwila Washington
Posts: 190
Re: Mechanical speedometer drive solution

Iím working on the torque curve of the motor. From what I previously found PWM/Hz=Multiplier. If I graph out Multiplier vs. MPH where Multiplier is y, and MPH is x, I get a curve. (I could use PWM, or HZ for x as well). I vaguely remember drawing curves from equations when I went to school. Here I will determine an equation by looking at a curve. From what I have found so far is that there are different kinds of equations for different kinds of curves. I have to know about all these equations, pick one that is close, and SWAG the answer(Scientific Wild-Ass Guess). I found an equation in a book:
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
Old 08-06-2020, 01:19 PM   #41
Second Series
Registered User
 
Second Series's Avatar
 
Join Date: May 2015
Location: Tukwila Washington
Posts: 190
Re: Mechanical speedometer drive solution

y=b^2 looks like it might fit. Although my curve goes high to low, and it does not cross the y axis. Now Iím looking at examples of how to find the equation of a curve and I keep seeing setting x to zero, or setting y to zero. My curve has no x or y intercepts. I just learned that finding an equation from a curve is called regression. So I need to find a regression model that matches this curve. Iím looking at Graphing Exponential Function on a math website. Ah, this curve displays exponential decay, so the equation might be y=b^-2. I have drawn the curve on paper, and in excel. In excel, Select the PWM/Hz column, open the insert tab, select Charts, I used Clustered column. Open chart design tab, Add chart element button, Trendline, More Trendline Options to open the Format Trendline panel. In the Format Trendline panel select the Axis Options button(looks like a bar graph), and select Power, check the box for Display equation on chart. The data from my motor, and my speedometer gives me the equation: y=45.992(x^-0.531).

I set up another spreadsheet with Hz., PWM, and PWM/Hz. and see how close this equation is to PWM/Hz.. Not as close as I like. I can change the values of the two numbers in the equation to get closer to what I need. The last column is the result from the equation minus PWM/Hz. to see the difference. Not exact, but hopefully not too far off. So now Iíll try to implement this equation in my code. 41.98*(Hz^-0.575) where Hz is the 2000ppm signal. Read the 2000ppm signal, run it through this equation, multiply the 2000ppm frequency by the result of this equation to get the PWM signal to drive the motor. Notice this dataset has 17 points, the end result will be 90 points (0 to 90mph). I need a non-linear variable multiplier to handle the variations of the motor torque at different speeds. I hope this equation works.
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
Old 08-12-2020, 02:47 PM   #42
Second Series
Registered User
 
Second Series's Avatar
 
Join Date: May 2015
Location: Tukwila Washington
Posts: 190
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
Old 09-10-2020, 01:55 PM   #43
Second Series
Registered User
 
Second Series's Avatar
 
Join Date: May 2015
Location: Tukwila Washington
Posts: 190
Re: Mechanical speedometer drive solution

I am still working on this. Since the connection between motor and speedometer is so critical, I now have a drill bit, and Tap to make a plate the speedometer can thread onto. Currently in the process of restoring the speedometer, it seems the odometer is the major load. When the speedometer ready and bolted to the motor, Iíll calculate the torque curve, and smoothing curve. I added a 5v regulator to the Arduino for the 12v 2000ppm signal. It works on the bench with the signal generator output set to 12v, so it should work connected to my truck. My plan is to tap into the 2000ppm wire that goes to the ECM. I hope it doesnít effect the ECM, or blow anything up! If that works, Iíll be able to see the mechanical speedometer, and the stock speedometer working simultaneously. That will be time for a videoÖ My truck has the DRAC integral to the cluster, so I need an external DRAC. Iíve been to a few wrecking yards, but havenít found a DRAC yet. Iím looking at building a DRAC. At the very least a schmitt trigger would be needed to hook up to VSS, and modify the code for that signal. Id like to get ahold of a DRAC so I can reverse engineer, but for now Iím building one from scratch. I found some pictures that show the Ics, but Iím not locating those chips. I did find the AD7845, the middle one in the picture. It is a 12-bit multiplying DAC, digital to analog converter. Iím not sure how it is implemented in the DRAC, I could use a picture of the back side of the DRAC to see where the traces go. The DRAC will have one IC to convert the VSS signal to a nice square wave, the shmitt trigger, one IC to convert that VSS signal to the 128,000ppm, and an IC for the 4kppm, and 2kppm, divide by 32, and divide by 2. Maybe that can be handled by one IC, a divide by N. I have been looking at posts about calibrating the DRAC, and trying to understand how it all connects. There is a formula to determine the Divide Ratio, and a chart that shows a binary number for the pins on the DRAC. The AD7845 does have a dozen pins that can be set hi, or low. Itís still a mystery to me. This is a break down of the VSS to 128k signal.
Pi x tire diameter, 3.1416x29.88= 93.87Ē circumference of my tire.
63,360 inches per mile.
Formula
63360/circumference x axle ratio x 40 /128000
This gives what they refer to as the divide ratio.

Tire revolutions per mile: mile/tire circumference
63360/93.87=674.97603068072866730584851390221
Driveshaft revolutions per mile: Tire rpm x diff ratio
674.97603068072866730584851390221 x 3.73 = 2,517.6605944391179290508149568552
VSS(reluctor) pulses per mile: Driveshaft rpm x reluctor teeth
2,517.6605944391179290508149568552 x 40 = 100,706.42377756471716203259827421
Divide ratio: VSS ppm / DRAC ppm target
100,706.42377756471716203259827421 / 128000 = 0.78676893576222435282837967401726
DRAC ppm: VSS ppm / Divide ratio
100,706.42377756471716203259827421 / 0.78676893576222435282837967401726 = 128,000
That is a lot of decimal places, letís see how two decimal places looks:
100,706.42/0.78= 129,110.79 thatís about 1%off, donít know how acurrate it needs to be, but this could be done in the code on the Arduino. Look at a couple different examples:
100,706.4237/0.7867=128,011.21
100,706/0.7867=128,010.67
100,706.423777/0.786768=128,000.15 six decimal places are needed to get the 128k signal. That might require some coding acrobatics on the Arduino, probably best handled with hardware.
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
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:37 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1997-2020 67-72chevytrucks.com