Pages: [1]   Go Down
Author Topic: GSM shield calls every hour  (Read 2963 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I'm working with an Arduino GSM Shield, an Arduino Uno R3 and a PIR sensor.
What I want is that Arduino calls me every time the PIR sensor fire a motion event.
I leave the GSM Modem always turned on, and what's going on is that the GSM Shield automatically calls me every hour (minute more or less) but it shouldn't!! No motion detections are fired in those cases.
I don't know why it's gonna happen. I haven't set timeouts.  smiley-eek

Here is the sketch:

Code:
#include <GSM.h>

GSM gsmAccess;
GSMVoiceCall vcs;
String remoteNumber="my-number";
char charBuffer[20];
int digitalPir = 4; // Pir connected to digital pin 4
int statePir = HIGH; // we start assuming no motion detected

void setup()
{
  pinMode(digitalPir, INPUT);
  remoteNumber.toCharArray(charBuffer, 20);
  Serial.begin(9600);
  Serial.println("\n- Starting Setup -\n");
 
  // connection state
  boolean notConnected = true;
 
  // start GSM Shield
  while(notConnected) {
    if(gsmAccess.begin()==GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }
  }
  Serial.println("Setup completed!");
  Serial.println("waiting for 10s...");
  delay(10000);
}

void loop()
{
  statePir = digitalRead(digitalPir);
  Serial.println(statePir);

  if (statePir == LOW) {
    if (vcs.voiceCall(charBuffer)) {
      Serial.println("Call Established.");
      while(vcs.getvoiceCallStatus()==TALKING);
      vcs.hangCall();
      Serial.println("Call finished.");
      delay(1000);
    }

    Serial.println("Waiting for 30s...");
    delay(30000);
  }
}

Any tips, please?
Logged

IDE 1.0.5 - Arduino Uno R3 - Arduino Wifi Shield - Arduino GSM Shield -  IMU Digital Combo Board 6 DOF ITG3200/ADXL345

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The problem seem to be the PIR sensor, so I'm gonna change it and try again.
Logged

IDE 1.0.5 - Arduino Uno R3 - Arduino Wifi Shield - Arduino GSM Shield -  IMU Digital Combo Board 6 DOF ITG3200/ADXL345

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys,

I'm here again.
I get the same problem after I tried with a new different PIR sensor (HC-SR501): the GSM Shield calls me every hour!!!
I don't know what else to do smiley-sad
Logged

IDE 1.0.5 - Arduino Uno R3 - Arduino Wifi Shield - Arduino GSM Shield -  IMU Digital Combo Board 6 DOF ITG3200/ADXL345

Madrid (Spain)
Offline Offline
Full Member
***
Karma: 0
Posts: 135
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

PIR sensors are very sensitive with radio communications, they can give false positives with a simple communication.  Check with your serial monitor if is a problem of sensor or a problem of GSM library when it executed.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for replying me davidgoth.
I will consider it, I’m still trying to make it work.
Logged

IDE 1.0.5 - Arduino Uno R3 - Arduino Wifi Shield - Arduino GSM Shield -  IMU Digital Combo Board 6 DOF ITG3200/ADXL345

Pages: [1]   Go Up
Jump to: