Spark Core Water (+Temp + Humidity) Sensor with SMS Alerts Using IFTTT and SmartThings integration
C++ Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
case
firmware-with-dht
firmware
images
.gitignore
LICENSE.txt
README.md
ifttt.json

README.md

Particle (Spark) Core / Photon / Electron Water Sensor

By Nic Jansma

This is an internet-connected water sensor that will alert you via SMS (or any other webhook via IFTTT) if water is sensed.

I am currently using this near my sump-pump to alert me if the pump fails. It can be run from either AC or battery power.

Hardware

For hardware, I'm utilizing a Spark Core hooked up to a Grove Water Sensor.

Nowadays, there are even cheaper options from Particle (formerly Spark), such as the Photon or Electron.

The Grove Water Sensor's three wires (power, ground and data) are soldered to the top of the device.

Spark Core

I've 3D printed a simple "seat" for the Core to sit on so the external pins don't short. The STL is included under case/.

Spark Core Case

The Core is taped to my sump pump's pipe, and the Water Sensor is taped just below ground-level in the sump pump water pit.

Grove Water Sensor

Firmware

The Spark Core firmware is available under firmware/. It should work for a Photon or Electron as well.

The firmware publishes these two events to the Spark Cloud:

  • online when the device first starts up
  • water_alarm when water is sensed. The payload is either on or off.

The firmware also exposes two variables:

  • alarmStatus: 0 means not in alarm state, and 1 means the alarm is active.
  • water: 0 means no water detected, and 1 means water detected.

With Temperature + Humidity Sensor

In addition, there's also a version of the firmware available that's a combination Water Sensor plus a Temperature and Humidity logger, based on the dht-logger project. To use this combination sensor, check out the firmware-with-dht/ folder.

Software

The previous version of this sensor used a NodeJS app to monitor for events from the Spark Core. This app would then use the Twilio API to send me a SMS when there was an alarm.

Particle now offers Webhooks, which does this job for you. You don't have to run a NodeJS app. Once it senses an event from your Spark Core / Photon / Electron, it will publish an event to any web URL you specify.

Instead of using Twilio for SMS, I am now using IFTTT to send me an email, SMS and a Pushbullet notification all at once -- for free!

The creation of the Particle Webhook is pretty simple. First, install the particle-cli NPM module:

npm install -g particle-cli

Then, make sure you're logged in:

particle login

Next, create an IFTTT account. Then, create a IFTTT Maker page. On there, look for your private key (under Your key is).

Then, create a file called ifttt.json into your directory (see the sample in this repo). Replace [your maker key] in that file with your private key. It should look something like this:

{
    "eventName" : "water_alarm",
    "url" : "https://maker.ifttt.com/trigger/alert/with/key/[your maker key]",
    "requestType" : "POST",
    "query" : {
        "value1" : "Water Alarm",
        "value2" : "{{SPARK_EVENT_VALUE}}"
    },
    "mydevices" : true
}

Last, you need to tell Particle how to integrate with IFTTT. Do this:

particle webhook create ifttt.json

You should see a success message. You're all set!

SmartThings

This device can be hooked up to a SmartThings hub.

See my smart-things project for a sample Device Handler.

SmartThings

Parts and Cost

Total cost is around $21.90: