I am trying to integrate a GPS module (Grove - GPS (Air530) - Seeed Wiki) into an existing arduino project. The latter uses an Environmental combo BME 280 / CCS811 sensor module and an SD card shield (SD Card shield V4.0) to log the data. The SD card shield has UART port and I would like to use that to attach the GPS. Before attaching the GPS everything works as expected but as soon as I plug-in the GPS into the UART port I get this:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions
This goes away as soon as I unplug the GPS from the UART of the SD card shield. Anyone could help me out with this? Thanks
@pjg Thank you for your replay. I am learning about hardware and components in general, so I am not an expert.
I just would like to use the GPS module with my current setup and I am not sure how to hook it up. Since the GPS comes with the Dupon Cables and the SD card shield has an UART serial port I thought that would be the way to do it, but it seems not to be it.
Here the image of the setup. With the GPS plugged in the apparently wrong place
Why it is not recommended to use Dupon Cables? Could you be more explicit on how I could hook it up?
The code that I have used just to test the GPS is this (you can find it if you scroll down in the link above):
#include <SoftwareSerial.h>
SoftwareSerial SoftSerial(2, 3);
unsigned char buffer[64]; // buffer array for data receive over serial port
int count=0; // counter for buffer array
void setup()
{
SoftSerial.begin(9600); // the SoftSerial baud rate
Serial.begin(9600); // the Serial port of Arduino baud rate.
}
void loop()
{
if (SoftSerial.available()) // if date is coming from software serial port ==> data is coming from SoftSerial shield
{
while(SoftSerial.available()) // reading data into char array
{
buffer[count++]=SoftSerial.read(); // writing data into array
if(count == 64)break;
}
Serial.write(buffer,count); // if no data transmission ends, write buffer to hardware serial port
clearBufferArray(); // call clearBufferArray function to clear the stored data from the array
count = 0; // set counter of while loop to zero
}
if (Serial.available()) // if data is available on hardware serial port ==> data is coming from PC or notebook
SoftSerial.write(Serial.read()); // write it to the SoftSerial shield
}
void clearBufferArray() // function to clear buffer array
{
for (int i=0; i<count;i++)
{
buffer[i]=NULL;
} // clear all index of array with command NULL
}
The Arduino Uno uses pin 0 and 1 for serial communication. The uart connector on the SD card shield is wired to pin 1 and 2 so the upload and the datastream from de gps module are interfering on pin 1.
Schematic SD card shield: https://seeeddoc.github.io/SD_Card_shield_V4.0/res/SD_Card_Shiled_v4.0.pdf
Try to connect the gps with jumper wires to pin 2 and 3
What are the pins the Seeed plug (white JST) is connected to ?
Or you can use the software serial and choose other pins for the GPS and connect the cable on the blue stuff on the sides.
So, I got it working by connecting the GPS from the Dupon Cables directly to Vin, GRD, RX (pin3) and TX (pin 4) using jumper cables. This is definitely not a permanent solution but it is working.
I am using a library called TinyGPS and this is the test code I am running:
#include <SoftwareSerial.h>
#include <TinyGPS.h>
/* This sample code demonstrates the normal use of a TinyGPS object.
It requires the use of SoftwareSerial, and assumes that you have a
4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/
TinyGPS gps;
SoftwareSerial ss(4, 3);
void setup()
{
Serial.begin(9600);
ss.begin(9600);
Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version());
Serial.println("by Mikal Hart");
Serial.println();
}
void loop()
{
bool newData = false;
unsigned long chars;
unsigned short sentences, failed;
// For one second we parse GPS data and report some key values
for (unsigned long start = millis(); millis() - start < 1000;)
{
while (ss.available())
{
char c = ss.read();
//Serial.write(c); // uncomment this line if you want to see the GPS data flowing
if (gps.encode(c)) // Did a new valid sentence come in?
newData = true;
}
}
if (newData)
{
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print("LAT=");
Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
Serial.print(" LON=");
Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
Serial.print(" SAT=");
Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
Serial.print(" PREC=");
Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
}
gps.stats(&chars, &sentences, &failed);
Serial.print(" CHARS=");
Serial.print(chars);
Serial.print(" SENTENCES=");
Serial.print(sentences);
Serial.print(" CSUM ERR=");
Serial.println(failed);
if (chars == 0)
Serial.println("** No characters received from GPS: check wiring **");
}
At the moment data from the GPS are being transmitted to my serial monitor but in order to get LAT and LONG I would need to bring the setup outdoor. Thanks for you help @pjg and @Jan