GPS arduino speedo trip meter

Im having trouble finding a sketch for a simple GPS speedo with trip and Max. mileage

can anyone help please

cheers
Brett

void setup()
{
}
void loop()
{
}

You just need to fill in the blanks.

(Code isn’t found, it is written)

I wish there wasnt so many smart people on here . every time i come here a get the same answers
it doesnt help

Perhaps you need to try a different approach then. :grinning:

For example, read the instructions for posting.

Just sayin’

GPS devices typically produce NMEA sentences.
There’s a useful Google search term.

I wish there weren’t so many lazy people on here.

The neighbour came over the other day and said "Brett" can you help me slash my paddock,
I said sure and helped the guy

I never said to him" you should learn how to drive a tractor'
the same stuff goes on here,
the coders expect you to know how to code,
these answers ive read everywhere on this form
I would not have asked here as but search for two days now

We didn’t know you can drive a tractor.

Can you write code?

Because, if you can’t and you find some code on, say, Instructablea, and can’t get it to work, you won’t go to Instructables for help, you’ll come here.

Ok thats funny.....give me a minute and I will find and post something that you can play with ,
while I finish mowing the paddock next door

What hardware have You got? No code on earth will do any good without circuitry.
I can give away the code for my speedometer but You still have to modify it yourself.

this code has the speed (awesome)
but it has height and would like resettable trip in kilometre
and also total none resettable distance in kilometers (but able to enter i start figure say 100,000)
and it has gps which is fine

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>

static const int RXPin = 3, TXPin = 4; //GPS communication
static const uint32_t GPSBaud = 9600;

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET); //Connection to I2C SCL and SDA!

TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);

int maxspeed = 0, speed1 = 0;
int maxhigh = 0, high1 = 0;
int maxsatelite = 0, satelite1 = 0;
void setup()
{

  Wire.begin();
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);// initialize with the I2C addr 0x3C (for the 128x32)(initializing the display)

  ss.begin(GPSBaud);

  

  
    display.clearDisplay();
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0, 0);
    display.print("GPS Speed Tracker ");
    display.setCursor(0, 10);
    display.print("NICHSEN 04'2019");
    display.setCursor(0, 20);
    display.print("Start Up: ");
    display.display(); //show
    delay(4000); 
  
  
  display.setCursor(0, 0);
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.print("Geschwindigkeiten");
  display.setCursor(0, 10);
  display.print("Hoehe (Meter)");
  display.setCursor(0, 20);
  display.print("Satelliten");
  display.display(); // Important!
  delay(7000);
}

void loop()
{
	satelite1 = (abs(gps.satellites.value()));
	while (satelite1<3){
	display.clearDisplay();
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0, 0);
    display.print("GPS Signal...");
    display.setCursor(0, 10);
    display.print("wird gesucht !");
    display.setCursor(0, 20);
    display.print("Anzahl Sat.: ");
	display.print(satelite1);
    display.display(); //show
    delay(1000);
	satelite1 = (abs(gps.satellites.value()));
	}
	
	
	
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.print("km/h ");
  display.print(abs(gps.speed.kmph()));
  display.print("  ");
  speed1 = (abs(gps.speed.kmph()));
  if ( speed1 > maxspeed) {
    maxspeed = speed1;
  }
  display.print("  ");
  display.print(maxspeed);

  display.setCursor(0, 10);
  display.print("h(m) ");
  display.print(abs(gps.altitude.meters()));
  display.print("  ");
  high1 = (abs(gps.altitude.meters()));
  if ( high1 > maxhigh) {
    maxhigh = high1;
  }
  display.print("  ");
  display.print(maxhigh);


  display.setCursor(0, 20);
  display.print("Sat: ");
  display.print(satelite1);
  satelite1 = (abs(gps.satellites.value()));
  if ( satelite1 > maxsatelite) {
    maxsatelite = satelite1;
  }
  display.print("    ");
  display.print(maxsatelite);

  
  display.display();
  smartDelay(800);

  //if (millis() > 5000 && gps.charsProcessed() < 10)
   // display.setCursor(0, 0);
  //lcd.print("Sat.   ERROR");
}

// This custom version of delay() ensures that the gps object
// is being "fed".
static void smartDelay(unsigned long ms)
{
  unsigned long start = millis();
  do
  {
    while (ss.available())
      gps.encode(ss.read());
  } while (millis() - start < ms);
}

Oh I have nano , pro mini
and nokia 5110 LCD which would be Awesome if possible (or SSD1306 0.96)
and 6,7 and 8m gps

Greetings.

TinyGPS++ has the ability to let you know the distance from point A to point B. Say, you update your GPS info once a milliSecond. Using the ToDistance calculator you can use the Previous location and the CurrentLocation to get the distance from Point A to point B. Now that you got the distance and your updating at 1 time a milliSecond you can figure out rate of travel. Well, that's how I am doing it and it works quite well.

