Loading ...

Translate

Sunday, 5 November 2017

Classic Mini 1275GT Electronic GPS Speedometer and multifunction display revisited.

A few months ago (was it really that long?) I created an electronic solution to the classic Mini speedo (here)

When I posted the article up on a couple of sites, there were a few comments from people that they didn't like the movement of the speedo needle. I can see why, as it only moves in discreet "clicks" every 1 mph. They would like it smoother.

"Easy" I thought.... oh how wrong I was!

I initially started by changing the speed value from an integer to a float, and dumping the map function. It was an improvement, but had a tendency to jitter about. Nope. Not good enough.

Back to integer speed, and an attempt to control the update rate by creating an array and loading the array with the car's speed every time it updated (every 250mS). I then got the microcontroller to detect the slope of the changes in speed and move the needle quicker when the car was accelerating (or decelerating) hard, and slowly when the acceleration wasn't so hard.

Well, it didn't work very well. I could see the sketch was working, but the amount of data needed to sample, and the time it took to calculate the amount of delay to add to the pointer caused the update rate to slow to an unacceptable amount, and the speedo to appear "laggy". I attempted to improve the speed of the sketch, and revised the code a number of times, and even forced the compiler to optimise for speed over code size, all to little avail. The idea of delaying the speed of the pointer seemed sound though.

I drank some tea .....

A few weeks passed, and I had another idea. Don't attempt to measure the acceleration of the car. Control the acceleration of the needle with regards to it's position. The sketch now sampled the speed, and set the needle motor target position to that value. Now change the motor position, one step at a time, towards the target position. As the pointer approaches the target, increase the delay between each step. A few tweaks to the amount of delay applied, and it works! In effect I've created a PID controller for  the pointer position (actually, there's no D).

I've also changed the code to the multifunction display, which now displays a warning for ice, no GPS, and no charge (ICE, GPS or CHG are displayed)

The revised code (including the required libraries) can be found here :  https://github.com/andydoswell/GPS_Speedo_Smooth

Just click on "Clone or download" and download the zip. Unzip into your Arduino directory. Place the libraries in the library directory.



4 comments:

  1. Hi Andy, great work and thanks for sharing. Don't know if you will reply here but I wanted to ask a question. I used your code without the stepper as I wanted only the odometer and am using a small GPS module with 1Hz update frequency and sometimes it just does not count, I took out the km/h to mph conversion by just multiplying with 1000 instead of 1609 a it does increment with 1Km but as I mentioned sometimes it just get's stuck for a few kilometers and then continues again. Could it be that it just needs a higher update frequency? Maybe the 1Hz gets missed sometimes, I could probably set the GPS module to 5Hz but wanted to ask your opinion first, thank you so much. Regards, Hayri

    ReplyDelete
    Replies
    1. Hi Hayri, Poor satellite reception? If the odo can't update, it will the next time a lock is achieved. If you get intermittent corruption of the odo, make sure you are running the latest code, as I found you could get erronious results if the satellite lock was poor. Update rate shouldn't effect it.

      Delete
    2. Thank you very much for your reply, I greatly appreciate it. Will try it again as I would love to incorporate it in my Car gauge.

      Delete
    3. This comment has been removed by a blog administrator.

      Delete