RAW NMEA sentences from UART to SPI

Hi Guys!

I want to use external wireless GPS reciever for my mobile phone.

I have NEO M8N GPS receiver connected to an Arduino's UART port.
It send NMEA sentences once pert every second (1Hz)
After i get a valid NMEA sentence, then i want to send it trough NFR24L on SPI port.

How can i "tunnel" it? I want to send the same NMEA sentence without modification trough SPI, that i get from UART. Is this possible?

I already did it with 433Mhz TTL module. In this case i used simple SerialPasstrough, and its worked fine. But when i used 433Mhz, then there is no secured connection, two 433mhz modul can interference each other. So i need to swith to 2,4 Ghz (NRF24L), but in this case SerialPasstrough not working. (UART to SPI)

Why do you want to use an NFR24L ? How will that connect to the mobile phone ?

What you suggest is possible through Bluetooth, just connect the GPS output up to a HC05\HC06 and the mobile should be able to pick it up with something like Blueterm on the mobile.

The reason: i want min. 300-400m wireless communication.
The far side i will have the GPS Neo-M8n + Arduino + NRF24L, on the other side it will be an NRF24L + Arduino + BT module HC05 + Mobile

I have noticed you have updated the first post to add information on using 433Mhz. Your probably just using the wrong radio modules, for sure it can work on 433Mhz at distances of hundreads of km.

When you say 'i want min. 300-400m wireless communication' that on its own means very little, what is critical is where that 300-400m actually is, the environment, whats between TX and RX etc.

A radio system capable of 300-400m in an urban area at ground level might be good for 400km with good line of sight between transmitter and receiver.

I will use it only with good line of sight. Never will be used in urban enviroment.

433Mhz will be great, but with this i cannot "bind" the devices to each other. If i used 4-5 piece from it, then the messages will interference each other. Thats why i want to use 2,4Ghz. With NRF24L i can use addresses.

So there is any way to store and forward incoming NMEA senteces from UART to SPI?

So there is any way to store and forward incoming NMEA senteces from UART to SPI?

Thats the wrong question really. You could read a byte from the GPS and send each byte across the SPI interface but that would not make the NRF24L transmit.

Radio devices such as the NRF24L send packets of data, as in a sequence of bytes. You thus need to send the NMEA sentence as a packet or series of packets. There are libraries for the NRF24L that provide functions to send packets. Your Arduino sketch does not have to deal with SPI directly.

Maybe i will be newbie, but i need to store the whole incoming NMEA senteces into a variable/array, then i need to send that data out on NRF24L? Is this possible?

I think the mobile GPS application need only one line from the whole NMEA sentence... maybe a most common one like $GPRMC?

So i need to extract only that NMEA line. But how put this long nmea sentence into a single data variabla? or array?

something like this you mean?

(compiles, NOT tested!)

//Include Libraries
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <SoftwareSerial.h>

//create an RF24 object
RF24 radio(9, 8);  // CE, CSN

// Creat software serial object. GPS module connected here
SoftwareSerial NeoGPS(4, 3); //RX, TX

//address through which two modules communicate.
const byte address[6] = "00001";

void setup()

  //set the address

  //Set module as transmitter

  //Initialise Serial Monitor baudrate

  //Initialise software serial baudrate
void loop()

  if (NeoGPS.available() > 0) {
    // get the byte data from the GPS
    char gpsData = NeoGPS.read();

    //Print value to serial Monitor

    //Send value to receiver
    radio.write(&gpsData, sizeof(gpsData));

I let you write the NRF24 receiver code... :wink:

hope that helps....


Looks good!!! I will try it...
I will replay as i tested.

Thank you!

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