Interfacing BlueNext GPS with arduino issues

I took apart my BlueNext BN909GR GPS and noticed it had serial contacts for the GPS, I connected these up but using example code from libelium and changing the baud rate to suit my GPS it kind of works…

Here is my code:


  *  Copyright (C) 2008 Libelium Comunicaciones Distribuidas S.L.


  *  This program is free software: you can redistribute it and/or modify

  *  it under the terms of the GNU General Public License as published by

  *  the Free Software Foundation, either version 3 of the License, or

  *  (at your option) any later version.


  *  This program is distributed in the hope that it will be useful,

  *  but WITHOUT ANY WARRANTY; without even the implied warranty of


  *  GNU General Public License for more details.


  *  You should have received a copy of the GNU General Public License

  *  along with this program.  If not, see <>.


  *  Version 0.1

  *  Author: Marcos Yarza <m.yarza [at] libelium [dot] com>


// include the SoftwareSerial library

#include <SoftwareSerial.h>

// Constants

#define rxPin 9

#define txPin 8

// set up the serial port

SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);

// variables

byte byteGPS = 0;

int i = 0;

int indices[13];

int cont = 0;

int conta = 0;

char inBuffer[300] = "";

int k = 0;

void setup(){

  //setup for mySerial port

  pinMode(rxPin, INPUT);

  pinMode(txPin, OUTPUT);



  //setup for Serial port


  // setup the GPS module

  Serial.println("Configuring GPS...");


  mySerial.println("$PSTMNMEACONFIG,0,4800,1,1");        // configure NMEA sentences to show only GGA                                                                                                                                                                                                                                 




  // command for setting time and position


  // "4140.000,N" means: Latitude 41º40'00.0" North

  // "00053.000,W" means: Longitude 0º53'00.0" West

  // "0197" means 197 m elevation

  // "22,10,2007,11,40,00" means date and time (October 22, 2.007 - 11h 40min 00sec UTC time)


void loop(){


  byteGPS = 0;

  i = 0;

  while(byteGPS != 42){                   // read the GGA sentence

    byteGPS =;         





  k = 1;

  while(inBuffer[k] != 42){

    Serial.print(inBuffer[k]);            // write the GGA sentence






But this is what I get out of it:

Configuring GPS…
;? c?Íi?Y3&kÍ?,28,21,08,24,3.0,1®4,2.7


(Positions have been changed to not show people where I live…)

As you can see, it messes up the received data and I’m not sure why. Obviously the GPS is different to the one this code was intended for so things have to be changed but what have I missed? There is also a bs pin on my GPS which I have not connected up - should I have? What does it do?


I would start with just outputting the character from the GPS directly to the serial:

  char c;
  if (mySerial.available()) {
    c =;
    Serial.print(c, BYTE);

If you aren't sure that the commands for the GPS settings are correct, then I'd leave them out. The GPS should send some data by default without any setup.

You may have already done this, but you might try changing the baud on the softserial and see what that gets you. I'd try 4800 just to see, since you are sending a "4800" command in the config string.

One other note: in the "read" portion of the loop, you are adding to the buffer array starting from position 0 (variable i) and in the "write" portion of the loop you are writing from position 1 (variable k).

Hope this helps some Rob

Ok, I didn't realise that I was sending 4800 command, I hadn't noticed that...

The GPS is 9600 so I will change the command I am sending and try just getting data from the GPS directly later today.

Thanks for the idea...


Ok, I tried it with just sending receiving the data and not sending anything and everything came through fine.

I then just removed the send command and it made no difference so I presume it is something to do with this bit:

void loop(){

byteGPS = 0;

i = 0;

while(byteGPS != 42){ // read the GGA sentence

byteGPS =;

inBuffer*=byteGPS;* * i++;* * }* * k = 1;* * while(inBuffer[k] != 42){* * Serial.print(inBuffer[k]); // write the GGA sentence* * k++;* * }* * Serial.println();* * delay(1000);* } [/quote] Anyway at least I know it works now, Thanks for the help, Mowcius

The code that is outputted from the GPS includes everything under the sun from amount of satellites to the position. I would like to receive both of these but just as numbers and not with all the GPRMC bla bla bla...

I would like to send the data to an lcd display and possibly store it on a microsd card as a csv document but I don't know what to send to the GPS... Is there any way I can just isolate it when it comes to the arduino...

Anyone understand me/got any ideas


The output is in the NMEA Sentence format, which is pretty much the standard. You can read more about them here Welcome -

If you can find the documentation on the GPS model, you can send a config string to it and turn off some of the data, but you are still going to get a single NMEA sentence at a minimum.

Ladyada’s test parsing sketch here GPS datalogging shield for Arduino takes that sentence and converts it into more readable data.

The TinyGPS TinyGPS | Arduiniana library also returns more readable data from a NMEA Sentence.

I have code to parse two of the sentences (GGA and RMC) and and write to the LCD, but I won’t be able to post it till later tonight. For the most part I reworked code from the parsing sketch I linked above.

Ok, if you could post your lcd code it would be a great help... I have just got the 20x4 serial display from sparkfun...

I am having a look through that code and when I get time I will have a go at modifying the tinygps software...


I have added a sample app that reads the gps, parses the sentence, and displays on the LCD. The code is too large to paste into a post, so I have zipped it up here:

I have a 2*16 lcd, but changed the code to display on 4 lines. You'll have to add your lcd pins, setup the serial, etc, but you should be able to get up and running easily.

Most of the code has been put together from samples, so may not be optimal yet, but it should work. Also note that it doesn't use the TinyGPS library.