🛠 Ajouter un deuxième port série avec SoftwareSerial (GPS sur broches 10/11)

Arduino Duemilanove — Board Fiche · intermediaire · Schéma : IMG-duemilanove-intermediaire-1-gps-softwareserial.svg — module GPS TTL alimenté en 5 V relié à l'Arduino Duemilanove sur broches 10 (RX) et 11 (TX) en croix, puce FTDI occupant déjà les broches 0/1, mention « un seul UART matériel, occupé par l'USB ».

Objectives

The Duemilanove has only one hardware UART (pins 0/1), and it is already occupied by the FTDI USB-to-serial bridge. The official page states this explicitly: "the SoftwareSerial library allows serial communication on any digital pin." You will connect a GPS to pins 10/11 and create a bidirectional serial bridge between the GPS and the USB monitor — the technique that has allowed generations of GPS/GSM/MP3 projects to live on AVR.

Hardware

Complete code

// Pont moniteur USB <-> GPS sur SoftwareSerial (RX=10, TX=11)
#include <SoftwareSerial.h>

SoftwareSerial gps(10, 11);   // RX, TX

void setup {
  Serial.begin(9600);         // USB (FTDI)
  gps.begin(4800);            // NEO-6M par defaut : 4800
  Serial.println("Pont GPS actif — attendez le fix");
}

void loop {
  if (gps.available) Serial.write(gps.read);   // GPS -> moniteur
  if (Serial.available) gps.write(Serial.read); // moniteur -> GPS
}

Expected verification

The serial monitor (9600) displays NMEA sentences $GPGGA, $GPRMC… as soon as the GPS acquires a signal (a few minutes for a cold start, near a window). Sending a UBX command or a valid sentence from the monitor forwards it to the GPS. The GPS status LED blinks every second.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials