carrascoacd / ArduinoSIM800L

Arduino HTTP & FTP client for SIM800L/SIM800 boards to perform GET and POST requests to a JSON API as well as FTP uploads.
159 stars 58 forks source link

battery percentage and GPS location #25

Closed jaka87 closed 5 years ago

jaka87 commented 5 years ago

Sleep mode changed to mode 2, which is used more often and I believe simpler to use. Added function to display battery percentage (not just voltage). Added function to detect GPS location - in case device gets stolen.

jaka87 commented 5 years ago

Im glad you liked it. It was my first pull request ever :) BTW great job wit the library. I went trough it few times to understand it since the style of coding is a bit different that I'm used to but soon realized that its one of the best libraries written for SIM800 (in my opinion). Obviously I use it in my project as well. I made a weather station with special dedication to measure wind speed and send it to my web page https://github.com/jaka87/vetercek_WS/ We are just a few days before going live.

carrascoacd commented 5 years ago

Looks nice your project! I'm going to close the PR and apply the changes, I'm glad it help you

jaka87 commented 4 years ago

Hi. With the new commit where GPS location function is in the second file i can't get to call it. Maybe I'm nof familiar with the classes or there is an error in the script.

Trying Geo.readGpsLocation(gps); // GPS location i get

expected unqualified-id before '.' token 41 | Geo.readGpsLocation(gps); // GPS location | ^ exit status 1 expected unqualified-id before '.' token

trying http.readGpsLocation(gps); // GPS location i get

'class HTTP' has no member named 'readGpsLocation' 41 | http.readGpsLocation(gps); // GPS location

carrascoacd commented 4 years ago

Hi Jaka,

I'll document how to use it after having a final version, but meanwhile try this:

unsigned int RX_PIN = 7;
unsigned int TX_PIN = 8;
unsigned int RST_PIN = 12;

Geo geo(9600, RX_PIN, TX_PIN, RST_PIN);

char location[80];
geo.readGpsLocation(location);

I need to refactor the library as Geo extends all the functionality from HTTP where it shouldn't, this is an unstable version as I didn't try it yet in my weather station actively.

Let me know if it works.

jaka87 commented 4 years ago

Thx for the reply. I have tried your code and I get folowing error.

error: no matching function for call to 'Geo::Geo(int, unsigned int&, unsigned int&, unsigned int&)'
   60 | Geo geo(9600, RX_PIN, TX_PIN, RST_PIN);

I assume some changes have to be made in Geo.h

Also at home i get excellent signal and have no problem connecting to network, but on the other location signal is quite poor. Because of that my arduino resets from time to time. I guess its because sim module use more energy (short bursts) when signal is bad. So far i had 1000uF cap instaled to prevent that but will try with 3300 and different antenna. Anyhow to follow signal strength i wrote following function if you might want to include it....

void HTTP::readSignalStrength(char *signalq){
  char buffer[32];
  cleanBuffer(buffer, sizeof(buffer));
  cleanBuffer(signalq, sizeof(signalq));

  sendCmd(SIGNAL_QUALITY);
  if (readBuffer(buffer, sizeof(buffer)) == TRUE){
    parseATResponse(buffer, 2, 2, signalq);
  }
}
carrascoacd commented 4 years ago

Jaka please pull the changes of the library and try again, I made some changes here https://github.com/carrascoacd/ArduinoSIM800L/commit/5c08243db57dd463f14660a68f5b981e8dc8e204

Thanks for sharing the function

jaka87 commented 4 years ago

Seems to be working! I have been testing for few hours... I will let you know in next few days if some trouble occur.