Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

NEO-6M GPS with Arduino Nano — position and IST time over SoftwareSerial

Connect a NEO-6M GPS module to an Arduino Nano with SoftwareSerial on D4/D3, parse it with TinyGPSPlus and print latitude, longitude, satellites and IST.

Arduino C++Verified — core avr 1.8.8, TinyGPSPlus 1.0.3, 3 Nov 2026Compile-only

Community draft — report a mistake

The NEO-6M is the GPS module in vehicle trackers, drone projects and school “where am I” builds. It streams NMEA text at 9600 baud; the TinyGPSPlus library turns that into latitude, longitude and time.

On the Nano the module’s TX goes to D4, read with SoftwareSerial. The GPS RX is optional; if you wire it, use a divider because the module is 3.3 V logic. The sketch prints a line every two seconds, including Indian Standard Time.

Wiring

Arduino NanoOnly the pins used are shown · 5 V logicNEO-6M GPS module (GY-NEO6MV2)1k│2k5VGNDD4D3VCCRXTXGND
Also needed: 1 kΩ + 2 kΩ resistors (only if you wire GPS RX).
Every connection
Arduino NanoNEO-6M GPS module (GY-NEO6MV2)WireNotes
5VVCCredThe module has its own 3.3 V regulator.
D3RXyellowVia 1 kΩ / 2 kΩ divider — Optional — only needed to send configuration commands.
D4TXgreenGPS TX (3.3 V) into SoftwareSerial RX — read fine by the Nano.
GNDGNDblack

3.3–5 V (on-board 3.3 V regulator) part, 5 V board. The module’s TX is a 3.3 V signal, which every board reads fine. Its RX pin is 3.3 V logic: from a 5 V Arduino TX, add a 1 kΩ / 2 kΩ divider. You only need RX if your sketch sends configuration commands.

Board quirks

  • The Nano’s hardware serial (RX0/TX1) is taken by USB, so the GPS uses SoftwareSerial at 9600 baud. Don’t print long lines while NMEA arrives, or SoftwareSerial loses characters.
  • First fix (cold start) takes 30 s to several minutes, and only with sky in view. Indoors you will usually see “no fix”.
  • The blue LED on the module blinks once a second when it has a fix; steady or off means still searching.
  • GPS time is UTC; the sketch adds 5 h 30 min for IST. The date also changes at 05:30 IST, which the simple sketch ignores.
  • The coin cell (or super-cap) on the module keeps almanac data so the next fix is faster. If it is flat, every start is a cold start.

Code

gps-nano.inoArduino C++Open in PlaygroundOpen in PlaygroundFlash
// NEO-6M GPS on an Arduino Nano via SoftwareSerial, printing position, satellites and IST time.
// GPS TX → D4 (Nano RX), GPS RX ← D3 through a 1 kΩ / 2 kΩ divider, VCC → 5V, GND → GND.
#include <SoftwareSerial.h>
#include <TinyGPSPlus.h>

SoftwareSerial gpsSerial(4, 3);  // RX, TX
TinyGPSPlus gps;

void setup() {
  Serial.begin(115200);
  gpsSerial.begin(9600);  // NEO-6M default
  Serial.println(F("Waiting for a fix - take the antenna outdoors or near a window"));
}

void printIst() {
  if (!gps.time.isValid()) return;
  int minutes = gps.time.hour() * 60 + gps.time.minute() + 330;  // UTC + 5:30
  minutes %= 1440;
  char buf[12];
  snprintf(buf, sizeof(buf), "%02d:%02d:%02d", minutes / 60, minutes % 60, gps.time.second());
  Serial.print(F("  IST "));
  Serial.print(buf);
}

void loop() {
  while (gpsSerial.available()) gps.encode(gpsSerial.read());

  static unsigned long last = 0;
  if (millis() - last < 2000) return;
  last = millis();

  if (gps.charsProcessed() < 10) {
    Serial.println(F("No data from GPS - check TX -> D4 and 9600 baud"));
    return;
  }
  Serial.print(F("Sats: "));
  Serial.print(gps.satellites.isValid() ? (int)gps.satellites.value() : 0);
  if (gps.location.isValid()) {
    Serial.print(F("  Lat: "));
    Serial.print(gps.location.lat(), 6);
    Serial.print(F("  Lng: "));
    Serial.print(gps.location.lng(), 6);
  } else {
    Serial.print(F("  (no fix yet)"));
  }
  printIst();
  Serial.println();
}

Library: TinyGPSPlus (Mikal Hart) — compiled with TinyGPSPlus 1.0.3.

Expected serial output

Serial Monitor · 115200Output
Waiting for a fix - take the antenna outdoors or near a window
Sats: 0  (no fix yet)  IST 14:31:05
Sats: 7  Lat: 12.971599  Lng: 77.594566  IST 14:33:19

Common errors

No data from GPS

GPS TX not on D4, or the module is at a different baud rate (some are 38400). Full fix.

Data arrives but never a fix

Indoors or under a metal roof. Take it outside for 5 minutes. Full fix.

↑↓ to move · Enter to open