Data from GPS modul NEO-6M on tv screen problem

Hello,

This is my first post, so sorry for ma language
I would like to see some information from GPS modul on TV screen.
I use also VideoExperimenter shield, becouse information from gps i want add to image from camera.
I write 2 different program and they work.
First one just draw a line on the screen:

#include <TVout.h>
#include <fontALL.h>

#define W 136
#define H 96

TVout tv;
int y;

void setup()  {
 tv.begin(PAL, W, H);
 initOverlay();
 tv.select_font(font6x8);
}

// Initialize ATMega registers for video overlay capability.
// Must be called after tv.begin().
void initOverlay() {
 TCCR1A = 0;
 // Enable timer1.  ICES0 is set to 0 for falling edge detection on input capture pin.
 TCCR1B = _BV(CS10);

 // Enable input capture interrupt
 TIMSK1 |= _BV(ICIE1);

 // Enable external interrupt INT0 on pin 2 with falling edge.
 EIMSK = _BV(INT0);
 EICRA = _BV(ISC01);
}

// Required to reset the scan line when the vertical sync occurs
ISR(INT0_vect) {
 display.scanLine = 0;
}


void loop() {

 for (y=0; y<90; y++){
 tv.draw_line(0, y, 130, y, 1);
 delay(500);
 tv.clear_screen();
 //tv.delay(500);
 }
 }

Second one also works well, and give me on the port monitor value of speed, becouse this is for me important.

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
/*
  This sample code demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) 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).
*/
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

void setup()
{
 Serial.begin(115200);
 ss.begin(GPSBaud);

}

void loop()
{

 Serial.print("Stelity: ");
 printInt(gps.satellites.value(), gps.satellites.isValid(), 5);
 Serial.print("\n");
 Serial.print("Data i godzina: ");
 printDateTime(gps.date, gps.time);
 Serial.print("\n");
 Serial.print("Predkosc: ");
 printFloat(gps.speed.kmph(), gps.speed.isValid(), 6, 2);
 Serial.print("\n");
 
 smartDelay(1000);

 if (millis() > 5000 && gps.charsProcessed() < 10)
   Serial.println(F("No GPS data received: check wiring"));
}

// This custom version of delay() ensures that the gps object
// is being "fed".
static void smartDelay(unsigned long ms)
{
 unsigned long start = millis();
 do
 {
   while (ss.available())
     gps.encode(ss.read());
 } while (millis() - start < ms);
}

static void printFloat(float val, bool valid, int len, int prec)
{
 if (!valid)
 {
   while (len-- > 1)
     Serial.print('*');
   Serial.print(' ');
 }
 else
 {
   Serial.print(val, prec);
   int vi = abs((int)val);
   int flen = prec + (val < 0.0 ? 2 : 1); // . and -
   flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
   for (int i=flen; i<len; ++i)
     Serial.print(' ');
 }
 smartDelay(0);
}

static void printInt(unsigned long val, bool valid, int len)
{
 char sz[32] = "*****************";
 if (valid)
   sprintf(sz, "%ld", val);
 sz[len] = 0;
 for (int i=strlen(sz); i<len; ++i)
   sz[i] = ' ';
 if (len > 0)
   sz[len-1] = ' ';
 Serial.print(sz);
 smartDelay(0);
}

static void printDateTime(TinyGPSDate &d, TinyGPSTime &t)
{
 if (!d.isValid())
 {
   Serial.print(F("********** "));
 }
 else
 {
   char sz[32];
   sprintf(sz, "%02d/%02d/%02d ", d.month(), d.day(), d.year());
   Serial.print(sz);
 }
 
 if (!t.isValid())
 {
   Serial.print(F("******** "));
 }
 else
 {
   char sz[32];
   sprintf(sz, "%02d:%02d:%02d ", t.hour(), t.minute(), t.second());
   Serial.print(sz);
 }

 printInt(d.age(), d.isValid(), 5);
 smartDelay(0);
}

static void printStr(const char *str, int len)
{
 int slen = strlen(str);
 for (int i=0; i<len; ++i)
   Serial.print(i<slen ? str[i] : ' ');
 smartDelay(0);
}

But when i try to connect bouth of this code it isn't work ;/
All code compile, but i didn't see anything on the screen, and on the port monitor. Could you help me?
Here is mix of two programs:

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <TVout.h>
#include <fontALL.h>

#define W 136
#define H 96


TVout tv;
int y;
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

