Help with sending info of the gps to an app inventor app by hc 05

Hi, I'm doing a project with Arduino Uno, I'm using, HC 05 and NEO 6M, what I need to do is: 1. send the GPS coordinates with the HC 05 to the phone, to the app I built with APP INVENTOR MIT.
I have come across some problems that I have been trying to find a solution to for almost a month .now
I was able to get the GPS coordinates to appear on the serial monitor, but I do not understand how to send it to the app I built with BT, the app I built needs to send the coordinates to a phone number the user choose to send to, now, when I run the app it sends the coordinates of the phone and not of the external GPS.
I need help, to build a code that sends the coordinates to the phone, even if it's another app, and .not the one I made
And an explanation how to work with it.

Welcome to the forum

In order to send data from the Uno using the the HC05 you need to use a Serial interface to the HC05. You then "print" the data to the serial interface.

Note that you cannot easily use the hardware Serial interface of the Uno (pins 0 and 1) to communicate with the HC05 because it is used to upload code and output to the Serial monitor

It is, therefore, common to use a SoftwareSerial interface to communicate with the HC05 instead

How is the HC05 connected to the Uno ?

tx to 2 and rx to 3

Please post your full sketch, using code tags when you do

Hi, I use the example of the TinyGPS library- test_with_GPS_device

Why TinyGPS ?

TinyGPS++ is more up to date and easier to use (in my opinion).

If you need help sending the fix info over Bluetooth, you would need to tell us what format the 'APP' needs the data.

Hello mikiln and welcome to the forum.

Everything you are aiming to do can be done. However it is not simple due to the many elements involved. You need to conquer each of those elements. When your system doesn't work you need to deduce which element is not working and that often involves proving which elements ARE working.

Problems with the physical setup are going to cost you as much lost time as problems with the software elements.

While TinyGPS++ is a good library that simply hands you the GPS parameters on a plate, Mikhal's examples are not good at helping you troubleshoot.

I would not use a UNO. I would use a Nano mounted on a screw terminal breakout board. So robust. I would screw the terminal board to a sheet of plywood. The Neo module must also be secured to the plywood. If it uses a patch antenna on a cable the antenna must be secured ASAP or you WILL break it.

Since the GPS is the source of your important data I would allocate it the best serial channel available -- the hardware serial (ie, RX,TX of the Arduino board). The HC-05 can use a software serial channel as you are doing.

I send debug messages to the HC-05 rather than the IDE monitor.

You MUST get familiar with using a BT serial terminal app on your phone. Several available for free on the app store (I use the one by Kai Morich). You can depend on it to work, which can can rarely say that about our own apps & sketches.

You MUST be able to easily read the GPS NMEA sentences independently of any custom sketches or apps.

Sounds like your phone has a locator service and you are using blocks that access the co-ords provided by that service. When you have the serial comms with the Arduino/BT working you will be in charge and you will put the co-ordinates from your Neo GPS into a text string and send that in an SMS. Not too hard but I think you are a long way from that.

Best of luck. You'll get there.

1 Like

I tried both, no special reason, my problem is to write a code that send the coordinates of the GPS sensor to the phone. and than to an app inventor app that I built

Please post the code of one of your attempts along with a schematic of your project. A 'photo of a hand drawn diagram is good enough to show what you have connected to what

thanks I will use TinyGPS++, I can't use the nano, the final project will work with mega.....
yes we are securing everything with a plywood we finish everything.
I started working with the app serial Bluetooth, but I need help to write the code

I don't understand. The bluetooth data is sent to an app on the phone, either one you have written or one that is a standard prebuild app like Bluetooth Serial Terminal. Why are you talking about what looks like a two step process?

The HC05 connection to hardware serial is fine, as long as you disconnect the wires when downloading new code to the board. Serial outprint prints will be output over bluetooth and to the monitor as well. Serial input can only come from the phone and bluetooth and not from the monitor.

One way to develop your program is to use the Serial connection like you have, disconnect the bluetooth, and get your code working as you want with the monitor only. Then when you add the bluetooth to the hardware serial connection there is no more coding to do.

Why can't you write the code yourself?

I tried obviously, it didn't work that is why I'm here....

Please post the sketch that you tried and describe what was wrong

I can't I deleted it

Oh dear, that was a silly thing to do

Forget about the GPS for now and write a simple sketch that sends fixed text via Bluetooth then read it on the 'phone

yes I know, well I already did that, and, I can't forget about the GPS because it is for a project...

Please post that sketch

#include <NMEAGPS.h>
const float FEET_PER_METER = 3.28084;

#include <AltSoftSerial.h>// import the serial library
AltSoftSerial gpsPort; // RX is 8 (to GPS tx), TX is 9 (to GPS rx)

#define Genotronex Serial  // just an "alias" for Serial to make the code more readable

NMEAGPS gps; // the parser
gps_fix fix; // the struct with all the parsed values

const int LED_PIN=13; // led on D13 will show blink on / off

void setup() {
  //Serial.begin(9600);  // not needed if Genotronex *is* Serial
  gpsPort.begin(9600);
  Genotronex.begin(9600);
  Genotronex.println("GPS Start");
  Genotronex.println("Bluetooth On please press 1 or 0 blink LED ..");
  pinMode(LED_PIN,OUTPUT);
}

void loop() {

  if (gps.available( gpsPort)) {
    fix = gps.read();  // get the latest GPS info (all in one struct)
  }

  if (Genotronex.available()){
    char BluetoothData=Genotronex.read();

    if (BluetoothData=='1'){   // if number 1 pressed ....
      digitalWrite(LED_PIN,HIGH);
      Genotronex.println("LED  On D13 ON ! ");

      //Get the latest info from the gps object which it derived from the data sent by the GPS unit
      Genotronex.println("Satellite Count:");
      Genotronex.println( fix.satellites );
      Genotronex.println("Latitude:");
      Genotronex.println( fix.latitude(), 6);
      Genotronex.println("Longitude:");
      Genotronex.println( fix.longitude(), 6);
      Genotronex.println();
  
    }
    if (BluetoothData=='0'){// if number 0 pressed ....
      digitalWrite(LED_PIN,LOW);
      Genotronex.println("LED  On D13 Off ! ");
    }
  }
}

ok, so I found the code I used, when I send "1" its turn on the led and the GPS send the coordinates, but its not working he shows 0.00000, that is why I deleted it