Things used in this project

Hardware components:
Hologram%20dash
Hologram SIM Card w/Device Management
×1
Dash%20image
Hologram Dash
×1
SparkFun Beefcake Relay Control Kit (Ver. 2.0)
×1
10A GFCI Power Outlet
×1
Dual Power Outlet Enclosure
×1
Dual Power Outlet Enclosure Cover
×1
Standard Power Strip
×1
2A USB Power Adapter
×1
Standard USB Cable
×1
826 04
Male/Female Jumper Wires
×1
AMP Female Disconnects (12 - 10)
×1
Push-In Wire Connectors (3-Port)
×1
Software apps and online services:
Avatar light%402x
Hologram Data Router
Ide web
Arduino IDE
Hand tools and fabrication machines:
Wire Stripper (Generic)
09507 01
Soldering iron (generic)
Screw Driver (phillips)
Precision Screw Driver Set
Cell Phone (SMS Compatible)

Code

Hologram Dash SMS Relay Control CodeArduino
Upload this code to the Hologram Dash for it to control the connected power outlet.
The Dash will accept the following SMS messages:
ON (turns the power on)
OFF (turns the power off)
RESET (turns the power off for 30 seconds, then turns it back on)
int controlPin = R04;

// EFFECTS: Strips away the length number from the payload as it's not needed.
String stripOffLengthNumber(String payload) {

  int index = 0;
  while (payload[index] == ',') {
    ++index;
  }
  while (payload[index] != ',') {
    ++index;
  }
  ++index;

  payload.remove(0, index);

  return payload;
}


void setup()
{
  SerialUSB.begin(9600);
  Serial0.begin(9600); /* TTL UART */
  SerialCloud.begin(115200);
  pinMode(controlPin, OUTPUT);
  delay(4000);
  
  Dash.begin();
}

char currChar;
String tempBuffer = "";
String payload = "";
bool foundSMS = false;

void loop()
{

  while (Serial0.available()) {
    SerialCloud.write(Serial0.read());
  }

  while (SerialCloud.available()) {

    currChar = (char)SerialCloud.read();

    // check if the current buffer hits the SMSRCVD code.
    if (!foundSMS) {

      if (tempBuffer == "SMSRCVD") {
        foundSMS = true;
      }
    }
    // If it received the SMSRCVD code, the payload will get populated until
    // we get a \n.
    else if (currChar == '\n'){

      SerialUSB.println("\nSMS received: ");
      Serial0.println("\nSMS received: ");

      payload = stripOffLengthNumber(payload);

      SerialUSB.println(payload);
      Serial0.println(payload);

      if (payload[0] == 'O' && payload[1] == 'N') {
        digitalWrite(controlPin, LOW);
        SerialUSB.println("Switched to ON");
        Serial0.println("Switched to ON"); 
      } else if (payload[0] == 'O' && payload[1] == 'F' && payload[2] == 'F') {
        digitalWrite(controlPin, HIGH);
        SerialUSB.println("Switched to OFF");
        Serial0.println("Switched to OFF"); 
      } else if (payload[0] == 'R' && payload[1] == 'E' && payload[2] == 'S' && payload[3] == 'E' && payload[4] == 'T') {
        digitalWrite(controlPin, HIGH);
        SerialUSB.println("Resetting... Switched to OFF");
        Serial0.println("Resetting... Switched to OFF");
        delay(30000);
        digitalWrite(controlPin, LOW);
        SerialUSB.println("Switched to ON");
        Serial0.println("Switched to ON");
      }

      // reset foundSMS and the payload for the next iteration.
      foundSMS = false;
      payload = "";
    }
    else {
      payload.concat(currChar);
    }

    // Only keep a sliding buffer length of size 7
    // (need to only check for SMSRCVD).
    if (tempBuffer.length() >= 7) {
       tempBuffer.remove(0, 1);
    }

    // add latest char to our buffer.
    tempBuffer.concat(currChar); 

    SerialUSB.write(currChar);
    Serial0.write(currChar);
  }

  delay(5);
}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Arduino Altair 8800 simulator
Intermediate
  • 6,197
  • 31

Full instructions

Ever wanted to play with the computer that sparked the personal computer age but don't have the cash to buy an Altair? Build your own!

Rocky Rover: Robotic Vision System PixyCam & Arduino 101
Intermediate
  • 4,522
  • 48

Full instructions

Using PixyCam and Intel Arduino 101 to drive this rover. Easy Robotic Vision system using PixyCam, rover reacts to the ball using Pan/Tilt.

Family, friend or foe - PIR arm/disarm using BLE
Intermediate
  • 98
  • 2

Full instructions

It's a BLE-enabled, cloud-connected smartphone app used to control & monitor who/when PIR is armed/disarmed. Uses Slack for notifications.

Sketch It (CNC plotter)
Intermediate
  • 1,122
  • 13

Full instructions

It can Sketch accurately, You just have to upload the gcode of the image.Try it it's just Awesome......My first project.

Arduino MKR1000 Weather Station
Intermediate
  • 632
  • 7

Full instructions

Weather station monitors temperature, pressure, light, dust, soil moisture values and displays on the OLED screen and Cayenne dashboard.

Running Breadboard
Intermediate
  • 409
  • 6

This is a great toy for your pets (if they are gentle) or just as a nice toy to have around the office or home.

ProjectsCommunitiesContestsLiveJobsFree StoreBlogAdd projectSign up / Login
Respect project