So this project started because of a need and because of a wanted.
The need was getting two speeding tickets in a row because stock analog speedometer was drifting as much as 10 MPH off of true speed.
The want was because Adafruit had a really cool LED display and GPS breakout board that I wanted to play with. The two meet in the middle and so we have the GPS-Speedometer!
Parts:
Adafruit Ultimate GPS Breakout – 66 channel w/10 Hz updates – Version 3
Adafruit 1.2″ 4-Digit 7-Segment Display w/I2C Backpack – Green
Arduino Pro Mini 328 – 5V/16 MHz
UBEC DC/DC Step-Down (Buck) Converter – 5V @ 3A output
Construction:
The frame of the unit is built completely out of scrap wood I had laying around my wood shop. The front panel is build out of some thin 1/8 inch (3.175mm) think pine board and the supports are built out of some 2″x.5″ (50.8mmx12.7mm) slats from a shipping pallet. I custom shaped the bottom of the front panel to match the curve of my dash using a drum sander, this by far was the toughest bit.
I place the Large LED display in the middle to make it easy to see, I also placed a voltmeter I got from MPJA off to the side because I was having issues with the stock voltmeter.
I cut the holes for display and voltmeter using a hand scroll saw, you could use a jig saw or anything with a small wood cutting blade. Just make sure to mark the holes well, Drill small holes in the corners, and keep things square.
I also rounded the bottom of the supports with the drum sander to match the curve of the dash in that direction as well. The supports where attached to the back of the front panel with a bit of hot glue, Hot glue also attached the LED display to the front panel. I did this to start because I wanted to be able to move things if needed, but it has proven to hold quite well for the 3 months it’s been in service thus far.
I also attached the DC to DC converter, Arduino, and GPS to the back supports with hot glue but sadly the GPS is the only one that is still in place. I think this is because the bottoms of the power supply and PIC board is not smooth.
*Note: I’m using my Arduino 256Mega in this pictures as a test, the pro-mini 328 replaced it later on.*
I used some bits of scrap wire and connectors from old PCs that I had scraped for the connections to the header pins on all the boards. The main power connections to the truck’s 12VDC system was via an Anderson power-pole because these are the default connections I use for all of my 12VDC systems.
I affixed the unit to the dash using a bit of RTVS(Room Temperature vulcanizing Silicon, AKA silicon sealant) and let it cure over night. This has worked well and if I need to ever remove the unit form the has it will clean up nicely with a bit of 90% alcohol.
Code:
I based the code for this project off of the example code provided by Adafruit for their Learn post about this GPS unit. I think the original base code I used was for the GPS clock, but I didn’t keep good track of things so I don’t quite remember. The bits that I customized were for the LED display and the refresh rate on the GPS. I set one of the dots in the LED display to turn on when there was a GPS fix, this was important to me because the speed indicated by the unit would not be accurate unless there was a GPS fix. The other bit was to make sure the refresh rate on the unit was set to 1Hz, I found the update rate was far too slow while driving if it was anything slower than this. Even at 1Hz the refresh rate is a bit slow if your punching it, but the good thing about that is it keeps me from punching it too often.
Below is a copy of the code:
//This code is based on the Adafruit example code LED 7-Seg Display and the Adafruit GPS Breakout board for setting up a GPS clock. //Modified by Jeremiah Puhek. //For more info on this code and the build please go to https://kd7dmp.net/projects // Designed specifically to work with the Adafruit LED 7-Segment backpacks // and ultimate GPS breakout/shield: // ----> http://www.adafruit.com/products/881 // ----> http://www.adafruit.com/products/880 // ----> http://www.adafruit.com/products/879 // ----> http://www.adafruit.com/products/878 // ----> http://www.adafruit.com/products/746 // // Adafruit invests time and resources providing this open source code, // please support Adafruit and open-source hardware by purchasing // products from Adafruit! // // Written by Tony DiCola for Adafruit Industries. // Released under a MIT license: https://opensource.org/licenses/MIT #include <SoftwareSerial.h> #include <Wire.h> #include <Adafruit_LEDBackpack.h> #include <Adafruit_GFX.h> #include <Adafruit_GPS.h> // I2C address of the display. Stick with the default address of 0x70 // unless you've changed the address jumpers on the back of the display. #define DISPLAY_ADDRESS 0x70 // Create display and GPS objects. These are global variables that // can be accessed from both the setup and loop function below. Adafruit_7segment speedDisplay = Adafruit_7segment(); //HardwareSerial gpsSerial = Serial1; SoftwareSerial gpsSerial(2, 3); // GPS breakout/shield will use a // software serial connection with // TX = pin 8 and RX = pin 7. Adafruit_GPS gps(&gpsSerial); void setup() { // Setup function runs once at startup to initialize the display and GPS. // Setup Serial port to print debug output. //Serial.begin(115200); //Serial.println("Clock starting!"); // Setup the display. speedDisplay.begin(DISPLAY_ADDRESS); // Setup the GPS using a 9600 baud connection (the default for most // GPS modules). gps.begin(9600); // Configure GPS to only output minimum data (location, time, fix). gps.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY); // Use a 1 hz, once a second, update rate. gps.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ); // Enable the interrupt to parse GPS data. enableGPSInterrupt(); //Set Brightness on Display to deal with the Bright sun while driving. speedDisplay.setBrightness(15); } void loop() { // Check if GPS has new data and parse it. if (gps.newNMEAreceived()) { gps.parse(gps.lastNMEA()); } //check to see if there is a GPS Fix, if so Light up the right hand Dot. if (gps.fix) { speedDisplay.writeDigitNum(2, 0x12); speedDisplay.writeDisplay(); } //Take our speed and convert to Miles Per Hour and write to display int indicatedSpeed = gps.speed*1.151; speedDisplay.print(indicatedSpeed, DEC); speedDisplay.writeDisplay(); } SIGNAL(TIMER0_COMPA_vect) { // Use a timer interrupt once a millisecond to check for new GPS data. // This piggybacks on Arduino's internal clock timer for the millis() // function. gps.read(); } void enableGPSInterrupt() { // Function to enable the timer interrupt that will parse GPS data. // Timer0 is already used for millis() - we'll just interrupt somewhere // in the middle and call the "Compare A" function above OCR0A = 0xAF; TIMSK0 |= _BV(OCIE0A); }
In the real world:
This unit has been in use for about 3 months now, and has been to well over half a dozen rough mountain top radio sites. I ended up putting some sun shields around the speed display and putting a bit of polarized plastic lens from an old server cabinet over the speed display because it was washing out in the bright sun. The biggest help was the polarized lens, but in direct sun it still washes out.
I am still trying to find a good adhesive for the PIC board and Power supply board, RTVS will cause PCB to corrode if it comes in contact because of the gases it releases while curing. I may just try putting a smooth backing on them and using hot glue again.
The unit came in even more use when the stock speedometer failed all together about 2 weeks ago. The gear that drives the interface gear to the speedometer in the transmission has failed on me. (I’m guessing due to ware.) So this unit has made this failure no big deal. I will be adding an Odometer to this unit soon, as when I lost the stock speedometer I lost the Odometer as well. So there will be a post about that.
I would say over all it has been a great help, it’s easier to see then the stock unit, more accurate than the stock unit, and I haven’t gotten a single speeding ticket after I started using it.
Leave a Reply