void setup()
{
 tv.begin(PAL, W, H);
 initOverlay();
 tv.select_font(font6x8);
 Serial.begin(115200);
 ss.begin(GPSBaud);

}
// Initialize ATMega registers for video overlay capability.
// Must be called after tv.begin().
void initOverlay() {
 TCCR1A = 0;
 // Enable timer1.  ICES0 is set to 0 for falling edge detection on input capture pin.
 TCCR1B = _BV(CS10);

 // Enable input capture interrupt
 TIMSK1 |= _BV(ICIE1);

 // Enable external interrupt INT0 on pin 2 with falling edge.
 EIMSK = _BV(INT0);
 EICRA = _BV(ISC01);
}
void loop()
{

 Serial.print("Stelity: ");
 printInt(gps.satellites.value(), gps.satellites.isValid(), 5);
 Serial.print("\n");
 Serial.print("Data i godzina: ");
 printDateTime(gps.date, gps.time);
 Serial.print("\n");
 Serial.print("Predkosc: ");
 printFloat(gps.speed.kmph(), gps.speed.isValid(), 6, 2);
 Serial.print("\n");
 
 smartDelay(1000);
 
   for (y=0; y<90; y++){
 tv.draw_line(0, y, 130, y, 1);
 delay(500);
 tv.clear_screen();
 //tv.delay(500);
 }

 if (millis() > 5000 && gps.charsProcessed() < 10)
   Serial.println(F("No GPS data received: check wiring"));
}

// This custom version of delay() ensures that the gps object
// is being "fed".
static void smartDelay(unsigned long ms)
{
 unsigned long start = millis();
 do
 {
   while (ss.available())
     gps.encode(ss.read());
 } while (millis() - start < ms);
}

static void printFloat(float val, bool valid, int len, int prec)
{
 if (!valid)
 {
   while (len-- > 1)
     Serial.print('*');
   Serial.print(' ');
 }
 else
 {
   Serial.print(val, prec);
   int vi = abs((int)val);
   int flen = prec + (val < 0.0 ? 2 : 1); // . and -
   flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
   for (int i=flen; i<len; ++i)
     Serial.print(' ');
 }
 smartDelay(0);
}

static void printInt(unsigned long val, bool valid, int len)
{
 char sz[32] = "*****************";
 if (valid)
   sprintf(sz, "%ld", val);
 sz[len] = 0;
 for (int i=strlen(sz); i<len; ++i)
   sz[i] = ' ';
 if (len > 0)
   sz[len-1] = ' ';
 Serial.print(sz);
 smartDelay(0);
}

static void printDateTime(TinyGPSDate &d, TinyGPSTime &t)
{
 if (!d.isValid())
 {
   Serial.print(F("********** "));
 }
 else
 {
   char sz[32];
   sprintf(sz, "%02d/%02d/%02d ", d.month(), d.day(), d.year());
   Serial.print(sz);
 }
 
 if (!t.isValid())
 {
   Serial.print(F("******** "));
 }
 else
 {
   char sz[32];
   sprintf(sz, "%02d:%02d:%02d ", t.hour(), t.minute(), t.second());
   Serial.print(sz);
 }

 printInt(d.age(), d.isValid(), 5);
 smartDelay(0);
}

static void printStr(const char *str, int len)
{
 int slen = strlen(str);
 for (int i=0; i<len; ++i)
   Serial.print(i<slen ? str[i] : ' ');
 smartDelay(0);
}

There is a post over here that shows how to get GPS parsing and TVout working together. It requires using NeoGPS, my smaller, faster, more reliable and more accurate library, and a polled version of HardwareSerial (i.e., Serial). Because you are using a NEO-6M, the configuration commands in that post will work for you (and help!).

Up to reply #23, it's just about GPS and TVout. After that, another user joins in and asks about OneWire and Keypad. Reply here if you have any questions.

Other Notes:

  • The installation instructions for NeoGPS have changed, so ignore the parts about putting it in your sketch directory. NeoGPS is available from the Arduino IDE Library Manager, under the menu Sketch -> Include Library -> Manage Libraries. It will be installed in your Libraries directory.

  • Be sure you get the newest version of the pollserial class, from reply #7. It should go in your Libraries directory, in a new Libraries/pollserial subdirectory. Include the header file (pollserial.h) in your sketch, NOT the CPP file (pollserial.cpp). In that thread, they had pollserial in a subdirectory of TVout.

Cheers,
/dev

Thank you for your answer !
So I try to read and make some progress from the topic but i have next problem.
I downloaded the library from #7 and taken some example, here is the code:

//void loop()
//{
  //  for (y=0; y<90; y++){
  //tv.draw_line(0, y, 130, y, 1);
  //delay(500);
  //tv.clear_screen();
  //tv.delay(500);
  //}
#include <TVout.h>
#include <pollserial.h>
#include <fontALL.h>
#include "NMEAGPS.h"

NMEAGPS gps;
TVout TV;
pollserial pserial;

void setup()  {
  TV.begin(_PAL,136,96);
  TV.select_font(font6x8);
  TV.println("GPS Display");
  TV.println("-- Version 1.0 --");
  TV.set_hbi_hook(pserial.begin(9600));
}
// Initialize ATMega registers for video overlay capability.
// Must be called after tv.begin().
void initOverlay() {
  TCCR1A = 0;
  // Enable timer1.  ICES0 is set to 0 for falling edge detection on input capture pin.
  TCCR1B = _BV(CS10);

  // Enable input capture interrupt
  TIMSK1 |= _BV(ICIE1);

  // Enable external interrupt INT0 on pin 2 with falling edge.
  EIMSK = _BV(INT0);
  EICRA = _BV(ISC01);
}
void loop() {
  // Check for GPS characters on the pserial port and parse them.
  while (gps.available( pserial )) { // <-- must use new pollserial from reply #7 below!

    //  When enough characters have been parsed,
    //    a complete GPS fix structure is ready to use.
    gps_fix fix = gps.read();

    //  Display some of the fix members
    TV.print( "Lat/Lon: " );
    TV.print( fix.latitude() );
    TV.print( '/' );
    TV.print( fix.longitude() );
    TV.println();
  }
}

