Arduino nano every and adafruit gps module

Hey everyone, I am trying to make a basic gps route logger. I am using a nano every, an adafruit gps module and a sd card module. I want to log the route and save that route on a file on my sd card. That way i can look at the route in google maps after uploading it.

Now the problems that i have are:

  1. The file doesn't get created
  2. The gps coordinates(longitude and latitude) are always empty(or never found)

If anyone knows how to fix it then i would be forever greatfull for you. I will attach the code under this.

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <SD.h>

#define GPS_RX_PIN 0
#define GPS_TX_PIN 1
#define chipSelect 8

TinyGPSPlus gps;
SoftwareSerial gpsSerial(GPS_RX_PIN, GPS_TX_PIN);

void setup() {
  Serial.begin(9600);
  gpsSerial.begin(9600);

  if (!SD.begin(chipSelect)) {
    Serial.println("Initialisatie mislukt!");
    return;
    
    File dataFile = SD.open("GpsData.kml", FILE_WRITE);
  if (!dataFile) {
    Serial.println("Bestand GpsData.kml maken mislukt!");
    return;
  }
  }
  Serial.println("Initialisatie succesvol.");
}

void loop() {
  String stringLatitude = "";
  String stringLongitude = "";

  if (gps.location.isValid()) {
    stringLatitude = String(gps.location.lat(), 6);
    stringLongitude = String(gps.location.lng(), 6);

    File dataFile = SD.open("GpsData.kml", FILE_WRITE);

    if (dataFile) {
      dataFile.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
      dataFile.println("<kml xmlns=\"http://www.opengis.net/kml/2.2\">");
      dataFile.println("<Document>");
      dataFile.println("<Placemark>");
      dataFile.print("<name>");
      dataFile.print("GPS Location");
      dataFile.println("</name>");
      dataFile.println("<Point>");
      dataFile.print("<coordinates>");
      dataFile.print(stringLongitude);
      dataFile.print(",");
      dataFile.print(stringLatitude);
      dataFile.println("</coordinates>");
      dataFile.println("</Point>");
      dataFile.println("</Placemark>");
      dataFile.println("</Document>");
      dataFile.println("</kml>");
      dataFile.close();
    } else {
      Serial.println("Mislukt om bestand te openen");
    }
  } else {
    Serial.println("Locatie: Niet Beschikbaar");
  }

  if (millis() > 300000 && gps.charsProcessed() < 10) {
    Serial.println("Geen GPS gedetecteerd");
    while (true);
  }

  Serial.println("GPS Coördinaten:");
  Serial.print("Latitude: ");
  Serial.println(stringLatitude);
  Serial.print("Longitude: ");
  Serial.println(stringLongitude);
  Serial.println();
 
  delay(1000); 
}

wiring diagram:

components:
gps module - Flora Wearable Ultimate GPS Module : ID 1059 : Adafruit Industries, Unique & fun DIY electronics and kits
sd card module - 3.3V Micro SD card module voor ESP32 | ESP8266 - OTRONIC
If you have any questions let me know!
Thank you in advance <3

Please describe your setup, with links to all the devices and a wiring diagram.

Since the Nano Every is a 5V device and the SD card module is a 3.3V device, bidirectional logic level shifters are required for the connection. Some SD modules have them built in.

have you wired your GPS to pins 0 and 1? Those are the Serial Tx/Rx pins. You can't use them for both.

The Nano Every has a 2nd hardware serial port, Serial1, on pins 0 and 1, don’t use SoftwareSerial.

I do not see where you are feeding data from the GPS into TinyGPS anywhere in the code.

2 Likes

I updated it with the diagram and components, I have an output of 3.3V with my arduino so that shouldn't be a problem.

Yes i have wired my RX to pin 1 and TX to pin 0.

You need to fix the two very serious problems identified in post #4, and possibly others.

I recommend to start with just the GPS module and the basic TinyGPS++ example code, changing SoftwareSerial to Serial1. After that is working, add the SD card and code.

You will need to test the setup while outdoors, with a clear view of the sky, for the GPS module to obtain a satellite fix.

While you may have a 3.3V voltage output, the signal levels from the Nano Every are still 5V.

The uSD card adapter you've linked to is designed for a 3.3V processor. It does not include level shifting for the signal lines. Your uSD card is not 5V tolerant.

And according to your GPS' datasheet, the inputs on that aren't 5V tolerant either.

So as it turns out, yes, hooking 3.3V peripherals directly up to a 5V board without using any level shifting is a problem.

Indeed. The title on the product page says so in bold type.

The SD card module may have already been destroyed by connecting to the Nano Every. Possibly also the GPS module.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.