TTGO TBeam V1.1 (GPS fix)

Hey guys, sorry its not really related to TTN topic. but I do have a problem with my TBeam.
the problem that I have right now is before this i have got the “GPS fix” for the tbeam but the problem is date is no where near the true value.

WhatsApp Image 2022-07-14 at 3.08.54 PM

this picture is for today which is 14/7/2022 but from the picture shown its 31/12/2099, the time is correct because for my country is GMT +8.

  • ignore the location because right now I’m put it indoor

Where do your code get the date from?

I’m using tinygps++ library and following the example given:

I actually have asked this in forum from GitHub and they said I have to just put my sensor outside so I can get “GPS fix” but more than 8 hours but still not getting the date right. only the date is problem, other else is fine

Did you get a GPS fix?

As long as you don’t get a GPS fix, you will not get a time fix.

Did you enable the power to the GPS?

before this I get the GPS fix, but I only get correct coordinate, time and number of satellite but not for date. it just same before this as you can see in the photo.

WhatsApp Image 2022-07-15 at 11.10.40 AM

from the picture you can see that the only problem is date. everything else is fine for me

Its likley a problem with the code you are using.

That TTGO works fine for me, displaying location, time and date on the display.

And as a matter of interest; why would a TTN node need to know the time and date ?

Given that the battery is at -4% and as a perfect example of why GitHub Co-Pilot’s AI will only propagate the variable quality of code that people post, I’d say the code is in some serious need of auditing.

This is not the code on your board, so fix your code

1 Like

may i know how is that not code for my board and can you tell me how can i fix the code for this problem?

In that code there is no statement to display the battery voltage. So it is not the code loaded on your board

I’m following from example show for oled display code and using tinygps++ lib for the NEO-6M GPS module
I’m using the function just for the display only, or i am wrong for using those library? may i know how you get them display?

Why do you expect the volounters on this forum to suggest fixes to code they have not seen ?

I see, that’s only an example I follow from but not copying 100% from the code, this is some of the code that I’m working on for the display function:

void displayInfo()
{
        // get time from GPS module
      if (tGps.time.isValid())
      {
        Minute = tGps.time.minute();
        Second = tGps.time.second();
        Hour   = tGps.time.hour();
      }
 
      // get date drom GPS module
      if (tGps.date.isValid())
      {
        Day   = tGps.date.day();
        Month = tGps.date.month();
        Year  = tGps.date.year();
      }
 
      if(last_second != tGps.time.second())  // if time has changed
      {
        last_second = tGps.time.second();
 
        // set current UTC time
        setTime(Hour, Minute, Second, Day, Month, Year);
        // add the offset to get local time
        adjustTime(time_offset);
 
        // update time array
        Time[12] = second() / 10 + '0';
        Time[13] = second() % 10 + '0';
        Time[9]  = minute() / 10 + '0';
        Time[10] = minute() % 10 + '0';
        Time[6]  = hour()   / 10 + '0';
        Time[7]  = hour()   % 10 + '0';
 
        // update date array
        Date[14] = (year()  / 10) % 10 + '0';
        Date[15] =  year()  % 10 + '0';
        Date[9]  =  month() / 10 + '0';
        Date[10] =  month() % 10 + '0';
        Date[6]  =  day()   / 10 + '0';
        Date[7]  =  day()   % 10 + '0';
      }
  display.setFont(ArialMT_Plain_10);
  display.flipScreenVertically();
  if(tGps.location.isValid() || tGps.time.isValid() || tGps.date.isValid()){
    display.clear();
    display.drawString(0,0, "Location: " + String(tGps.location.lat(), 4) +"," + String(tGps.location.lng(), 4));
    display.drawString(0,10, String(Date));
    display.drawString(0,20, String(Time));
    display.drawString(0,30, "Battery: " + String(PMU.getBattPercentage()) + "%");
    display.drawString(0,40, "BattVoltage: " + String(PMU.getBattVoltage()/1000) + "V");
    display.drawString(0,50, "Satellite: " + String(tGps.satellites.value()));
    display.display();
  }

is it wrong?

Shame you did not display the actual code you were using (all of it) earlier since I have no experience of using that particular SSD1306 library.

The U8x8lib library makes using the display easy, no need for all that String stuff, in summary the code I have for displaying the date on a TTGO OLED is;

uint8_t day, month;
uint16_t year;

day = gps.date.day();
month = gps.date.month();
year = gps.date.year();

disp.clearLine(7);
disp.setCursor(0, 7);
disp.print(day);
disp.print(“/”);
disp.print(month);
disp.print(“/”);
disp.print(year);

Which I find a lot easier to understand.

Does not the SSD1306 library you are using support the use of the simple to use print() command ?

sorry bout that bro.

I’m using this but still cant get the date to work

yeah but because I’m following the example code so i tend to follow it through so that i can understand it when I refer it back

My first reaction is yes, it’s wrong to show some of the code - because if you can’t fix it, how do you know which bit to show us??

So the assignment to a variable like Second but then the use of a function like second() just seems like some hacking and the array as string, shudder.

But despite your best ‘bro’ hinting at giving us all the code, I don’t think you are any further forward.

Perhaps put some serial debug output so you can see what’s actually going on?

Well exactly.

However, the (eventually) provided display driving functions seem way over complex, simple print() commands will work both for the display and serial debug output.

Why all that String stuff is needed I have no idea; there may well be some minute in detail that the (eventually) provided code which is causing an output format error.

Not sure the TTN forum is an appropriate place for providing support for Arduino libraries when simple to understand code alternatives are available.

Inclined to agree, CopynPasta of nearest random code to top of Google has been a bane of my life for the last few weeks but I’m now free & clear of that project.

Hopefully @ezzat can take some time out to debug the code / find alternatives, perhaps even use LMIC-node which drives the display but will need TinyGPS patching in. Or look at the more reliable web resources for such things.