Register or Log In To remove these advertisements. |
|
|
|
Thread Tools | Display Modes |
01-18-2022, 03:44 PM | #51 |
Registered User
Join Date: Jan 2022
Location: NE
Posts: 10
|
Re: Mechanical speedometer drive solution
I found an encoder motor on amazon and removed the 10:1 transmission from it to get a 6000RPM motor. After finding that didn't quite have enough torque I made a 4:1 gear for it, but the noise was pretty intense as I don't think it was perfectly round. This motor in particular does 12 pulse per rotation, 120 if you leave the transmission on.
I see what you mean about the VSS signal, it seems like you're kinda stuck on that. In my case I'm reading a 4000 PPM signal from a Holley Terminator and the low speed resolution of that seems to be acceptable. It's a PWM- output so I'm having to use a pull-up resistor circuit and interrupt on the descending change (this thread). I do notice some jitter where one cycle may catch 1 more pulse than another changing the speed by a few MPH. On that front I might suggest calcautating the frequency given method 2 shown here in the video. They count millis between pulses to calculate the frequency immediately and it can be updated with every pulse. Funny that you mention the LM2907 I just came across that in my research today. I was having an issue understanding how you might calibrate the readings from that device and I also didn't see any prebuilt PCBs. I'm also not reading directly from a sensor. |
01-18-2022, 05:16 PM | #52 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 391
|
Re: Mechanical speedometer drive solution
Thanks for the links, nsocwx, that’s quite a bit of information to digest. It looks like you have a working solution. I’ll be using a DRAC, and I found that when I connected the speedo driver to my ’90 chevy on the 2kppm line to the ECM it may have caused problems with the ECM, I’m not sure, it seemed hard to start. The 128kppm signal goes to the RWAL module so I’m less concerned with that. I could use any of the signals as there is a dedicated line for the speedo on the DRAC module. The LM2907 is set for operating range with a capacitor. The output is a voltage, for my Arduino I don’t want to go above 5v, so I use a 5v supply. The output is 0 to 3.98v with 3.98v at 4kHz with a 2200pF cap. The voltage is fed to an Analog in and scaled to 1023. This is read every iteration. There was some fluctuation so I add the reading to itself for a number of iterations and then divide by that number and get a smooth reading. The 0 to 1023 value is converted to the input frequency through an equation.
I just got that working by itself last week, and will set one up for the optical frequency and then implement both in the main code. I’m using a bench signal generator for now, eventually I’ll try it with the vehicle signals. I want to get away from using interrupts. I could also use the chip registers to count frequency, but that’s a whole other can of worms I’ll avoid for now. The issue is with reading more than one frequency. The motor encoder is one frequency, and the control signal is another frequency. I don’t know if using registers will work with more than one frequency input.
__________________
'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 |
05-13-2022, 03:06 PM | #53 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 391
|
Re: Mechanical speedometer drive solution
I have been experimenting with frequency counting. I tried a hardware solution with a frequency to voltage convertor I.C. the LM2907. I tried a software solution using the Arduinos internal registers.
A fair amount of mathematical acrobatics is required with the LM2907. The control frequency is fed into the LM2907(35Hz to 2844Hz). The LM2907 outputs a voltage(0.02v to 2.16v). That voltage is scaled in the software to a value the Arduino can use(3.6/1023.0). That value is counted and divided by the count to get a smooth average. That average is run through a polynomial equation to get a close match to the control frequency. The LM2907 solution requires about 20 counts to transition from one frequency to the next when read each iteration of the code. Adding the readings 200 times and then dividing by 200 gets a smooth result, but perhaps discarding the first 20 reads after a change in input is detected would be more accurate and counting would not be required. Even at that, the code iterates 200 times in 54mS. The Arduinos internal registers can be used for counting frequency with the expense of disabling the millis function. This is not a problem as timing requirements can be based off the register timer. The register timer uses interrupts. Since I was using interrupts for the optical disk, I set up one register counter for the control frequency. The two different interrupt routines did not appear to interfere with each other. The use of a register counter appears to be more accurate. That may be due to the direct nature, and the lack of mathematical acrobatics. The accuracy seems to degrade below a 200mS sample time, so the hardware solution would appear to be faster. So far I have been experimenting with the use of a signal generator for both the control frequency, and the optical disk frequency. The next step is to implement both counter types connected to the speedometer. I have also acquired an FET to drive the motor instead of the BJT that I had originally used. I’m building two circuit boards, one for each system. I’ll have to calibrate the code for each and see which one performs the best. All this because I’m going from using the 2,000 pulse per mile signal to using the 128,000 pulse per mile signal. After I get the frequency counting situated, I will work on getting a smoother needle response.
__________________
'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-05-2024, 04:24 PM | #54 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 391
|
Re: Mechanical speedometer drive solution
I wrote this update a year ago and didn’t post it:
This project is still in the works. It is time to get it off the back burner. I had worked on it awhile ago. At that time I had implemented an FET to drive the motor. The folks at the Arduino forum advised me to use an Arduino MEGA. Discussion here: https://forum.arduino.cc/t/pwm-and-r...ounter/1073781 I was able to discover the limitations of the MEGA and the Arduino in general. The UNO has 3 timers. The MEGA has six timers, 5 of the timers have a Tn pin for reading input frequency, and only 2 of the timers Tn pin is wired out of the MEGA board. It is possible to wire out a third. I spent a lot of time getting that to work and learning how to use registers for counting. I have been looking through my notes to figure out what I did, and where I left off. It looks like I was able to set up a register as a frequency counter, but that disabled the millis function. With the millis function disabled that also disabled the timing, and the PWM function. As a work around I set up a timer based in the code, and also set up a bit banging routine to get the PWM output. This was problematic as each time something was changed in the code, the timing had to be adjusted. In the end the I found there to be too much fluctuation in the frequency readings and I came to this conclusion: The Arduino is not capable of reading more than one input frequency. I need to read Two input frequencies, and output a PWM. I could use Three Arduinos, or rather Three microprocessors. The Arduino UNO uses the ATMEGA328P. That chip can be programmed on the UNO, and then removed and placed on another circuitboard. While the UNO is around $25.00, the microchip costs $3.00. I could also source a more appropriate microcontroller that is not on the Arduino platform. I still have the LM2907 setup for reading the VSS signal and the motor encoder signal. I’ll set up the code for that hardware and see how stable it can be. The LM2907 is a frequency to voltage convertor. Another option may be Reciprocal Frequency Measurement. Use a D flip-flop like the 74HC74. I don’t know, something I just stumbled across here: https://www.instructables.com/High-R...uency-Counter/ This example uses registers also, so it looks like it won’t solve the issue of counting 2 frequencies simultaneously on one microprocessor. Here is another example of Dual frequency counters on Arduino MEGA: https://forum.arduino.cc/t/dual-freq...ega2560/328246 I might look at how this is being done, but so far I have avoided using libraries. This looks like a possible solution, I’m going to try this: https://www.esologic.com/multiple-fr...unter-arduino/ That’s where I was a year ago. Since then I have my truck on the road and am closer to being done with this. The code from esologic works well for counting two input frequencies. I set up a box with Five potentiometers to dial in the PID code. The speedometer is fairly accurate and smooth. Still not perfect. Now I am working out bugs in the main code. It works well on the bench. When I install it in my truck I get some needle movement when there should be none. I connected my laptop to the Arduino UNO while it was installed in the truck and the laptop went into emergency shutdown. I was able to reset the laptop and will try again with a modified usb cable with the red wire cut.
__________________
'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-06-2024, 04:23 PM | #55 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 391
|
Re: Mechanical speedometer drive solution
I found that the laptop does not recognize a usb cable with no power(red wire cut). I was able to start the truck and then connect the laptop to the Arduino. Troubleshooting the erratic needle movement I added a line in the code to monitor the input frequency. With the truck idling and stationary there should be no input. I was seeing a signal. I temporarily shielded the box with aluminum foil and the input wire with copper tape, but that didn’t fix it. I disconnected the input wire, and then the power wire. Of course with the power wire disconnected there was no needle movement, but I continued to see signal at the input with both wires disconnected. The input signal goes through a 5v regulator, a jumper, and into the Arduino. I removed the jumper and no longer saw a signal at the input.
I designed the circuit with minimal parts. I now added a capacitor to the input signal to get rid of this unwanted noise. At first I attached a 1uF cap. That completely eliminated the erratic needle movement, but the speedometer would go no higher than about 35MPH. I then tried a .1uF cap. That allows the speedometer to go over 60MPH, smooth movement. There is some delayed settling when coming to a stop, I’ll keep tweaking the code. I got some ideas from nsocwx’s build and found an opto-isolator that could work instead of the 5v regulator and capacitor. I ordered some more parts, and am creating a BOM, list of parts. I’ll document everything as I build a second unit. I found a motor from a robot website that could work, but still waiting on delivery.
__________________
'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 |
|
|