Good day
I've recently done a small "Wireless Panic button" project where an sms is sent to a number of people when the button is pressed., but I'm experiencing some intermittent issues.
First let me list what hardware I'm using:
Arduino Duemilanove
Seeed GPRS Shield V2.0
Wireless Receiver with single Relay (standard type that is used for Gate motors, etc)
Wireless Remote Transmitter
Single pushbutton used as input to send a test message
LED - indicate when a test button or panic button is pressed.
Everything is powered through a 12Vdc Plug, connected to the Arduino, and then the 5V of the Arduino is used throughout the system, for inputs, etc.
The issue I'm having is that the device is sending an sms by itself once or twice a week without anyone pressing the buttons. That said, it is as if the inputs on the micro-controller is toggling itself, or floating. At first I used a Pull up Resitor configuration for the the inputs, and after experiencing the issue, I changed the wiring to a Pull-Down resistor configuration but with the same results.
Does anyone have any reasoning behind this issue? Any Ideas, suggestions,solution will be much appreciated.
I'm looking to find a permanent solution for this issue, as it is quite an important application which need to be quite reliable without any "False Alarms".
Thank you in advance
Q
Sample of my code below
[tt]
#include <SoftwareSerial.h>
#include <String.h>
//Select Software Serial Pin Numbers
SoftwareSerial mySerial(7,8);
const int buttonPin = 2; // Remote pushbutton pin
const int TestButtonPin = 3; // Test pushbutton pin
const int ledPin = 13; // LED pin
// variables will change:
int buttonState = 0; // variable for reading the Panic Button status
int TestButtonState = 0; // variable for reading the Test pushbutton status
void setup()
{
//Software Power ON for GPRS Module
pinMode(9, OUTPUT);
digitalWrite(9,LOW);
delay(100);
digitalWrite(9,HIGH);
delay(500);
digitalWrite(9,LOW);
delay(100);
//Start Serial Connections
mySerial.begin(19200); // the GPRS baud rate
Serial.begin(19200); // the GPRS baud rate
delay(500);
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the Panic Button pin as an input:
pinMode(buttonPin, INPUT);
}
void loop()
{
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
TestButtonState = digitalRead(TestButtonPin);
// check if the Panic button is pressed.
if (buttonState == LOW)
{
// turn LED on:
digitalWrite(ledPin, HIGH);
SendTextMessage();
//DialVoiceCall();
}
// check if the Test Push button is pressed.
else if (TestButtonState == LOW)
{
// turn LED on:
digitalWrite(ledPin, HIGH);
SendTestTextMessage();
}
//check if no button is pressed, nothing will happen
else
{
// turn LED off:
digitalWrite(ledPin, LOW);
}
}
///SendTextMessage()
///this function is to send a sms message
void SendTextMessage()
{
mySerial.print("AT+CMGF=1\r"); //send the SMS in text mode
delay(100);
mySerial.println("AT + CMGS = \"+27000000000\"");// Person 1
delay(100);
mySerial.println("EMERGENCY");//the content of the message
delay(100);
mySerial.println((char)26);//the ASCII code of the ctrl+z is 26
delay(100);
mySerial.println();
delay(5000);
mySerial.print("AT+CMGF=1\r"); //send the SMS in text mode
delay(100);
mySerial.println("AT + CMGS = \"+27111111111\"");//Person 2
delay(100);
mySerial.println("EMERGENCY");//the content of the message
delay(100);
mySerial.println((char)26);//the ASCII code of the ctrl+z is 26
delay(100);
mySerial.println();
delay(5000);
}
///SendTestTextMessage()
///this function is to send a sms message to test whether the module is working
void SendTestTextMessage()
{
mySerial.print("AT+CMGF=1\r"); //send the SMS in text mode
delay(100);
mySerial.println("AT + CMGS = \"+27000000000\"");//send sms message for test
delay(100);
mySerial.println("Panic Button Test = Working");//the content of the message
delay(100);
mySerial.println((char)26);//the ASCII code of the ctrl+z is 26
delay(100);
mySerial.println(); // Prints the GPRS status on the serial connection
}
void ShowSerialData()
{
while(mySerial.available()!=0)
Serial.write(mySerial.read());
}
[/tt]