GPSNet library for Arduino

This is the Arduino GPSNet library. GPSNet is an Arduino library and example sketch that provides a radio broadcast mesh network among a number of GPS+RFM22 radio equipped nodes, such that all nodes in the network know the GPS position of all other nodes.

This is intended to help organisations that need visibility of the location of a number of independent mobile units (people, vehicles etc), such as might be used by emergency services, cooperating fishing vessels etc.

The provided sample sketch works with any serial GPS receiver and RF22 data radio transceivers on the 433MHz ISR band.

The version of the package that this documentation refers to can be downloaded from You can find the latest version at


GPSnet forms a loosly connected radio mesh network based on broadcast data messages. The main principles of operation are:


This means that every node will eventually receive the position of all the other nodes it can hear (either directly or indirectly). The latest position of each node will propagate through the entire connected network (irrespective of the network topology), giving the most widespread possible knowledge of the entire fleet to every node, along with the age of the data.

Every node can be a source of information about the entire fleet to a locally connected PC (or maybe locally connected smartphone devices etc).

One could conceive of a gateway node that sends data about all other nodes out on an internet connection for more widespread visibility of node positions, say to a remote command post etc.

Note that each node has no specific routing or connectivity knowledge, and each node has no idea if or how well it is connected to the rest of the network or even if it is connected at all. So if a node goes out of range of all the others, it wont 'know' that until its data gets stale.

Caution: There are performance limitations:

Each message (with ID, timestamp, GPS position, altitude, course, speed etc) is 27 octets of payload data. At 2000 bps this is a maximum possible air rate of only 8 messages per second, and perhaps, realistically (after accounting for collisions etc) 5 per second. This means that if there are many nodes within radio listening range of each other, each node has to severely throttle its broadcast rate. (On the plus side, if there are many nodes near each other the need to rebroadcast positions is less important, so maybe it balances out, since the nodes throttle their broadcast rate based on how busy the channel is)

Operation depends on each node being within range of at least one other node, which may be difficult with low power radios in wooded or hilly terrain. Similarly with GPS reception which can be poor in heavily wooded areas.

Software organisation

The example sketch requires the following additional software components:

GPSNet is the main class. It is responsible for holding GPS reports, and transmitting periodic updates to other nodes. GPSNet class is generic in the sense it can be made to work with any type of GPS receiver and and type of radio transceiver. The example sketch provides the glue between GPSNet and the GPS and Radio.

The example sketch uses TinyGPS to receive and decode NMEA sentences from the GPS receiver, and to give GPS reports of the position of the local node to GPSNet. It also uses RF22 to receive broadcast reports from other nodes and also give them to GPSNet.

Periodically, GPSNet use an external callback function in the sketch to broadcast a report to other nodes using RF22.

How to connect up your hardware

The supplied sketch works with an Arduino Mega. Mega is required for:

The default configuration of the sketch is for

Serial1 (Arduino RX1 pin D19 hardware serial port) is connected to the TX pin of the GPS. GPS is configured for 4800 baud 8N1 (though this can be changed by editing the sketch.

Serial (Arduino pins D0 and D1 hardware serial) is connected (as is usual) to the standard Arduino USB-Serial port. Configuration commands can be sent to and position updates can be received from the Arduino over this USB-Serial connection. See below.

Pins D2, D50, D51, D52, D53 connected to the RF22 transceiver as described in the documentation of the Arduino RF22 library.

Caution: IO level shifters are required between the Arduino and the RF22 to accommodate the 3.3V RF22 module.

This software is Copyright (C) 2011 Mike McCauley. Use is subject to license conditions. The main licensing options available are GPL V2 or Commercial:


This is a simple Qt program that displays all the node positions received by a GPSNet node on a Google Map. Download from

Sample screenshot at

Requires Qt, QtCreator and the qextserialport library from Runs on Windows, Linux and Mac. After building the program with something like:

* tar zxvf gpsnetviewer1.0.tar.gz
* cd gpsnetviewer1.0
* qmake
* make
* Connect an arduino running the gpsnet.ino sketch to your host
* then run it with
* ./qpsnetviewer
* Select File->Configure
* choose the serial port the Arduino gpsnet.ino sketch is connected to
* OK.
* See the "GPSNet Connected" go green, the received nodes shown in the right hand list and plottted
* on the map. Select 'Follow Me' to centre the map on postion of the conencted GPSNet node.
Open Source Licensing GPL V2

This is the appropriate option if you want to share the source code of your application with everyone you distribute it to, and you also want to give them the right to share who uses it. If you wish to use this software under Open Source Licensing, you must contribute all your source code to the open source community in accordance with the GPL Version 2 when your application is distributed. See

Commercial Licensing

This is the appropriate option if you are creating proprietary applications and you are not prepared to distribute and share the source code of your application. Contact for details.

Revision History
1.0 Initial release
1.1 Added README and Doxygen documentation of all classes
1.2 LICENSE and first public release
1.3 Improvements to example sketch serial interface to make it easier to parse outputs: prints "\nGPSNet\n" when it starts; All node reports are preficed by "Report:"
1.4 Added GPSNetViewer description and instructions
1.5 Fixed broken link to distribution
1.6 Fixed broken link to distribution