
Building a Raspberry Pi GPS Speedometer - gleslie
https://gleslie.com/rpi/raspberry/pi/dashboard/2020/03/28/building-a-rpi-vehicle-dashboard.html
======
paulgerhardt
If you’re a fan of these kind of vehicle hacks you may enjoy the infamous
“Zero f*cks given RX-7” build by a 4-chaner:
[https://youtu.be/ZcjpXbMiCtg](https://youtu.be/ZcjpXbMiCtg)

~~~
adrianN
Are cars like that street legal in the US? I'm fairly sure you wouldn't be
allowed to drive that in Germany.

~~~
wil421
If the speedo doesn’t work then yes it’s illegal. Is that an intercooler? Some
places may have an issue with it sticking out.

If the car is considered an antique you can get away with a lot. People are
importing rare 90s Japanese cars because you can get away with having left
hand drive. Over 25 years old is considered antique.

No one inspects your car like in Germany they just test emissions. The cops
will have to see you and pull you over.

~~~
4gotunameagain
It's an oil cooler :)

------
kayoone
This is a cool hack but is it really legal?

In the EU speedometers have to be carefully calibrated, have strict
regulations to pass and your car is not allowed to drive with a broken one.
Just replacing it with a, sometimes spotty, GPS signal sounds impossible here.
Like, what do you do when driving through a tunnel?

~~~
codazoda
In Utah an old car used to pass safety inspection without a speedo. My Dad's
old Prism had the speedo die at just over 100k and him and my brother put
another 200k (estated) miles on it. Registration renewed every year. Utah
dropped the safety inspection requirements last year because no reduction in
deaths has happened with it in place. Anything goes now, as long as it can
pass emissions.

~~~
MrBuddyCasino
> Utah dropped the safety inspection requirements last year because no
> reduction in deaths has happened with it in place.

I wish this was possible in the EU.

------
3fe9a03ccd14ca5
Really cool hack and fun idea! Some ideas if your only goal is to get a
speedometer. Firstly, ditch the pi and use something with much less power
usage, such as an ESP32 or Arduino or STM32 whatever. The Pi uses a lot of
power. Then use a GPS IC such as the Neo 6M[1], which is cheaper and less
power usage than a USB GPS dongle.

The point of having a low-power SoC is that it can stay on while the car is
powered off, taking a GPS sample every 10 minutes or so, so that when the car
powers on it can very quickly get a lock. The Neo 6M also keeps a memory of
the last location which helps it get a lock quickly.

[https://create.arduino.cc/projecthub/ruchir1674/how-to-
inter...](https://create.arduino.cc/projecthub/ruchir1674/how-to-interface-
gps-module-neo-6m-with-arduino-8f90ad)

~~~
oh_sigh
Even relying on GPS is overdoing it. Paint a white stripe on a tire using a
permanent marker, and then mount an IR emitter and phototransistor in the
wheel well. Knowing the diameter of the tire and the time between revolutions
lets you easily figure out speed.

~~~
3fe9a03ccd14ca5
Great idea! But I think this is harder than GPS because the chip simply spits
out speed and direction.

------
spike021
I'd love to build a HUD for my Subaru BRZ like this, but using some kind of
HUD. Even just as a speedometer. But I'm not really able to solder/do much
wiring since I have hand tremors. It'd be sweet, though.

~~~
tyingq
I imagine soldering with tremors is doable with some sort of flexible arm set
up to hold the soldering iron. Something like this:
[https://www.fullcompass.com/prod/541073-aladdin-eye-lite-
cla...](https://www.fullcompass.com/prod/541073-aladdin-eye-lite-
clamp-20-flexible-arm-with-clamp-for-eye-lite-led-fixture)

I did a lot of soldering as a microwave tech, and used a setup like that just
for convenience. I have to have a magnifying glass on a similar flex arm
because my eyes are so bad. I suppose there are still some hard parts, like
trying to use braid to remove solder, but I bet you can do it.

I have a 1991 Mitsubishi Galant VR4 that has a place in my heart that your
Subaru seems to have. Cool family compact with 4WD and 500 oversized, at the
wheels, turbo HP.

------
asadhaider
I've seen electronic speedometers that plug into vehicle OBD2 ports, and I
know you can read the vehicle speed and other data using a wireless OBD2
adapter.

Would that not be preferable to this as it'd be a lot more reliable, granted I
don't know which cars support them or not but I've seen them working in modern
vehicles.

~~~
grosswait
No OBD2 on that model that year [https://itstillruns.com/retrieve-flash-
codes-1994-ford-75016...](https://itstillruns.com/retrieve-flash-
codes-1994-ford-7501628.html)

------
thanksgiving
I have been playing with my (spare) Android phone and its GPS to record my
location and speed when driving. My guess is when using an app on Android,
there are too many variables (from the actual GPS hardware, device ROM
settings, app settings, etc.) which are not very easily accessible and likely
optimized for different goals.

In my use case (as in the article) only care about GPS readouts when the car
is in motion so I don't really care about energy efficiency (within reason,
the cigarette lighter thing should be able to safely power the device).

