View Single Post
Old 01-18-2022, 03:28 PM   #50
Second Series
Registered User
 
Second Series's Avatar
 
Join Date: May 2015
Location: Tukwila Washington
Posts: 373
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
Second Series is offline   Reply With Quote