I've been trying to use a neo6m gps module (well the one on amazon with 5 pinouts instead of 4, it has the pps pin as well unlike a lot of other neo6m gps modules) to send gps data to my arduino 2560 mega so that i would be able to use the serial monitor in the Arduino app to see NMEA sentences. Eventually I want to use the gps module alongside other sensors connected to the same arduino to data via bluetooth on a mobile application, but I am currently stuck on the gps part of this project.
I've looked over a lot of other discussions related to the neo6m gps (specifically connected to an arduino) with many different arduino codes and pinout configurations but to no avail. Currently I am connecting the Neo6m Vcc to the arduino 3.3V supply, gnd to gnd, gps TX to mega 2560 RX on pin 0, and gps RX to mega 2560 TX on pin 1. As far as I am aware, the module should still output sentences even without a proper lock once the gps module is powered (which the red light confirms), though when i open the serial monitor it does not output anything (though at one point it randomly outputted a backwards questionmark). I've also tried to connect to serial pin 3 with the following code from another discussion:
void setup()
{
Serial.begin(9600); // set serial monitor rate to 9600 bps
Serial3.begin(9600); // GPS Serial setup
}
void loop()
{
while (Serial3.available()) // look for data from GPS module
{
char c = Serial3.read(); // read in all available chars
Serial.print(c); // for diagnostics
}
}
But again to no avail, the arduino module isn't even blinking its RX LED to confirm that its getting data. Anything potentially out of place that I may be doing? I've tried 3 chips (though one DOA) but no luck, any help would be greatly appreciated : )
You need a Serial3.begin(9600); as well. I see that it is there but the compiler may think it is part of the comment the way that it is written.
To which pins is the GPS connected? Serial3 RX to GPS TX, GPS RX not connected?
Read the forum guidelines to see how to properly post code and some information on how to get the most from this forum. Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
I run this code (yours, but formatted) on my Mega with a Neo6M and get the output shown. The code is OK.
void setup()
{
Serial.begin(9600); // set serial monitor rate to 9600 bps
Serial3.begin(9600); // GPS Serial setup
}
void loop()
{
while (Serial3.available()) // look for data from GPS module
{
char c = Serial3.read(); // read in all available chars
Serial.print(c); // for diagnostics
}
}
Well yes I used those pins when running the code, I was just initially trying to read off of pin 0 and 1 without any code (to see raw NMEA sentences)
I did not know about those pins being used for the USB-Serial convertor though, either way if I do wire up the gps to other serial ports, 1,2 or 3, would I expect the chip (after resetting the arduino) to transmit data to the arduino and see the arduino RX LED blink (with or without a lock)?
I should mention that I haven't soldering the headerpins (just slotted the gps module in) and would you recommend I do so for it to work or should it generally be okay regardless?
I've finally been able to solder the gps and it seems to be outputting NMEA to the serial monitor on my laptop! It turns out yall were right, I had been occasionally able to get a sentence without the soldering but now that I have done so, it seems to send the data consistently serially.
What I am trying to do now is send the data from my GPS serially to my HM-10 bluetooth module (I decided to transition to BLE as I've been looking through a react-native library that can handle BLE communication), and I was wondering if I can a) write to serial via Serial.write(gpsdata), b) read from serial and write to the hm10 via something like checking if Serial is available, then read from serial through data = Serial.read and then bluetooth.print(data).
Does this seem like something that is viable? Thank you everyone for the advice, it's been a while since I've been able to work on this, my apologies for the delay.