this is just some code i found as a starting point,
I dont have a tinygps++ and my 8M does not seem to work with this circuit
Oh plus I dont no how to code.....only drive tractors sorry
thanks for the input tho

Idahowalker:
Greetings.

TinyGPS++ has the ability to let you know the distance from point A to point B. Say, you update your GPS info once a milliSecond.

{cough}100ms{cough}

buzzliteyear:
dont have a tinygps++

You could download it in the time it takes to turn the ignition key on your tractor.

oh yes i added that library it complied and ran
but my 8M neo or 7m does not seem to make the code run, not Sats
does the tinygps++ still output the same data as the 8M

buzzliteyear:
oh yes i added that library it complied and ran
but my 8M neo or 7m does not seem to make the code run, not Sats
does the tinygps++ still output the same data as the 8M

I do not know.

I use a Ultimate GPS with an ESP32 under freeRTOS, all works well for me.
This may be of help:

void fCalDistance()
{
  // if (digitalRead(StartStopDistanceCounterPin) == 0)
  // {
  // if previous is zero then seed
  if ( lGPS_Lat0 == 0 )
  {
    lGPS_Lat0 = fDegreeToDecimal( GPS.latitudeDegrees );
    lGPS_Lon0  = fDegreeToDecimal( GPS.longitudeDegrees );
  }
  long tempLat = fDegreeToDecimal( GPS.latitudeDegrees );
  long tempLon = fDegreeToDecimal( GPS.longitudeDegrees );
  //
  //add new distance to previous distance, meters to mile* 0.00062137
  floatDistance = floatDistance + ( DistanceBetween(lGPS_Lat0, lGPS_Lon0, tempLat, tempLon) * 0.00062137 );
  //reset to last used measuring point
  lGPS_Lat0 = tempLat;
  lGPS_Lon0 = tempLon;
  // }
}// end void fCalDistance()
unsigned int CosFix (long angle)
{
  long u = labs(angle) >> 16;
  u = (u * u * 6086) >> 24;
  return 246 - u;
} // unsigned int CosFix (long angle)
long Diff (long deg1, long deg2)
{
  long result = deg2 - deg1;
  if (result > 180 * DEGREE) return result - 360 * DEGREE;
  else if (result < -180 * DEGREE) return result + 360 * DEGREE;
  else return result;
} // long Diff (long deg1, long deg2)
//calculates distance between 2 points . using lat/lon. ignores earth curve, valid for distances of several 100K, returns meters
//www.technoblogy.com/show?LNQ
unsigned int DistanceBetween (long lat1, long long1, long lat2, long long2)
{
  long dx = (Diff(long2, long1) * CosFix((lat1 + lat2) / 2)) / 256;
  long dy = Diff(lat2, lat1);
  unsigned long adx = labs(dx);
  unsigned long ady = labs(dy);
  unsigned long b = max(adx, ady);
  unsigned long a = min(adx, ady);
  if (b == 0) return 0;
  return 95 * (b + (110 * a / b * a + 128) / 256) / 512;
} // unsigned int DistanceBetween (long lat1, long long1, long lat2, long long2)
long fDegreeToDecimal(long floatDegree)
{
  return floatDegree  * 60 * 10000;
} // long fDegreeToDecimal(long floatDegree)

Hello Buzz.

Your project has so many components that all have to work I feel you will have a constant struggle and might not achieve your goal.

Taking the tractor analogy, this is akin to not just borrowing the neighbour's machine, but asking the neighbour to instruct you on how to build a tractor.

It's feasible to buy a tractor kit (with instructions) and seek tips from others who have assembled an identical kit. But say you have a old Fergie chassis from the top paddock, an IH diesel motor off your Dad's old truck, an ISUZU transmission from back of the shed and a heap of hydraulic parts from the wrecker's yard. Then ask others for the "code" to put it all together to become a working tractor.

The idea of a GPS speedo kit is also feasible, including the code to run it. This cud be assembled and coded without having a deep understanding of any component. But nobody will have a sketch that works for your collection of parts without editing. So many things have to be right -- not half-right or mostly right, but right.

GPS is a fascinating technology. It's not really hard to make it work, but you must understand the basics. Does walking before running make sense?

You also have to be exact and thorough in describing your parts. For example, "6 7 & 8 M GPS" isn't enuf. You need to fully describe the parts. Photos are a great help.

Good luck,
John.

John I dont need luck on this forum mate....... I did not think three components were that much.
id have better luck fitted my OM662 to my hyundai terracan and fitting a HX35 turbo and some 7mm elements from a ford transit diesel than get help here...and its not because you guys and so up yourself with your answers Heck no

"Entitlement" comes to mind. :roll_eyes: