The 1947 - Present Chevrolet & GMC Truck Message Board Network

The 1947 - Present Chevrolet & GMC Truck Message Board Network (https://67-72chevytrucks.com/vboard/index.php)
-   LSx Swaps (https://67-72chevytrucks.com/vboard/forumdisplay.php?f=206)
-   -   Mechanical speedometer drive solution (https://67-72chevytrucks.com/vboard/showthread.php?t=800299)

Second Series 01-28-2020 04:32 PM

Mechanical speedometer drive solution
 
1 Attachment(s)
How do I keep the mechanical speedometer if I replace the old transmission with a modern unit with reluctor ring?
Use an electric motor to drive the speedometer.
I have been working on this for a couple months now. I found a 17 page discussion that spanned several years. Someone had a working prototype, but failed to share any relevent information, and then vanished.
Break down what needs to be done:
1. Identify a motor that will function at a slow speed and have a range of speed wide enough.
2. Analyze the signals in a vehicle.
3. Build a motor controller to drive the motor from the vehicle signal.
4. Assemble the parts including speedometer cable.
I’m using an ’88 GMC K2500 for a frame swap for a ’47 panel truck. I needed a truck for work around my house, so I got a ’90 K1500 basically the same setup as the GMC. I’m using the K1500 to look at signals, and eventually to test the ’47 speedometer. A fair amount of math is involved, and I try to double check the convoluted equations. Please let me know if something is off!

The reluctor ring creates 40 pulses per driveshaft revolution. The DRAC converts the 40 pulses to 128,000 pulses per mile for the RWAL Brakes, 4,000 pulses per mile for cruise control, and 2,000 pulses per mile for the ECM.
Use the 2,000 ppm for the speedometer motor control.
Look at the signal on that wire:

Second Series 01-28-2020 04:33 PM

Re: Mechanical speedometer drive solution
 
1 Attachment(s)
This is a screen shot of the oscilloscope, the truck is idling in 2nd gear at 10mph(on jackstands).
Channel 1 is the 2000ppm
Channel 3 is the 40 tooth Reluctor Ring that produces 40 pulses per driveshaft revolution.
Looking at the ch.1 2000ppm signal, one cycle is about 7 horizontal divisions. The time is set at 25ms.
The period of one cycle is 7 x 25ms= 175ms, Frequency = 1/period, so 1/175ms, or 1/.175 = 5.71Hz
This is close to the reading on another screenshot of 5.1Hz, so the math is correct.
60mph = 1 mile per minute, 10mph = 0.1666 miles per minute (10mph/60minutes = 0.1666) so 0.1666 x 60 = 10. And 1 mile in 6 minutes
2000ppm at 5.71Hz, or 5.71 cycles per second x 60 = 342.6 cycles per minute, or 342.6 pulses per minute 342.6 x 60 = 20,556 pulses per hour. At 10mph, 20,556/10= 2,055.6ppm. With some margin of error, close to 2000ppm. So for 10mph, the vehicle travels 1 mile in 6 minutes, and at (2000ppmile/6minutes) = 333.333ppminute. Thus at 10mph the vehicle travels for 1 minute a distance of 0.1666 miles with 333.333pulses. Let’s check this: 333.333ppminute/60seconds = 5.555cps, or 5.555Hz, that’s close to the measured 5.71Hz.
At 60mph the vehicle travels 1 mile in 1 minute and 2000ppmile. 2000ppm/60seconds = 33.333Hz
At 20mph take 60minutes/20mph = 3, the vehicle travels 1 mile in 3 minutes. At 2000ppm/3minutes = 666.666ppminute. 666.666ppminute/60seconds=11.111Hz So at 20mph, the vehicle travels .333 miles in 1 minute with a fequency of 11.11Hz on the 2000ppm signal.
With this math, a chart can be produced for the 2000ppm signal:

Second Series 01-28-2020 04:34 PM

Re: Mechanical speedometer drive solution
 
1 Attachment(s)
“GM old standard was always 1000cableRPM = 60MPH. Start dividing by 2 and get down to 2MPH needs about 33RPM.”
(1000RPM=60MPH)/30= (33.3RPM=2MPH)
1000 Revolutions per minute = 60MPH, and 60MPH = 1 Mile per Minute so
1000 Revolutions per minute = 1000 Revolutions per mile
How to get 2000 pulses per mile 12 volt square wave to drive the motor 1000RPM?
At 60MPH, 2000 ppmile = 2000 ppminute. So (60MPH=2000ppMin)/30 = (2MPH=66.6ppMin), and 66.6ppMin/60seconds = 1.11ppSecond, or 1.11Hz
1000cable revolutions per minute = 2000 pulses per mile at 60 miles per hour, so
1.11Hz = 33.3RPM at 2MPH.
I’ll need to take the 1.11Hz signal from the DRAC and convert that to drive my motor 33.3RPM at 2MPH.
We need an electric motor capable of starting around 15RPM that can increase to something above 1000RPM.
I set up a test jig and tried several motors:

Second Series 01-28-2020 04:35 PM

Re: Mechanical speedometer drive solution
 
1 Attachment(s)
The arduino supplies a variable drive signal that controls a darlington pair, the motor is connected to 12v and the darlington pair. The RPM sensor reads the reflective flag on the motor and sends a signal to the oscilloscope.

Makita Driver:
The driver can start and run slow:

Second Series 01-28-2020 04:35 PM

Re: Mechanical speedometer drive solution
 
1 Attachment(s)
.5145*60= 30.87rpm
Makita fast:

Second Series 01-28-2020 04:36 PM

Re: Mechanical speedometer drive solution
 
1 Attachment(s)
20.76*60= 1,245.6rpm
The Makita driver is the correct range for the speedometer driver.

How to derive vehicle speed from motor speed:
(1000rpm/30)=33.3rpm, so (1000rpm/33.3rpm)=30 take this result and divide into 60mph:
(60mph/30)=2mph
Let’s look at our test results:
The Makita Slow:
(1000rpm/30.87rpm)=32.39 and (60mph/32.39)=1.85mph
The Makita Fast:
(1000rpm/1,245.6rpm)=0.80 and (60mph/0.80)=75mph

The Makita driver is a work tool, so I went to the second hand store to find a good deal on a cordless driver.
I found a Chicago Electric driver. I extracted the motor, but it was too fast. I put the planetary gear back on and that got it in the ball park.
Chicago Electric w/Planetary Gear:

Second Series 01-28-2020 04:37 PM

Re: Mechanical speedometer drive solution
 
1 Attachment(s)
2.23Hz * 60s = 133.8rpm
(1000rpm/133.8rpm)=7.47 and (60mph/7.47)=8.03mph

Second Series 01-28-2020 04:38 PM

Re: Mechanical speedometer drive solution
 
1 Attachment(s)
22.51Hz * 60s = 1,350.6rpm
(1000rpm/1,350rpm)=0.740 and (60mph/0.740)=81.08mph

I may be able to get the motor spinning and then slow it down to drive the speedometer less than 8mph.
Let’s look at RPM of the electric motor vs. Hz. of the DRAC:
The Chicago Electric slow speed is 133.8rpm.
The formula to find MPH is (1000rpm/133.8rpm)=7.47 and (60mph/7.47)=8.03mph
Let’s rearrange this equation to find rpm:
(60mph/8.03mph) = 7.47 and (1000rpm/7.47) = 133.8rpm
Put this formula into a spreadsheet with the mph and Hz to find the range of RPM for the speedo motor, and create a chart:

Second Series 01-28-2020 04:38 PM

Re: Mechanical speedometer drive solution
 
1 Attachment(s)
Now we need to write some code for the Arduino to convert the range of frequencies to the range of motor speed.
The Arduino uses a scale of 0-255 to drive a motor. I could use 0-50Hz as my drive signal.
255/50 = 5.1, so my code will have a line that looks something like this:
analogWrite(motor, freq*5.1);
where analogWrite is the command, motor has been designated as the output pin in another line, freq is the frequency calculated in another line, and freq times the multiplier gives me the variable output between 0 and 255 from the variable input between 0 and 50Hz.
There are limitations here that will need to be addressed. The range 0-50Hz is good to about 90MPH, if I go faster than that, the signal will be out of range of the code. I can add a line that treats anything above 50Hz as 50Hz. The motor drive signal range 0-255 is a pwm with 255 being dc, 255 is the fastest the motor will spin. I’ll set the maximum RPM on the speedometer face to be driven by the 255 setting. The motor has a minimum speed that it will start at, and a minimum speed that it will run at. The minimum speed that it will run at may be lower than the starting speed. The Chicago Electric motor with planetary gear starts at what would be 8MPH. If it can run slower, I’ll have to goose it to get it moving, and then immediately back it down to under 8MPH. The pwm range 0 to 255 won’t start at 0, it will start at what it takes to keep the motor running at it’s slowest speed.
I’ve played around with a few examples of Arduino code that I found on-line. I have reconfigured the Arduino to accept a variable frequency from a fuction generator. I discovered that the Arduino does not recognize a 4volt frequency, it must be 5volts.
The motor will run with the Arduino signal 28, but it will reliably start to run with signal 35.
The code is adjusted to add 35 to frequency x 5.66. The upper end is limited to 255, so any input above 254(60Hz.) is converted to 255. The low end. The code named “freqCount” works well. But because 35 is added to the equation, the top speed is achieved with 39Hz. I’ll have to re-code so the motor starts with 35 at 1Hz, and runs through to 60Hz for 255. 39Hz x 5.66 = 220.74, and 220.74 + 35 = 255. 220/60Hz = 3.66, so I’ll change the multiplier in the code to 3.66.
The code seems easy enough to modify, and still needs improvement. I’ll check this setup with the RPM sensor when it becomes available.
The vehicle has 12volt signals, the Arduino runs on 5volt signals. Use a 7805 or similar to change 12v 2000ppm to 5v for Ardunio input. I’ll have to look at datasheets to verify this component reacts at the appropriate speed.
My transmission is from an ‘88GMC. The DRAC is integrated in the gauge cluster so I need to find a DRAC from ’92 to ’95 Truck, or ’90 to ’95 Van. I went to a couple wrecking yards last week, all the electronics were gone…
I may be able to use the Arduino for a DRAC. That would make it useful on a wider range of applications. The signal will require conditioning to transition between vehicle and Arduino. The VSS, reluctor signal looks like a .5v ripple on 12v. The 12v can be blocked with a capacitor, and the .5v ripple will need to be boosted to 5v so the Arduino can see it. That should be simple enough to achieve. The 128,000ppm, 4,000ppm, and 2,000ppm signals will need to be boosted from 5v to 12v.
The circuit in my truck takes the signal from the VSS/Reluctor sensor, runs it through the Ratio Adapter and produces a 128,000ppmile signal, I read about a Schmitt trigger used to convert the signal to a 12v square wave, from my o-scope results, it appears to happens with the divide by 32 circuit to produce the 4,000ppmile signal, finally a divide by 2 circuit produces the 2,000ppmile signal.

Second Series 01-28-2020 04:39 PM

Re: Mechanical speedometer drive solution
 
1 Attachment(s)
This is a screen shot of the oscilloscope, the truck is idling in 2nd gear at 10mph.
ppm = pulse per mile
Channel 1 is the 2000ppm at 5.1Hz
Channel 2 is the 4000ppm at 10.45Hz
Channel 3 is the 128,000ppm at 332Hz
The Gauge Cluster diagram shows a divide by 32 circuit, so 332Hz/32= 10.375
10.375 is close to 10.45Hz, so the frequency counter in the o-scope is acurate and the readings are valid.

Second Series 01-28-2020 04:40 PM

Re: Mechanical speedometer drive solution
 
1 Attachment(s)
A close look at the 128,000ppm signal:
This is a screen shot of the oscilloscope, the truck is idling in 1st gear.
The 128,000ppm at 158Hz.

Second Series 01-28-2020 04:41 PM

Re: Mechanical speedometer drive solution
 
1 Attachment(s)
I’ll have to convert the VSS to something the Arduino can detect, Multiply that to get the 128,000ppm and use some external circuit to get this kind of waveform, the 4000ppm and 2000ppm can be produced with code and boosted to 12v with discrete components. I could add a potentiometer to adjust the multiplier for the 128,000 signal to accommodate a range or gear ratios and tire sizes.

I’ll need to take some more o-scope readings to double check the math, let’s look at it from the other end.
Stock tire size is 225/75R16, or 29.3” so 3.14 x 29.3 = 92.002” circumference of tire. 63,630 inches in a mile. 63,630/92.002 = 691.615 tire rotation per mile x 3.73 gear ratio = 2,579.725 driveshaft revs per mile. 2,579.725 x 40 teeth = 103,189.018 pulses per mile. At 60mph(1 mile a minute), that’s 103,189 ppminute And 103,189/60s = 1,719.81667pps, or 1,719.81667Hz @ 60MPH
At 20mph take 60minutes/20mph = 3, the vehicle travels 1 mile in 3 minutes. At 103,189 ppm/3minutes = 34,396.333ppminute. 34,396.333ppminute/60seconds=573.27Hz So at 20mph, the vehicle travels .333 miles in 1 minute with 573.27Hz from the VSS.
Take this equation, plug it into a spreadsheet, and come up with a chart for MPH vs. VSS frequency:

Second Series 01-28-2020 04:41 PM

Re: Mechanical speedometer drive solution
 
This is good for any transmission with 40 tooth reluctor, range will be slightly different with other gear ratios and tire sizes.

So, this is what I have done for now. I will continue to look for a suitable motor, probably a cordless driver from a second hand shop. They are in the right range, and include gears. I tried looking on-line for motors, and gears with poor results. The Mabuchi RS-555PH was suggested in that other thread, but it needs to be geared down.
I need to build the box, get a connector for the speedometer cable. Where can I get the connector like on a transmission that the cable attaches to? 5/8” thread for GM?
I’ll take some more o-scope readings of the VSS.
Breadboard the discrete components to modify the VSS signal for Arduino, etc.

mongocanfly 01-28-2020 05:42 PM

Re: Mechanical speedometer drive solution
 
looks like you know your stuff......waaaayyyy over my head...
me..i just get a Dakota digital convertor box and move on...

skyphix 01-28-2020 05:58 PM

Re: Mechanical speedometer drive solution
 
I love this at home hacking stuff. I haven't messed a bunch with the arduino's yet but keep wanting to pick up a basic kit and try it out.

I just ended up using the OBDII port, a bluetooth sender, and will be using a tablet for my gauges.

nsb29 01-28-2020 07:02 PM

Re: Mechanical speedometer drive solution
 
Quote:

Originally Posted by mongocanfly (Post 8667939)
looks like you know your stuff......waaaayyyy over my head...
me..i just get a Dakota digital convertor box and move on...

I’ll second that

prodjay10 01-28-2020 07:25 PM

Re: Mechanical speedometer drive solution
 
I’ve been wanting to do something like this with a stepper motor. That’s is supposed to be used in the speedos anyway. I just lost interest.

You can get arduino clones for cheap.

dayj1 01-28-2020 10:42 PM

Re: Mechanical speedometer drive solution
 
Quote:

Originally Posted by Second Series (Post 8667890)
I will continue to look for a suitable motor, probably a cordless driver from a second hand shop. They are in the right range, and include gears. I tried looking on-line for motors, and gears with poor results.

If you'll PM me your address, I'll send you a stepper motor with a built in optical tachometer for feedback to your controller. It's RPM range is good up to about 120 MPH (2000 RPM). I was going to do this a few years back and sourced a couple of motors. In my case, I decided it was just easier to use a mid-90s GM speedometer and re-face it for my application. But, you obviously know what you're doing. If you can put the motor to good use, you can have it.

Quote:

Originally Posted by Second Series (Post 8667890)
I need to build the box, get a connector for the speedometer cable. Where can I get the connector like on a transmission that the cable attaches to? 5/8” thread for GM?.

You're pretty much going to have to machine a fitting for this. I've never seen anything off the shelf that would work without some modification. I was going to machine a coupler to attach the motor directly to the gauge (and eliminate the cable and the resistance that comes along with it). I have access to the tools to make such a fitting, but, again, I just said forget it and went the route of least resistance.

Second Series 01-29-2020 12:37 PM

Re: Mechanical speedometer drive solution
 
Quote:

Originally Posted by dayj1 (Post 8668108)
If you'll PM me your address, I'll send you a stepper motor with a built in optical tachometer for feedback to your controller. It's RPM range is good up to about 120 MPH (2000 RPM). I was going to do this a few years back and sourced a couple of motors. In my case, I decided it was just easier to use a mid-90s GM speedometer and re-face it for my application. But, you obviously know what you're doing. If you can put the motor to good use, you can have it.



You're pretty much going to have to machine a fitting for this. I've never seen anything off the shelf that would work without some modification. I was going to machine a coupler to attach the motor directly to the gauge (and eliminate the cable and the resistance that comes along with it). I have access to the tools to make such a fitting, but, again, I just said forget it and went the route of least resistance.


Very generous offer, Thanks! PM sent. I'm interested in comparing the different motors and how the speedo reacts. Once I get the circuit down, I can take the IC off the arduino, and mount it to a new pcb.

pilotXC 02-05-2020 10:22 PM

Re: Mechanical speedometer drive solution
 
Dakota Digital pulse sensor works just fine in mine as Mongo stated.

solidaxel 02-06-2020 10:53 AM

Re: Mechanical speedometer drive solution
 
D D after you get past the price it works great and easy to install!

pilotXC 02-06-2020 12:20 PM

Re: Mechanical speedometer drive solution
 
The pulse sensor is $40-$50, I didn't do the digital gauges that are $1000.

Second Series 02-06-2020 03:27 PM

Re: Mechanical speedometer drive solution
 
2 Attachment(s)
My initial plan was to use an off the shelf solution, I found a couple available. In my search I also found discussions of building your own. I also discovered that I can replace the tail housing and use a mechanical speedometer cable, there are several signal sensors with pass through for mechanical cable available. It’s good to have options. I’m having fun playing with electronics.

I received the motor from Dayj1, Thanks again! It is a DC motor with optical disk, not a stepper. I found it is used in a Lexmark printer for paper feed. It does run at 2,136rpm for 128mph, but I couldn’t get it to run slower than 160rpm that works out to 9.6mph. I could gear it down, but 1.5:1 would get 6.4mph to 85mph. I like that it has the optical disk, I’ll play with that.

Part of the issue could be my test setup, I’m using a BJT transistor for the motor supply, a FET might be better. The PWM is 12v, I could try different frequencies, or voltages. I may fine tune it at some point, but it works for now.

Someone tore apart a broken vacuum at my work, I found the motor in the scrap bin. It’s from a Dyson cordless, unfortunately the shaft was bent. It kind of worked, I tried to unbend the shaft, and it has a good range, but too fast at 100rpm to 8,000rpm . The shaft is 2.3mm and I have some gears from the hobby shop for 2mm. I set it up with 5.5:1 gears and it’s good for 3mph to 100mph. It is a Johnson motor, but I was unable to cross reference the numbers on their website. I did locate a similar motor by looking at size and supply voltage. There is also the spec. of Stall Torque, that may be related to how slow it will run. I’ll order a few different motors to test. I’m still curious about using a stepper motor, so I’ll keep searching.

The code has some bugs and needs to be cleaned up, but it works for 2Hz and up. I’m ready to connect my speedometer to these motors to see how it effects the motors.

It looks simple enough to build a DRAC. I can use an op-amp as a Schmitt trigger to clean up the VSS signal and produce a nice square wave.

Second Series 02-06-2020 03:29 PM

Re: Mechanical speedometer drive solution
 
3 Attachment(s)
A 5volt regulator to feed the square wave into the Arduino. The signal can be converted from 40 pulse per driveshaft rev to 128,000ppm, 4,000ppm and 2,000ppm in the software. A potentiometer can be used to adjust for tire size and gear ratio. The 128,000ppm looks like a modified square wave on my truck, A differentiator will produce that signal. It looks like the 4,000ppm is 5v, and the 2,000ppm is 12v. The Arduino operates at 5v so a transistor switch can bump the signal up to 12v.
I’ll need to order some components and breadboard this. I’d like to set up a reluctor ring and sensor on my bench so I don’t need to jack up the truck when I’m trying to figure this out.

Jason Banks 02-08-2020 12:28 PM

Re: Mechanical speedometer drive solution
 
Just found this thread, I actually started working on this also. I got sidetracked and haven't come back to it yet, but I'll post some pictures of my setup. DC Motor with Timing belt and gears that drive another shaft that has a rotary encoder. I used a Teensy development board instead of a real arduino. The rotatry encoded which Is not installed in my pictures and I can't seem to find right now is a CUI AMT103-V. The whole thing is designed to thread right on to the back of the speedometer head.

I kept smoking regular transistors, or they were not working right(can't remember) so that other little thing plugged into the board is a better surface mount transistor or mosfet.

http://67-72chevytrucks.com/gallery/...edometer-1.jpg
http://67-72chevytrucks.com/gallery/...edometer-2.jpg

Jason Banks 02-08-2020 12:34 PM

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.

Second Series 02-10-2020 09:24 PM

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.

Second Series 03-13-2020 04:31 PM

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.

aknovaman 03-14-2020 09:12 PM

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

Second Series 03-19-2020 04:05 PM

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.

aknovaman 03-19-2020 04:12 PM

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.

Second Series 03-26-2020 05:59 PM

Re: Mechanical speedometer drive solution
 
2 Attachment(s)
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.

Second Series 06-11-2020 04:15 PM

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.

kglowacky 06-11-2020 05:26 PM

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.

TrybalRage 06-12-2020 08:17 AM

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.

Second Series 06-12-2020 05:49 PM

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.

Factory Guy 06-14-2020 11:05 PM

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

TrybalRage 06-21-2020 05:52 PM

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.

Second Series 07-24-2020 12:41 PM

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.

Second Series 08-06-2020 01:17 PM

Re: Mechanical speedometer drive solution
 
1 Attachment(s)
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:


All times are GMT -4. The time now is 02:34 PM.

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