Go Down

Topic: Lion battery backup that sends sms when power lost (Read 1 time) previous topic - next topic


May 23, 2013, 10:47 pm Last Edit: May 23, 2013, 11:00 pm by The_Knight Reason: 1

I'm building an alarm to send a text message when the AC-power fails. the problem I have,, When power is fails the alarm send  the SMS  each loop endlessly until power is restored.

I want it to send only one text-message when the power fails and happy one when power is restored. B  :smiley-red:

AC power is measured via pin 2 going incoming stream before "battery charger module"

The Alarm make a restart when it go to backup power because its a small powerdip between AC power and batterypower but when its go from AC to Battery its no dip so it dont work with "do this one time"

Code: [Select]
check = digitalRead(Powercheck);  \\ Reading pin 2, if AC = Power on 5v+
 if (check == LOW) {
                   lcd.print("Power Fail");
                   lcd.print("Skickar SMS");
                   sms.SendSMS("+46706xxxxxxx", "Warning! Power FAIL!");
 else {
                   lcd.print("Power Online");


This is untested but will give you an idea of what todo

In your code, before void.setup() add something like:

Code: [Select]
char Electricity = 1;

Then, add another if() statement around the current one as such:

Code: [Select]

if(Electricity == 1)
  // run code to send SMS
// do nothing;

Lastly, in the if statement you have, add the following to the if and else parts respectively:
Code: [Select]
char Electricity = 0;

Code: [Select]
char Electricity = 1;

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131