The GPS module manual says it takes about forty seconds for the GPS module to
position.

[https://images-na.ssl-images-
amazon.com/images/I/81+jY5X2YrL...](https://images-na.ssl-images-
amazon.com/images/I/81+jY5X2YrL.pdf)

> Once the GPS module is powered on, there is data output > It usually takes
> about 40 seconds to be successfully positioned. > After the positioning is
> successful, the correct time, latitude and longitude position data will be
> available.

But the article says:

> GPS is usually acquired within 15-30 seconds of starting (much faster than
> the cheap electronic speedometers I tested first).

Maybe this does not include the time it takes for the raspberry pi to boot?
Maybe the raspberry pi takes an additional thirty seconds to boot and the GPS
unit powers on almost simultaneously with the raspberry pi but we don't blame
the GPS module for any delay until the raspberry pi boots, logs in, and the
Navit application starts?

Or maybe the GPS positions way before forty seconds and the manual is written
that way to not be overly optimistic (could never get decent GPS signal when
walking in areas with tall skyscrapers on my Android phone a few years back).

This is also exciting because it is modular. When GPS III[1] (hopefully)
becomes operational by the end of the decade (The tenth and final GPS Block
III launch is projected in Q2 2023 so it should be fully operational/adopted
by 2030), you could simply use a new module (in theory at least).

[1]
[https://en.wikipedia.org/wiki/GPS_Block_III](https://en.wikipedia.org/wiki/GPS_Block_III)

~~~
gleslie
You are right; I didn’t factor in RPi boot time to that figure. I’d guess
maybe 60-90 seconds total? By the time I’ve turned the ignition, backed out of
the driveway, and put it in drive I have a GPS lock.

~~~
theli0nheart
Not sure if this is unusual, but it takes me ~10 seconds to turn on my car and
pull out of the driveway. What are you doing for 60-90 seconds?

~~~
gleslie
I live on a busy city street.

~~~
theli0nheart
Ah, gotcha. Yeah, that makes sense. :)

------
oh_sigh
Problem is you can't tell your speed in a tunnel. I propose training a ML
model to be able to estimate the distance a camera moved between two input
images. You could probably use google street view as training data. Then,
instead of relying on fancy satellites, its just a few billion numerical
calculations.

~~~
gsich
There are chips for that (dead reckoning).

~~~
lolc
Withoug a speed sensor, dead reckoning is really hard.

------
pugworthy
This would be interesting to have in my old MG Midget. The center radio
console is essentially wasted space, with a 4”x7” speaker grill that could be
replaced with a nice monitor. Not sure if I need navigation in it but I’d love
to instrument the heck out of the old car.

