Register or Log In To remove these advertisements. |
|
|
|
Thread Tools | Display Modes |
02-08-2020, 12:34 PM | #26 |
Senior Member
Join Date: Dec 1999
Location: TX
Posts: 1,612
|
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.
|
02-10-2020, 09:24 PM | #27 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
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 |
03-13-2020, 04:31 PM | #28 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
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 |
03-14-2020, 09:12 PM | #29 |
Registered User
Join Date: Aug 2013
Location: Tecumseh
Posts: 355
|
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
__________________
Current project 1959 Willys = GEZR TRUK Geezer is a Latin compound word made up of two roots. Gee meaning Urine Stain and Zer meaning your pants are open! FMCDH GBU and GBA http://www.youtube.com/user/aknovaman/videos |
03-19-2020, 04:05 PM | #30 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
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 |
03-19-2020, 04:12 PM | #31 |
Registered User
Join Date: Aug 2013
Location: Tecumseh
Posts: 355
|
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.
__________________
Current project 1959 Willys = GEZR TRUK Geezer is a Latin compound word made up of two roots. Gee meaning Urine Stain and Zer meaning your pants are open! FMCDH GBU and GBA http://www.youtube.com/user/aknovaman/videos |
03-26-2020, 05:59 PM | #32 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
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.
__________________
'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 |
06-11-2020, 04:15 PM | #33 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
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 |
06-11-2020, 05:26 PM | #34 |
Registered User
Join Date: Mar 2020
Location: The Woodlands,Tx
Posts: 585
|
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.
|
06-12-2020, 08:17 AM | #35 |
Registered User
Join Date: Jun 2014
Location: Reading, PA
Posts: 203
|
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. |
06-12-2020, 05:49 PM | #36 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
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 |
06-14-2020, 11:05 PM | #37 |
Registered User
Join Date: Jun 2019
Location: Midway USA Kentucky
Posts: 565
|
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 |
06-21-2020, 05:52 PM | #38 |
Registered User
Join Date: Jun 2014
Location: Reading, PA
Posts: 203
|
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. |
07-24-2020, 12:41 PM | #39 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
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 |
08-06-2020, 01:17 PM | #40 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
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:
__________________
'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 |
08-06-2020, 01:19 PM | #41 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
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.
__________________
'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 |
08-12-2020, 02:47 PM | #42 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
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.
__________________
'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 |
09-10-2020, 01:55 PM | #43 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
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.
__________________
'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 |
11-16-2020, 05:18 PM | #44 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
Re: Mechanical speedometer drive solution
I messed around with trying to reverse engineer the DRAC for many hours. I have some components to play with, but many more hours will be required for that project.
I rebuilt an old speedometer that I had. It might be a 1948. I don’t know what I did with the original ’47 speedometer that came with my panel truck, it was missing the needle. I had been using a newer speedometer from what I don’t know. The newer one had ’63 written in pencil on the inside. I got a refacing kit for the ’48 speedo and lubed everything. After that I noticed the high beam indicator lens was busted, so I found a refresh kit. I reassembled and then discovered the spindle had become independent from the speedcup. I glued that, but don’t know the correct orientation. The speedcup was binding so removed the glue and shimmed the speedcup and reglued, still not knowing the correct orientation.The speedcup still was binding, I loosened the screws for the speedcup assembly, and the needle bracket and was able to shift it enough to get free movement of the speedcup, and then tighten the screws. The orientation of the spindle to speedcup was off, the needle didn’t bottom out at zero. I tried to rotate the speedcup past the stop, but then the speedometer wouldn’t overcome the spring tension. While trying different things, the stop broke off. I let the spring at rest, preloaded the spring about 20 degrees, and glued a wire as a stop. The needle had a visible fracture, but was o.k. It broke during final assembly. I didn’t want to wait another week for a new needle, so I glued it. Now the speedometer that I plan on using is working smooth and quiet. I had made a new bracket for the motor, so now I can finally try it. The motor connection has to be precise so it doesn’t bind or change. That could throw off the code and change operation of the needle. The new bracket threads onto the speedometer. Like the first bracket it uses standoffs to mate to the motor. I’m using a drill press, and it just is not precise. I had been wanting to use grommets somehow for both as sound damper from the motor, and to add some wiggle room to prevent binding. This is not ideal, but I located some small grommets and overdrilled the motor bracket holes. Untimately it would be good to have the bracket assembly machined to spec, but at this point this one off works. I struggled with getting a good curve equation for this speedometer. I wasn’t doing something right, or the speedometer was just too funky to work, or maybe both. I finally found that I could remove the outer data points to get the torque curve, and then use the full range for the smooting curve to compensate for that. So now this speedometer reads acurately between 20mph and 74mph. The top speed is 80, so I can fix the top end in the code. The low end will use the optical disk, so I’ll dial that in too. The motor starts to turm the speedometer at about 4mph though so I could probably get away with not using an optical disk. The freshly lubricated speedometer makes a huge difference.I was working on some code that compares the optical disk speed and the input frequency, so I’ll implement that too. Later on I’ll research PID, but for now it should be good. The arduino and motor control board, I’ll modify the motor control board so it powers the arduino and mount them both in a box. I’m currently powering the arduino via usb. I’m still planning on connecting this to my 1990 k2500 and comparing the stock speedometer with mechanical speedo side by side. But as of now I can state that you can slap a motor on the back of your mechanical speedometer and connect to a modern transmission.
__________________
'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 |
01-14-2021, 05:00 PM | #45 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
Re: Mechanical speedometer drive solution
I’m still working on this and making progress. I have been working on the code for my rebuilt funky speedometer, and it seems to be working well enough. I asked for advise on an electronics forum about connecting to an automobile. I noticed my truck produces about 14v for the 12v line. I had always checked voltage with the engine off, or with a test light, so this is new information for me although I am not surprised. I asked about using a voltage regulator because my code is based on running the motor on 12v. I was informed that a 12v regulator needs at least 14.4v to function properly, but an LDO regulator would work in this application. LDO=Low Drop Out. I located a 12v 3A LDO regulator, ordered a few and received them it in the mail. Next step is to wire it in and connect to my truck. This week I tried searching for more information about PID code for a speedometer and found this post:
http://ka7oei.blogspot.com/2019/01/e...eter-with.html I have read several articles about PID, but this one basically spells it out enough for me to understand. I tried to implement some code in my sketch yesterday, but it wasn’t happening. I thought about it, and today rearranged some things and it works. PID error = desired speed – actual speed integral = integral + (error * ITIME) derivative = (error – error_prior)/ITIME) output = Kp*error + Ki*integral + Kd*derivative + BIAS error_prior = error Desired speed is the motor speed determined by the 2000ppm frequency multiplied by the torque curve equation results. Actual speed is the optical disk speed determined by detecting disk pulses each second aka frq2. The value of frq2 is in Hz. There are 64 holes in the optical disk. diskRPS is determined by dividing frq2 by 64. Let’s convert the 2Kppm value to RPS. Call it motHz For motor RPS. Take the known 2Kppm values and the diskRPS and create a chart. Add a trendline to the chart to get an equation. Plug the 2Kppm values into the equation to get the motHz. motHz is close to diskRPM, but not exact. This dataset uses values for 22mph to 80mph. The 2kppm is a set range for all vehicles. The optical disk readings are the average of a range for each data point. I set the code to output the count from the optical disk and the readings fluctuated so I recorded an average. Take the motHz and the recorded PWM values to create a graph, insert trendline to get the equation. Plug motHz values into the equation to get the PWM. Use this equation in the code. y = (0.00004*(x^2)-(0.0022*x)+60.708) #define val20 (pow(output,2)) Drive = (0.00004*(val20)-(0.0022*output)+60.708) The PID code works well, really smooth, and it works on the low end. I still need to tune it and figure out what is happening, but so far I like what I see. I’ll strip most of my code out, basically start over again. I think it will be much more simple, and may not matter what voltage is supplying the motor.
__________________
'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 |
02-18-2021, 04:56 PM | #46 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
Re: Mechanical speedometer drive solution
One year ago I started this project! I’m really happy with the results. I figured out how to drive a motor to spin the speedometer through the full range using brute force in open-loop mode. The motor was unable to start below about 10mph. I found I could run the motor at full output and pause after each hole in the optical disk, reduce the pause and the motor spins faster. Use this pause code until 10mph, and then switch the code to freewheeling. This helped me understand how to deal with the torque curve of the motor and speedometer.
Now I’m using PID code to run in closed-loop mode. The speedometer starts under 1mph and runs through to max. I have been playing with the PID code. It takes some fiddling to get adjusted. Start out with Ki=0, Kd=0, and ITIME=0. Through trial and error: Set Kp so 45Hz input yields 80mph, Kp=1.35 for this example. Set BIAS so 5Hz yields 9mph, Then recheck what frequency drives 80mph and readjust Kp, Kp=1.1 BIAS=450. Set Ki, try different values starting with 0.05, readjust Kp. Kp=1, BIAS =450, Ki=0.005. Using the Ziegler-Nichols method to determine Kd, first figure Pu. Pu=(2Kp)/Ki, so (2*1)/0.005=400. Kd=(KpPu)/8, so (1*400)/8=50. Set ITIME, I use 50. Recheck the 5Hz at 9mph, and 45Hz at 80mph. Readjust accordingly and refigure Kd. Repeat this until you are satisfied with the results. I was updating the {error_prior = error} every second, and then moved it to update every iteration about 12mS. I’m not sure if there is much difference in performance. That is the only line of PID code in the main loop, the rest of the PID code is in the beginning before the setup as it just defines the parameters. Today I wired in the LM1085 LDO, it works. The LM1085 low dropout voltage regulator takes the 14v input and puts out 12v for the motor, and the Arduino. I’m ready to connect to my truck and see how it performs.
__________________
'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 |
02-25-2021, 01:58 PM | #47 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
Re: Mechanical speedometer drive solution
https://youtu.be/K6YOm1WTpqg
I connected the speedometer to my truck last weekend. I spent some time running around looking for wire connectors. I found a used splice connector and tried to use that. It didn’t work. The next day I stopped by a local electrical shop only to discover they had recently moved. When I got home I tried a spring clip on the signal wire, and that worked. I went for a test drive and it went well, the speedometer was reading low, so I calibrated it the next day. Yesterday I made this video. I’m happy with how well it works, and found a couple issues to address. The needle jumps when just starting out from zero, and the motor noise could be heard through the radio. I’m sure I can fix that.
__________________
'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 |
04-07-2021, 03:30 PM | #48 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
Re: Mechanical speedometer drive solution
As can be seen in the video, the needle movement has a slight delay. I thought about updating the input frequency more often. I found that it is impossible to read a 1Hz signal more than once every second. I chose to use the 2000ppm signal, the 128kppm signal would work better. Discussion here: https://forum.arduino.cc/?topic=731339#msg4921311 I’m sure I learned about that in school once…
I also wanted to eliminate the values on the right side of the decimal point to reduce fluctuation. That’s not good for the 2000ppm signal, but entirely possible with the 128kppm signal. For the 2000ppm signal, some values require the decimal places, example: 9mph at 5.00Hz, 10mph at5.56Hz, 11mph at 6.11Hz, 12mph at 6.67Hz, 13mph at 7.22Hz. Where the 128kppm signal values have a greater spread: 9mph at 320Hz, 10mph at 355.55Hz, 11mph at 391.11Hz, 12mph at 426.66Hz, 13mph at 462.22Hz. The Needle jump at start may be from the PID comparing the previous value to the current value. If the previous value is zero(not moving), the difference is greatest. I may be able to pre-load the previous value to trick the PID into behaving nicely at start-up. The noise coming through the stereo may be suppressed with a coil, or capacitor on the motor supply. I’ll rewrite the code to use the 128kppm signal, work on eliminating the start-up jump, and try a capacitor on the power line. After that, I can work on my youtube video skills and try to get a better view of both speedometers side by side.
__________________
'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 |
01-18-2022, 10:50 AM | #49 |
Registered User
Join Date: Jan 2022
Location: NE
Posts: 10
|
Re: Mechanical speedometer drive solution
Did you get this working well enough to post your code somewhere? I was attempting something similar, but had a lot of issues getting a motor to drive the speedo at a stable speed. I think the encoder motor I got just didn't have the power to move the odometer and would dip hard every 1 mile. That pushed me down the road of replacing the guts with a digital stepper motor to just control the needle position directly.
|
01-18-2022, 03:28 PM | #50 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 390
|
Re: Mechanical speedometer drive solution
Thanks for asking nsocwx, I have not posted any code yet but I’d be happy to it’s still evolving but it does work. I’m curious what encoder motor did you get, I was having a hard time finding any? This project has been on the back burner for awhile, but I’m still on it. I’ve re-written the code for the 128kppm signal, and in the process of making it work. With the 2kppm signal, the drive frequency was 1Hz to 60Hz. The 128kppm signal uses a range from 318Hz to 1750Hz. The folks at the Arduino forum thought the higher frequency would be more accurate. This is true but at a cost. From the Megashift website:” In addition to providing a clean square wave output of a few specific pulse/mile rates, a DRAC can also slow the signal frequency considerably, reducing the interrupt overhead in the code compared to handling the VSS signal directly.” I now know what this means after I changed the code to handle the higher frequency. The optical disk has 64 holes and the code is interrupted for each hole. This wasn’t a problem when the input frequency was below 60Hz. Now with the higher input frequency, there is contention between the optical counter and the input counter. With the lower frequency input, I was looking at how many times the signal transitioned in a second to determine the frequency. This was problematic below 1Hz(1mph) as 1Hz is one cycle per second. For the higher frequency I have changed the code to look at the duration between a high to low transition and a low to high transition to determine the frequency. At under 1mph, with the input at 34Hz, this time is about 42mS each, or about 84mS a cycle. If I use the same sample time of a second, that gives me about 11 cycles, or I may be able to use 5 cycles in half a second, or 2-3 cycles in 250mS. This also interrupts the code while determining transition time, and during this time the optical interrupts are overruled, or dropped. Both optical frequency, and input frequency are equally important, neither has priority over the other.
Now I am looking at a hardware solution to counting the frequency. I have an LM2907 frequency to voltage convertor set up to read the input frequency. It works well. Next I’ll set one up to read the optical disk.
__________________
'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 |
Bookmarks |
|
|