Real Time GPS with Neo 6M and Sim800L and Arduino mega2560

Nothing appears inside the serial monitor after it is connected to the blynk server.

So you get a successful connection to the Blynk server?

yes. but gps data not coming

I’ve never used any GPS functionality, but I presume that you’ve tested your hardware - validating that it works before you try and combine it with Blynk. Other than that, I don’t think I will be much help in resolving your issue.

I wish you the best of luck, and hope that someone more qualified will be able to assist you :wink:

thank you martin. If I enter the void GPSData code in the void loop, everything works fine, but everywhere I read the void loop to keep it clean.

Yeah, with IoT it’s often really important as a cluttered void loop() can suffocate the WiFi tasks that need to be performed in order to maintain a reliable connection to the Blynk servers.

Wait… I’m not sure… if this is the case, but it’s a practice I use - try it and see if it makes a difference.
Replace your SimpleTimer timer; with the Blynk equivalent:

BlynkTimer timer1;
BlynkTimer timer2;
BlynkTimer timer3;

Then replace:

timer.setInterval(10000L,  checkGPS);   // every 5s check if GPS is connected
timer.setInterval(5000L,   GPSData);    // check GPS data
timer.setInterval(30000L,  checkBlynk); // check connection to blynk server

so that each one uses it’s own timer. I’m pretty sure each timer can only have one function attached?

timer1.setInterval(10000L,  checkGPS);   // every 5s check if GPS is connected
timer2.setInterval(5000L,   GPSData);    // check GPS data
timer3.setInterval(30000L,  checkBlynk); // check connection to blynk server

Again, this is just a hunch, but it doesn’t hurt to try right? @khazaee

#define BLYNK_HEARTBEAT 5
do u using a pulse sensor in ur project?

This has nothing to do with a human pulse, as you may initially expect. It’s to do with how frequently the hardware interfaces with the server. There’s another post that has more information about this <3

In this; setting it to 5 means that it will refresh every 5 seconds, instead of 10 seconds (the defualt).

Hope this was helpful and cleared some things up :slight_smile:

1 Like

In your GPSdata function. Try changing the while statement to if. Because if there is no data yet it will hang there until there is which will kill the connection to the server.

I also tried this method but still blynk connects but no GPS information is sent. I need to say when I use GPSData in the void loop, everything works fine

I do blynk any way you think I do not send gps information I do not think the problem is of time

hi @Gunner You’ve announced everywhere that the void loop is clean, but you did not give any guidance in the gps project with the neo6m module. Please give a little more guidance

Gunner is taking a break from the forum for a while for personal reasons, so you probably won’t be getting an answer from him.
He also probably doesn’t have this hardware anyways so wouldn’t be angle to give you a specific answer.

If you want help from the forum then id’d start giving detailed feedback to the suggestions that are made, otherwise people tend to stop making them.

Pete.

how about you ? Can you answer questions?

I can answer questions.
I have no experience with the hardware that you’re using, but I am an experienced C++ programmer and understand Blynk.

However, I won’t attempt to give advice on issues where you won’t give extensive feedback on suggestions that have already been made and you won’t copy/paste the output from your serial monitor when you are asked to.

Pete.

3 Likes

It’s hard to believe that nobody can be found by using blynk GPS. There are, of course, examples inside the YouTube that insert the code into the void loop. However, if you want to use your c ++ knowledge, then the problem is that when you clean the void loop and transfer code to another void and use the timer, blynk will be properly connected to it, but it is not news of the position of the gps.

Code in loop :

void loop() {

  while (GPSSerial.available() > 0){
    if (gps.encode(GPSSerial.read())){
      displayInfo();
    }
  }
       
  Blynk.run();
  timer.run();

}

Code out of loop but not working :

timer.setInterval(5000L, GPSData); // check GPS data

void GPSData() {
   
  while (GPSSerial.available() > 0) {
    if (gps.encode(GPSSerial.read())) {
      displayInfo();
    }
  }
}

If you search the forum for GPS then you’ll find situations where people are using a variety of GPS solutions with Blynk, but not necessarily the same hardware as you.

It’s already been said that ‘while’ is a blocking function, which doesn’t work well with Blynk.
You’ve responded that you’ve tried an ‘if’ statement instead, but you haven’t shared that version of the code, or your serial output.

Pete.

2 Likes

If you saw the gps project with blynk on the internet that kept the void loop clean, please send it the link no matter which hardware is used.
In the case of the seial monitor, after the blynk is connected to Sorush, something else will not be displayed. What exactly does a serial monitor have on the output?

Amir.

I would suggest using SerialEvent (https://www.arduino.cc/en/Tutorial/SerialEvent) to read the data from the neo6m instead of calling GPSData with a timer.

1 Like

I was suggesting searching this forum, rather than the internet as a whole. I’ll let you do that, as it’s your project.

I don’t know, you haven’t shared it with us yet!

Pete.

3 Likes