------
slicktux
Is Navit necessary for attaining speed?? Or can one get speed with a geometric
formula and GPS data?? Albeit having navit running is nice but would be nice
to make a simple LED display of speed instead ;)

~~~
jrockway
You don't need to do any geometry. Your GPS module will simply output the
speed.

While you can calculate based on position fixes, it is more accurate for the
GPS to do it. It does not do a simple distance/time calculation but can
instead look at the phase / doppler shift of the GPS signals. This ends up
being much more accurate.

~~~
slicktux
Thanks for the reply; did not think about that and after all that is the
crucial characteristic of what allows GPS to work: now does it depend on the
GPS module? Or can phase and Doppler shift be accesses regardless of the
device?

~~~
dvdbloc
Every consumer GPS receiver I have seen and even some aerospace-grade
receivers that I have (limited) experience with report data over a serial
connection as “NMEA sentences”. You can read about them here:
[https://www.gpsinformation.org/dale/nmea.htm#nmea](https://www.gpsinformation.org/dale/nmea.htm#nmea)
if it’s a USB GPS receiver, it’s likely internally a USB->serial chip with a
GPS receiver communicating over serial. The data that I have seen is always
been high-level focused on navigation such as speed in MPH and heading in
degrees and of course, long and lag. Not to say that you can’t find a device
that reports phase and Doppler shift, this is just how everything I have seen
worked. When GPS receivers started getting cheap when I was a kid, I was very
excited to experiment with them using Arduinos, etc so hope this helps!

~~~
slicktux
Thank you for the information! I will be giving this a read! Can’t wait!

~~~
JensRex
If you want to do anything with GPS modules, some fine and talented people
have done the hard work of interfacing with, and parsing the output of a lot
of different receivers, and called it `gpsd`.

[https://gpsd.gitlab.io/gpsd/index.html](https://gpsd.gitlab.io/gpsd/index.html)

------
jmpman
I want a HUD speedometer for my Model 3. This may be the cheapest solution.

~~~
codazoda
I think a $30 pay as you go phone might be cheaper. Ditch the service and the
GPS should still work fine. Throw on whatever apps and you're good.

------
joshu
Doesn't the raspi eventually shit the SD card if you just drop power?

~~~
gleslie
Hasn’t yet but yeah, I’ve had that issue before with the arcade I built. I
just take an image of the card every significant change.

------
xupybd
Wow that would be so illegal her in NZ. Nice to know some countries give you
the freedom to do stuff like that. Here a spot of rust will take your car off
the road. A broken spedo would never be allowed. Even if replaced with GPS.

~~~
mattlondon
Same in the UK - a broken speedo would be an instant illegal get off of the
road thing. afterall how do you know you are not breaking the speed limits?

I am not sure what you can get away with for DIY replacements - perhaps a
police officer might give you the benefit of the doubt if you were polite and
explained it was temporary while you are waiting for the real part, but I
really suspect this would force your car off of the road at the next annual
safety check/inspection (MOT test in the UK)

~~~
tantalor
> how do you know you are not breaking the speed limits

Drive a safe speed for the given road conditions. Match speed of other
drivers. Not hard to do.

~~~
mattlondon
Often the limit is way lower than the "safe" speed - e.g. the variable speed
limits on motorways restricting you to 40mph on an empty road in perfect
daytime conditions, or the 15mph limit for London - both only exist to manage
traffic flow and/or dissuade people from driving.

You're welcome to match other drivers - enjoy the speeding tickets you'll both
get.

------
samfisher83
You could just used a cheap cell phone and the speedometer app. It would have
been a cheaper option.

~~~
newsclues
Esp32 based project would be more interesting

~~~
willis936
They make esp32 based obd loggers. I have one but I haven’t bothered getting
it to work since the obdlink mx+ works well enough for my data logging
desires.

[https://freematics.com/pages/products/freematics-esprit-
obd-...](https://freematics.com/pages/products/freematics-esprit-obd-kit/)

