Go Down

Topic: Best way for a persistent and reliable GSM connection (Read 1 time) previous topic - next topic

arduzzino

Hello guys,
I'm developing a reliable (!) environmental monitor with Arduino UNO + Arduino GSM Shield, always on 24/7. Of course GSM Shield will send alert if things (temperature, smoke etc) go wrong.

But also, if with my smatphone I make a call -or send an SMS- to the GSM Shield, I would to receive an SMS with the general status of all sensors. Unfortunately, in developing this feature, I have a critical doubt which is very hard to test: is it safe to invoke gsm.begin() in void setup() and leave it for days and weeks? For example, what happens if during holidays the GSM network is unavailable (also just for an instant) or the cell goes away for a while?

Maybe the best solution could be to check the status of GSM network in void loop() -and if it's down then restore network access…as soon as possible- but I'm not able to find the right way to develop a very reliable service with GSM library.

Thank you in advance for your support.

SupArdu

hi,
did you get a solution?
I am interested in a solution too because I have a similar problem with my GSM shield which shall send data to a server every 5 minutes and also 24/7.

I see the problem how to check if GSM is connected.
If there is a reliable method to check this then a call to gsmAccess.begin(...) within loop() could solve the problem.
Or are there more problems?

SupArdu
-------------------
have success
SupArdu

enayet123

Hey,

I have a function that checks the status of my SIM900 module and if there is an error it toggles the power which will switch it off if it is on already then it runs another check. If the device is still returning nothing then it powers it back up and waits for feedback. If successful it will do nothing but check it every 10 seconds.

Are you guys using the SIM900? If so you can try something like this:

Code: [Select]

void powerToggle() {
  if (result) Serial.println("[Arduino] SIM900 connection lost");
  Serial.println("[Arduino] Toggling SIM900 Power");
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(5000);
  count=0;
}

bool turnOnDevice(bool silent, int maxLostConns) {
  if (!silent) Serial.print("[Arduino] SIM900 Status: ");
  simController.println("ATE0\r");
  if (checkDeviceStatus(silent)=='K') return true; else count++;
  if (count==maxLostConns) powerToggle();
  return false;
}

void initialDeviceCheck() {
  Serial.println("[Arduino] Initial Checks Running");
 simController.begin(19200);
  if (result) Serial.println("[Arduino] SIM900 already checked");
  else Serial.println("[Arduino] SIM900 not checked");
 do { result = turnOnDevice(false,3); } while (!result);
}


I also have the ability to restart the Arduino/SIM900 module/Both over text let me know if you want to see the code

BaharuddinAziz

enayet123,

may I know which library that you used? I feel something miss on example code that you give. If you do not mind, may I get more explanation on using that code?

MertG

Enayet123 do you still have the code? Can you share it if you don't mind?

Go Up