Send GPS data over BLE nordic NRF8001


  • Newbie
  • *
    • Posts: 4
    • View Profile
I just got my full stack of boards and I am a great fan of Tinycircuits already!

However, somehow I cannot figure out how to send GPS lat/long/time over Bluetooth to a nRF UART app on Android or another Arduino.

I used the and on my Serial Monitor I get the NMEA format. I can also display it in Google Earth. This is all great.

Then I try the TinyShield_NRF8001_BLE_Example with Accelerometer on Codebender and that also works well.

Putting both together gives me significant headache. If I use the TinyGPS++ library, I got as far as being able to receive empty gps strings in the Android app. However, I dont think the GPS shield reads any data. I tried for 3 days, I am lost. Who can help to give me a sketch to collect GPS data and send it over Bluetooth to another Arduino, Raspberry or Android app.
Code: [Select]
#include <TinyGPS++.h>
#include <Wire.h>
#include "BMA250.h"

// accel
//BMA250 accel;

#define BLE_DEBUG false

#include "SPI.h"
#include "lib_aci.h"
#include "aci_setup.h"
#include "uart_over_ble.h"
#include "services.h"
#include <SoftwareSerial.h>
// The Arduino pins used by the GPS module
static const int GPS_ONOFFPin = A3;
static const int GPS_SYSONPin = A2;
static const int GPS_RXPin = A1;
static const int GPS_TXPin = A0;
static const int GPSBaud = 4800;
// The TinyGPS++ object
TinyGPSPlus gps;
// The GPS connection is attached with a software serial port
SoftwareSerial Gps_serial(GPS_RXPin, GPS_TXPin);

uint8_t ble_rx_buffer[21];
uint8_t ble_rx_buffer_len = 0;

//when using this project in the Arduino IDE, delete the following include and rename UART.h to UART.ino
#include "UART.h"

void setup(void)
  // Init the GPS Module to wake mode
  pinMode(GPS_SYSONPin, INPUT);
  pinMode(GPS_ONOFFPin, OUTPUT);
  digitalWrite( GPS_ONOFFPin, LOW );   
  if( digitalRead( GPS_SYSONPin ) == LOW )
     // Need to wake the module
    digitalWrite( GPS_ONOFFPin, HIGH );
    digitalWrite( GPS_ONOFFPin, LOW );     
  // Open the GPS serial port 
  //accel.begin(BMA250_range_2g, BMA250_update_time_64ms);//This sets up the BMA250 accelerometer
  //uart.setDeviceName("DINO"); /* 7 characters max! */

int inByte = 0;         // incoming serial byte
byte pbyGpsBuffer[100];
int byBufferIndex = 0;

void loop() {
while (Gps_serial.available() > 0)
  aci_loop();//Process any ACI commands or events
//  Serial.println(msg);

    //;//This function gets new data from the accelerometer
    String msg = String(, 3);
      msg += ":";
      msg += String(gps.location.lng(), 3);
      msg += ":";
      msg += String(gps.altitude.value());
    uint8_t sendBuffer[20];
    uint8_t length = 20;
    msg.getBytes(sendBuffer, 20);
    lib_aci_send_data(PIPE_UART_OVER_BTLE_UART_TX_TX, sendBuffer, length);
// Debug: if we haven't seen lots of data in 5 seconds, something's wrong.
if (millis() > 5000 && gps.charsProcessed() < 10) // uh oh
  Serial.println("ERROR: not getting any GPS data!");
  // dump the stream to Serial
  Serial.println("GPS stream dump:");
  while (true) // infinite loop
    if (Gps_serial.available() > 0) // any data coming in?

Thank you for help


  • Newbie
  • *
    • Posts: 4
    • View Profile
Hi all - I solved it myself - if anyone is interested, here is the problem. I had conflicting baud rates on the serial and the GPS.
The correct baud for my GPS module release is 9600 and I set the baud for the Serial to 115200. Now it send perfectly to Bluetooth. :)


  • Newbie
  • *
    • Posts: 4
    • View Profile
I am trying this too with no luck. I used your code to check mine and with yours I was able to get the coordinates (GPS) on the serial printer in the MAC where the Tinyduino is connected. Via blue tooth I can connect to a Chromebook and I am able to send from the chromebook a message but it seems it does not work the other way. Any ideas?


SMF spam blocked by CleanTalk