GPS for DIY Projects

Your phone boasts a host of quality sensors commonly including

  • Gyro
  • Accelerometer
  • GPS
  • Magnetometer

In this article we will show you how to grab GPS information (Latitude and Longitude) from an Apple or Android phone, and bring it into Arduino – where you can use it in your hobby projects.

Two common routes to incorporate GPS are to spring for a dedicated GPS chip, such as this one:
Use the GPS in your phone, in which case a Bluetooth module can be useful to communicate the data to your Arduino.

If you go for the dedicated GPS chip, it is likely that you will be working with NMEA GPS strings. The best place to start would be here:

GPS is actually a lightweight sensor to add, simply because it does not require as much power as some may assume. It is an elaborate antenna, which passively gathers multiple beams sent from point source satellites. The multiple beams carry information that allow for triangulation in X,Y,Z (Z being altitude).

For this project you will want to acquire:
GPS Bluetooth Module –
The module’s software library for Ardunio –
The mobile app – Adafruit Bluefruit LE Connect
Breadboard and wires
Finally, a copy of our code is available here –

Wire the GPS module to the Arduino as follows
Bluetooth UART -> Ardunio
TX0 -> RX
VIN -> 5V
–Set Bluetooth UART to UART mode
–Setting CTS to ground is the hardware way of establishing a UART pass-through mode
–Note, you can’t program an Arduino via USB, if the RX line is connected to the module, unplug it till after the upload is complete


The GPS Bluetooth Module we use has a physical toggle switch. Switch it to the side that says UART (not the CMD side). Doing this and grounding the CST pin, will turn the module into a UART pass-through device in which strings of characters can be sent from the phone to the TXo pin then to the Arduino, or from the Arduino into the module’s RXi pin and to the mobile app.

Open the mobile app, and make sure it can connect to the module.
Next upload our code into the Arduino – we tested it on an Arduino Uno, but it should work as well on any Arduino that is a 5V device.

Note that the upload will fail if the RX pin is connected (as Arduino’s are programmed on a serial line, even if a USB interfaces with the computer). Remove the RX pin while the Arduino is being programmed, and put it back when you are done.

In the mobile app, select the mode that is called ‘Controller’. Here you will notice you can stream a variety of sensor data, including those types mentioned above. Click on “Location” and allow any permissions pop-ups that appear.

You should now see Latitude, Longitude, and Altitude values on the the phone. If you are wired correctly, and the mobile app is streaming Location data, then the
Bluetooth module should be transmitting GPS data over UART.

In the Arduino IDE, click on “Serial Monitor” from the menu bar. This will show the data coming in. You will need to be on a 9600 baud rate. A faster baud rate is not recommended for Bluetooth, since this protocol can often drop characters.

Note that the controller code here shows other ways of working with data from the app:

You will need to adapt the raw bytes to C data types using Arduino-based functions.

Arduino is a subset of C/C++ but not all functions work, and many have Arduino variations.


Learn more about the module by checking Adafruit’s tutorial:

This code was adapted from the controller example in the library:

I could not get it to work, so I presented the above solution instead.

Best of luck hacking away!!

Leave a Reply

Your email address will not be published. Required fields are marked *