And i have some errors (first 3):

/Users/Artur/Documents/Arduino/test/GPS_TV/GPS_TV.ino: In function 'void loop()':
GPS_TV:42: error: no matching function for call to 'NMEAGPS::available(pollserial&)'
   while (gps.available( pserial )) { // <-- must use new pollserial from reply #7 below!
                                 ^
/Users/Artur/Documents/Arduino/test/GPS_TV/GPS_TV.ino:42:33: note: candidates are:
In file included from /Users/Artur/Documents/Arduino/test/GPS_TV/GPS_TV.ino:13:0:
/Users/Artur/Documents/Arduino/libraries/NeoGPS-master/src/NMEAGPS.h:108:13: note: uint8_t NMEAGPS::available(Stream&)
     uint8_t available( Stream & port )
             ^
/Users/Artur/Documents/Arduino/libraries/NeoGPS-master/src/NMEAGPS.h:108:13: note:   no known conversion for argument 1 from 'pollserial' to 'Stream&'
/Users/Artur/Documents/Arduino/libraries/NeoGPS-master/src/NMEAGPS.h:115:13: note: uint8_t NMEAGPS::available() const volatile
     uint8_t available() const volatile { return _available(); };
             ^

My english is not so good and maybe a didn't understand something.

I try with program from #7 - it compile, but i don't see any date from gps.
where can i check on which digital pin is TX and RX?

Hmm, that didn't work for me either...

If I have these files:

Arduino
  Libraries
    TVout
      examples
         Demo...
      pollserial
        pollserial.h    <-- from reply #7
        pollserial.cpp <-- from reply #7 (modify to port 0 for an UNO)
      spec
        asm_macros.h
        hardware_setup.h
        video_properties.h
      TVoutfonts
        fonts...
      library.properties
      keywords.txt
      TVout.cpp
      TVout.h
      TVoutprint.cpp
      video_gen.cpp
      video_gen.h

... it seems to work. Here's what worked for me:

#include <TVout.h>
#include <TVoutfonts/font6x8.cpp>
#include <pollserial/pollserial.cpp>
#include "NMEAGPS.h"

NMEAGPS gps;
TVout TV;
pollserial pserial;

void setup()  {
  TV.begin(_PAL,136,96);
  TV.select_font(font6x8);
  TV.println("GPS Display");
  TV.println("-- Version 1.0 --");
  TV.set_hbi_hook(pserial.begin(9600));
}

// Initialize ATMega registers for video overlay capability.
// Must be called after tv.begin().
void initOverlay() {
  TCCR1A = 0;
  // Enable timer1.  ICES0 is set to 0 for falling edge detection on input capture pin.
  TCCR1B = _BV(CS10);

  // Enable input capture interrupt
  TIMSK1 |= _BV(ICIE1);

  // Enable external interrupt INT0 on pin 2 with falling edge.
  EIMSK = _BV(INT0);
  EICRA = _BV(ISC01);
}

void loop() {
  // Check for GPS characters on the pserial port and parse them.
  while (gps.available( pserial )) { // <-- must use new pollserial from reply #7 below!

    //  When enough characters have been parsed,
    //    a complete GPS fix structure is ready to use.
    gps_fix fix = gps.read();

    //  Display some of the fix members
    TV.print( "Lat/Lon: " );
    TV.print( fix.latitude() );
    TV.print( '/' );
    TV.print( fix.longitude() );
    TV.println();
  }
}

I changed a few of the includes.

The first error message you got implies that you don't have the pollserial from reply #7. It might be getting it from the TVout directory. So I replaced that one with reply #7 and deleted the Libraries copy.

Also, don't use delay or you'll lose GPS data.Start with this setup and loop and work one step at a time. You can draw the background lines (or other stuff) in setup... they won't go away until you clear the screen. You may not need to clear the screen ever, if you are just updating a few fields.

i don't see any date from gps.

Then you should start with a plain GPS program. Make sure you follow the NeoGPS Installation instructions and try NMEA.ino. You can try it with the GPS hooked to 4 and 3 (use NeoSWSerial, not SoftwareSerial), but you must eventually move the GPS to pins 0 & 1.

If that works, try moving the GPS to pins 0 & 1. pollserial.cpp has a define for which HardwareSerial port to use. Since you have an UNO, you must use 0:

// set this to 0, 1, 2, 3 or nothing to select a USART
#define PS_PORT_NUMBER 1

Read this for more information about connecting the GPS to the Serial pins (shared with USB/Serial Monitor window).