The original plan to use a DC motor to spin a standard Smiths speedometer cable has gone out the window. The DC motor I purchased didn't have enough torque to spin the cable at the required speed and the slightest bend in the cable stalled the motor. Version 2 will consist of a stepper motor controlled pointer needle for the speed output. The code is written and stepper motor is on order. I will post a video and parts list once I have the prototype built. This next problem to overcome was how to keep track of distance. Luckily during my research I found a couple of projects that were using the Arduino to count distance covered and then write that value to EEPROM ready for the next restart. The above video is my implementation of various sketches into a working combination for me. I will post up the code once I have the stepper motor hooked up and tested. How It Works A 555 frequency generator is being used to simulate 60mph pulse train coming from the R1 engine. This is counted over a 1 second sample period, converted to feet per second and increments the distance counter when a total of 528 feet has accumulated. 528 feet equals 1/10th of a mile which is a typical update interval on odometers. At 60mph 1/10th of mile is reached every 6 seconds so I can use this know value to calibrate the counter. On the 10th 1/10th of a mile the miles counter is incremented to 1 and the 1/10th zeroed and the loop continues. It will only display up to 99,999.9 miles which is in keeping with the original Smiths odometer. My code on the other hand will keep counting into the hundreds of thousands. The Formulas I based my calculations on 60mph because it seemed like a good conversion factor.
Reference formulas
60 / 10 = 6 so 6 seconds = 1/10th of a mile 1 mile = 5280 feet 5280 feet / 60 seconds = 88 feet per second 5280 feet / 1/10th of mile = 528 feet Converting mph into feet per second Speed x 5280 / 3600 = Feet per second 60 x 5280 / 3600 = 88 Feet per Second Counting and Incrementing Variable called FeetTravelled stores count of feet sampled over 1 second. FeetTravelled is added to variable called Odometersubtotal. When Odometersubtotal = 528 a counter called tenthsm is incremented by 1 and Odometersubtotal is reset to 0.
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |
Categories
All
Archives
July 2020
|