Daryl Lukas
Published © CC BY

Load Shedding Notifier

A simple LinkIt ONE project that sends an SMS notification when there is a power outage or when power has been restored.

BeginnerShowcase (no instructions)1,328
Load Shedding Notifier

Things used in this project

Software apps and online services

Arduino IDE
Arduino IDE
mt LinkIt ONE SDK

Story

Read more

Schematics

No Schematics

No Schematics. Just connect the battery, GSM antenna and insert a SIM card.

Code

Load Shedding Notifier Code

C/C++
Import it into Arduino IDE and upload to LinkIt ONE board. (Requires LinkIt ONE SDK)
// Include the Battery library
#include <LBattery.h>

// Include the GSM library
#include <LGSM.h>

// initialize the library instance

bool wasCharging = true;
bool batteryCharging = true;

void setup() {
  // put your setup code here, to run once:
  pinMode(13, OUTPUT);  
}

void loop() {
  // put your main code here, to run repeatedly:
  batteryCharging = LBattery.isCharging();
  bool powerStateChanged = false;
  String sms;

  if (batteryCharging) {
    // Check is power is back
    if (wasCharging != batteryCharging) {
      sms = "Load shedding has ended";
      powerStateChanged = true;
    }
    digitalWrite(13, HIGH);
  } else {
    // Check is power is gone
    if (wasCharging != batteryCharging) {
      sms = "Load shedding has commenced";
      powerStateChanged = true;
    }
    digitalWrite(13, LOW);
  }

  if (powerStateChanged && LSMS.ready()) {
    LSMS.beginSMS("0976602258");
    LSMS.print(sms);
    LSMS.endSMS();
  }

  wasCharging = batteryCharging;

  delay(60000);
}

Credits

Daryl Lukas

Daryl Lukas

2 projects • 3 followers
I love tech

Comments