Motion sensor giving false alarms

I need some help on a motion-sensor based burglar alarm. It uses a Parallax motion sensor http://www.parallax.com/Store/Sensors/ObjectDetection/tabid/176/CategoryID/51/List/0/SortField/0/Level/a/ProductID/83/Default.aspx that when triggered, sends a signal to call my cell phone via a SM5100B cellular shield https://www.sparkfun.com/products/9607. The problem is that it periodically has false alarms. I put it in an isolated room with no blinds or anything else that would move when the air conditioning turned on, but I still get the false alarms. Strangely, at one point it was triggering at the same time every hour. I added the built-in pull-up resistor and that seems to have reduced the problem, but not eliminated it. Can anyone offer a suggestion? Here's the code:

// Cell phone security alarm program, revised 6/5/2013
// Uses cell phone board and Parallax motion sensor to page
// cell phone when motion is detected

#include <SoftwareSerial.h>  //Include the NewSoftSerial library to send serial commands to the cellular module.

SoftwareSerial cell(2,3);  //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.

char qt = 34;   // Double quote mark
char cz = 26;   // Control Z
int MotionSensor = 5; // Motion sensor pin
int LED = 9;          // LED pin

void setup()
{
  //Initialize serial ports for communication.
  Serial.begin(9600);
  cell.begin(9600);
    
  pinMode(MotionSensor, INPUT);  // For motion sensor pin
  digitalWrite(MotionSensor, HIGH); // Activate pull-up resistor
  pinMode(LED, OUTPUT);  // Triggered LED
  LEDoff(); // LED off

  // Begin 60 second countdown while blinking LED
  for(int dly=0; dly<30;dly++) {
    LEDon();
    delay(1000);
    LEDoff();
    delay(1000);    
  }
}


void loop() {

  // Determine if motion sensor has been tripped
  if (digitalRead(MotionSensor)==HIGH) {
    LEDon();
    delay(2000);
    cell.println("ATDxxxxxxxxxx"); // Page cell phone when motion is detected

    delay(2000);
    LEDoff(); // LED off after 2 seconds
    
    Wait5Minutes(); // 5 minute delay to prevent repeat calls
  }   
}

void Wait5Minutes() {
  delay(300000);
}

void LEDon() {
  digitalWrite(LED, HIGH);
}

void LEDoff() {
  digitalWrite(LED, LOW);
}

In your code you are testing to see whether the MotionSensor pin is HIGH and, if it is, you are triggering the sending of an SMS message, but you also say that you have

added the built-in pull-up resistor

which would make the pin normally high anyway and trigger the alarm.

By the way, using the INPUT_PULLUP parameter on the pinMode() command makes it more obvious what has been done.

As I mentioned, I only added the pullup resistor after getting frequent false alarms. Adding it seemed to improve the functioning (fewer false alarms), even though that does seem to defy logic. I'm wondering if outside interference is to blame. Would a pull-down resistor be the better choice?

The input is normally HIGH because of the pullup resistor but your code is

  // Determine if motion sensor has been tripped
  if (digitalRead(MotionSensor)==HIGH) {

That does not make sense to me.

Actually the pullup resistor was a recent addition in my effort to cut down on false alarms. As I said, it's strange that it does work. Do you think a pull-down resistor might solve the problem?

With your code as it is and INPUT_PULLUP enabled for the pin then the alarm should be triggered as soon as the program is run then every 5 minutes. This should be the case whether the alarm sensor is in place or not.

I suggest that you reduce your program to the bare minimum and use INPUT_PULLUP in the pinMode() command. Use a different input pin in case of a possible problem with the one that you are using and output the state of the sensor to the Serial monitor.