Hello all,
I am trying to create a GPS speedo with an NEO-6M GPS module and a TM1637 4 digit display. I build everything on a breadboard using an Arduino Uno and everything worked like a charm.
I decided to solder all the components to an Arduino Nano but it seems that it does not receive GPS data. The RX led on de NANO is blinking when i connect the GPS module but the display is not showing any speed or time.
For an extra test i soldered everything to an Pro Micro but that has the same issue.
I hope that someone can point me in the right direction.
#include <Wire.h>
#include <TM1637Display.h>
#include <TinyGPS++.h>
#define CLK 2
#define DIO 3
TM1637Display display = TM1637Display(CLK, DIO);
const uint8_t SEG_GPS[] = {
SEG_D, // _
SEG_A | SEG_C | SEG_D | SEG_E | SEG_F, // G
SEG_A | SEG_B | SEG_E | SEG_F | SEG_G, // P
SEG_A | SEG_C | SEG_D | SEG_F | SEG_G // S
};
TinyGPSPlus gps;
void setup() {
Serial.begin(9600);
display.setBrightness(7);
display.setSegments(SEG_GPS);
}
void loop() { // run over and over
while (Serial.available() > 0)
if (gps.encode(Serial.read())){
setDisplay();
}
}
void setDisplay(){
if(gps.speed.isValid()){
double speed = gps.speed.kmph();
if(speed>10){
display.showNumberDec(speed,false,4,0);
return;
}
}
if(gps.time.isValid()){
int minutes = gps.time.minute();
display.showNumberDec(minutes,true,2,2);
int hours = gps.time.hour();
hours = hours+2;
if(hours>24)
hours=hours-24;
display.showNumberDec(hours,true,2,0);
}
}
1 Like
We can't see the schematic of how all your devices are connected, nor can we see the quality of your soldering.
Paul
I dont think its the soldering, i measured the connections, and there is no resistance. I also rewired it a few times between the UNO and the Nano.
The schematic is quite easy. The working display is connected to pin 2 and 3 and the gps module to the TX and RX pins.
There is a photo attached if that helps
And I see a USB cable connected to the USB connector. What is on the other end of the USB cable. A schematic would show you that the TX and RX pins are also connected to the USB port.
Paul
The other end is connected to a powerbank. I know the tx and rx are used for serial communication over usb also. I can only upload a schematic if i disconnect my gps sensor. (same on the UNO)
My Uno is wired up exactly the same and there it makes no difference if i connect the usb cable to a computer or powerbank.
I also see the RX light on the nano blinking so it is receiving data.
A Uno and a nano should react the same right?
while (Serial.available() > 0)
That is reading the USB port.
You should set up a software serial port to connect the GPS to.
Unless you are using a power-only USB cable.
Hi siebert.
I've been down this path. I'm using a similar GPS board (without the on board antenna) a Nano (non genuine) 1637 display and power bank.
Also feeding the GPS data to the h/w serial.
Yes, if you're program works on the Uno then it'll work on the Nano or Micro.
The problem I had was in the voltage supplied to the GPS VCC. I found the Nano 5V pin was providing less than 5v -- more like 4.8 or less. The GPS requires more than 4.8v.
I no longer take power from the Nano 5V pin, but from the powerbank.
It's good to have some way to readily view the raw GPS output. With undervoltage it will show the GPS repeatedly rebooting. I use a bluetooth module to do this.
Good luck.
John.
Thanks for the help guys,
I indeed measured 4.8v but the gps receiver is rated 3-5v so i didnt think that should be an issue. Just to make sure i tried an external powersupply which also made no difference.
For now i went with software serial and everything seems to be working as intended.
(Still cant get my head around why hardware serial is not working.)
#include <TM1637Display.h>
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
#define CLK 2
#define DIO 3
#define rxPin 5
#define txPin 6
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
TM1637Display display = TM1637Display(CLK, DIO);
const uint8_t SEG_GPS[] = {
SEG_D, // _
SEG_A | SEG_C | SEG_D | SEG_E | SEG_F, // G
SEG_A | SEG_B | SEG_E | SEG_F | SEG_G, // P
SEG_A | SEG_C | SEG_D | SEG_F | SEG_G // S
};
TinyGPSPlus gps;
void setup() {
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
mySerial.begin(9600);
display.setBrightness(7);
display.setSegments(SEG_GPS);
}
void loop() { // run over and over
while (mySerial.available() > 0)
if (gps.encode(mySerial.read())){
setDisplay();
}
}
void setDisplay(){
if(gps.speed.isValid()){
double speed = gps.speed.kmph();
if(speed>10){
display.showNumberDec(speed,false,4,0);
return;
}
}
if(gps.time.isValid()){
int minutes = gps.time.minute();
display.showNumberDec(minutes,true,2,2);
int hours = gps.time.hour();
hours = hours+2;
if(hours>24)
hours=hours-24;
display.showNumberDec(hours,true,2,0);
}
}
siebert12:
I indeed measured 4.8v but the gps receiver is rated 3-5v so i didnt think that should be an issue. Just to make sure i tried an external powersupply which also made no difference.
I've come to realise that the data specs provided by the sellers of these GPS boards are not authoritative. Nobody knows who manufactures these boards so there is nothing authoritative available to us.
Power supplies connected to the mains are noisy.
A power bank is a reliable power source. In theory they have the potential to interfere with the RF reception of the GPS, but I use them successfully. Supply from a PC via USB is good too, but not via the Nano 5v pin.
So if it's now working, can you tell us what you think was the trouble?
John.
Is this authoritative enough for you?
https://www.u-blox.com/sites/default/files/products/documents/NEO-6_DataSheet_(GPS.G6-HW-09005).pdf
Someone takes this 3.3V module, puts it on a card with a voltage regulator (and a 4.8V power supply would have to be pretty dirty not to be regulated down to a clean 3.3V output), adds an antenna connector, and there you go.
Where did you get yours?
HillmanImp:
...
So if it's now working, can you tell us what you think was the trouble?
Certainly not the voltage. I only changed from hardware serial (pin 0 and 1) to software serial (pin 5 and 6)
Everything else stayed the same. I did not run into any issues yet so i will probably stay at software serial for now.
1 Like