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.



10 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
  2. Hi Andy, Been searching for this type of for quite a while now. I have a vauxhall Firenza with the notoriously inaccurate 7 dial dash and was considering fitting an electronic speedo with an analogue odometer / trip from a Rover 400 but this seems like it would be easier to work with (I no expert in electronics or programming but have heard of Arduinos). I would need to add a re-settable trip meter as well as an odometer, can this be done easily?

    ReplyDelete
  3. Hi Andy, Been searching for this type of for quite a while now. I have a vauxhall Firenza with the notoriously inaccurate 7 dial dash and was considering fitting an electronic speedo with an analogue odometer / trip from a Rover 400 but this seems like it would be easier to work with (I no expert in electronics or programming but have heard of Arduinos). I would need to add a re-settable trip meter as well as an odometer, can this be done easily?

    ReplyDelete
    Replies
    1. I had a Magnum with the same! I'm in the process of re-engineering this project a bit, including a Km/PH read out ... perhaps I can incorportae this too ... might not be a quick job, but I'm sure I can come up with something!

      Delete
  4. Hello, I am trying to build this code without the stepper motor part, would you be able to write the code with out and only the Odometer portion so that it saves to the memory and is retrieves with a startup. I have taken out the stepper parts but i get the message class EEPROMClass' has no member named 'update, i compiled it again on the full code you provided and i get the same message again. Would very much appreciate some help. Thank you. PS love your projects, you are an inspiration to what Electronics is about, rebuilding old technology. Richard

    ReplyDelete
  5. Just want to add, that i am trying to compile this for a ESP8266 with it having more memory, not using the wifi but a possible upgrade..

    ReplyDelete
  6. You'll need to investigate correct implementation of the EEPROM class support on ESP32xx.

    ReplyDelete