Register or Log In To remove these advertisements. |
|
|
|
Thread Tools | Display Modes |
09-05-2024, 04:24 PM | #38 |
Registered User
Join Date: May 2015
Location: Tukwila Washington
Posts: 387
|
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 |
Bookmarks |
|
|