Gps, Bluetooth, Map widget

I am using an iPhone, hm-10 Bluetooth module, Arduino uno, and Sparkfun GPS shield.

I have gotten the Bluetooth and GPS to work separately and have gotten the GPS to send data to the serial monitor.

I recently got them to work together in the sense that it recognizes that there is a GPS attached, but I can not get the coordinates to print in a value display on blynk.

My goal is to eventually plot the GPS coordinates on the blynk map but for now just sending the coordinates is great.

It recognizes the GPS when it is in UART mode.

Any help/feedback is appreciated!

This is my code:

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <BlynkSimpleSerialBLE.h>

char auth[] = "92067b9f7b604a70a309ad21c5";

SoftwareSerial SerialBLE(10, 11); // RX, TX

BlynkTimer timer;
TinyGPSPlus gps;

int RXPin = 2;
int TXPin = 3;
int GPSBaud = 4800;

void myTimerEvent()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.

  while (Serial.available() > 0)
    if (gps.encode(Serial.read()))
    {
      displayInfo();
      Blynk.virtualWrite(V1, Serial.read() )
    }
  if (millis() > 5000 && gps.charsProcessed() < 10) //off
  {
    //Serial.println(F("No GPS detected"));

    Serial.println(3);
    while (true);

  }
  else //on
  {
    displayInfo();
    Blynk.virtualWrite(V1, Serial.read() )
    digitalWrite(4, HIGH);
  }


}


void setup()
{
  // Debug console
  Serial.begin(4800);
  SerialBLE.begin(9600);
  Blynk.begin(SerialBLE, auth);

  /*Serial.println("Waiting for connections...");
    Serial.println(F("DeviceExample.ino"));
    Serial.println(F("A simple demonstration of TinyGPS++ with an attached GPS module"));
    Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
    Serial.println(F("by Mikal Hart"));
    Serial.println();*/

  timer.setInterval(1000L, myTimerEvent);

  pinMode(4, OUTPUT);


}

void loop()
{
  Blynk.run();
  timer.run(); // Initiates BlynkTimer
}

void displayInfo()
{
  Serial.print(F("Location: "));
  if (gps.location.isValid())
  {
    Serial.print(gps.location.lat(), 6);
    Serial.print(F(","));
    Serial.print(gps.location.lng(), 6);
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F("  Date/Time: "));
  if (gps.date.isValid())
  {
    Serial.print(gps.date.month());
    Serial.print(F("/"));
    Serial.print(gps.date.day());
    Serial.print(F("/"));
    Serial.print(gps.date.year());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F(" "));
  if (gps.time.isValid())
  {
    int num = gps.time.hour() - 5;
    if (gps.time.hour() < 10) Serial.print(F("0"));
    Serial.print(num);
    Serial.print(F(":"));
    if (gps.time.minute() < 10) Serial.print(F("0"));
    Serial.print(gps.time.minute());
    Serial.print(F(":"));
    if (gps.time.second() < 10) Serial.print(F("0"));
    Serial.print(gps.time.second());
    Serial.print(F("."));
    if (gps.time.centisecond() < 10) Serial.print(F("0"));
    Serial.print(gps.time.centisecond());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.println();
}

With an UNO you would need two Software Serial connections, one for Blynk (BT) and one for the GPS. However Software Serial cannot run two connections simultaneously, only one can receive data at a time.

https://www.arduino.cc/en/Reference/softwareSerial

Thank you. I got them both working at the same time but I can not send data from the gps to blynk like the coordinates or the time. What should I do?

How are you expecting the data to transfer from the Arduino Uno to the Blynk cloud server?
If you’re thinking the iPhone will act as a Bluetooth to Internet bridge to send your data to the cloud server then I think you’ll be disappointed.

Also, even if that were possible, the GPS receiver and the iPhone would need to be within a few feet (Bluetooth range) of each other. If that were the situation then you’d be better-off using the GPS Stream widget on the iPhone to send the phone’s GPS coordinates to the Blynk cloud server and cut the other hardware out of the equation.

Pete.

Thank you. I am using a hm-10 bluetooth module to send the data from the Arduino Uno to the Blynk app. I know that the range is very limited for the Bluetooth but it is a prototype for the final product so we are just using it as a proof of concept (we hope to eventually switch to a sim card).