It worked rather well I thought. If a bit steppy.
Gps speed is updated every second - which can be a long time.
Although it matches exactly with google maps speed on the phone.
Miles on the trip meter is calculated every iteration (about 1 second) by the simple method of
distance = speed X time - rather than the haversine method.
In just over a 1000miles it's only 7 miles less than the daily driver so is quite good I think.
I'm now working with a Nano ESP32 version, the idea is to use its dual cores and realtime elements to have one core doing the gps and the other doing everything else and consequently able to smooth the step resonse of the needle by using the non blocking update method.and an element of prediction using acceleration.
I should be changing the brake hoses - but its cold outside.
The ESP32 is a 3.3v system and I need 5V to drive the stepper motor.
Initially had lots of issues with noise until I replced the 8way voltage converter to a 4way version.
Faster GPS module as well (same 1s update but faster to talk to)
Now I have a smooth pointer drive. Non blocking update every 50ms in its own task.
Also saves the lat long (and other data) to SD card so can view on google maps.
Lower display shows the mileage at low speeds and speed in MPH when moving. can be set to KM/h by switch.
used this as an excuse to buy a 3d printer. its definiteley and expensive speedo.
Will add a pushbutton on a stalk (similar to the original) to reset the trip and change to display to kmph.
- Lights on reminder.
- indicators on too long reminder
- day/night brightness
Can take 30s to get the minimun number of satelites after a long time powered off.
Pointer tuning at low speed still required.
Also needed to install an end stop more subtle than a cocktail stick.
A sewing needle was just the job.
Made a plug for the back of the speedo.
Original plan was to fit the Arduino inside the speedo but for ease of "continuous update" I'll mount it in a box.
trip reset switch (mini pushbutton) comes out of the original trip reset hole.
its still working on trial in the daily driver.
Now Ive updated the circuit from breadboard to veroboard.
And created a black box. There is space for more parts.
I need to add wiring for the digital inputs for Ignition and lighting (green bits in photo)
and analogue input wires from fuel guage and water guage.
I dont need the indicator input anymore, the new LED's are like laser beams.
Mileage now set to old speedo value.
The GPS sensor seems to be able to still pickup 12 satelites under the dashboard in the garage so maybe I dont need to put the sensor on the dash top.
Added the analog wires(x) for the water temp and Fuel qty and digital wires for Ignition-on and lights-on.
Water temp not really needed but might as well - roughly worked out that the temp(y) is fairly linear so y=mx+c =-.1157x + 142.7.
but that isnt quite right as currently it says the garage is 28 degrees. so it may be almost linear on the guage display range only
When I top up the tank can then work out the graph for Fuel as well. then can monitor the mpg
a 1 minute video - power on (via extra switch for now), lights on (dim display a bit) and reset trip distance