Get Emails & Alerts From Sensors

by michaelgiller in Circuits > Arduino

563 Views, 12 Favorites, 0 Comments

Get Emails & Alerts From Sensors

Setup Arduino to Send Alerts

Intro

Remember that fantastic Arduino project. The one that monitors your environment then shows you a flashing LED. The one that prints a detailed error on a 0.91-inch display. Maybe even buzzes an annoying sound at you. Bet you, all it did was annoy your cat.

If only you could send a notification to yourself. One that will reach you regardless of where you are. Maybe even an email.

Well, with Zentser you can do just that. Zentser helps you create mobile notifications from sensors in five easy steps.

After the setup, you will also be able to view graphs, set up thresholds for Alerts, and export data to run it through AI/ML models.

Let me show you how.

Supplies

Mobile App:

Zentser for iOS (install) or Zentser for Android (install)

Software:

Arduino IDE (download)

Hardware:

ESP8266 (buy) low-cost microcontroller with Wi-Fi

DHT22 (buy) accurate temperature & humidity sensor

Step 1: Arduino IDE

610aba5812067037ecf905eb_Arduino 1.png
610abb41c288d0938989edf5_Arduino 2.png

If you haven't yet, download and install Arduino IDE.

Then go to Tools > Manage libraries.

Search for 'Zentser'

Install Zentser ESP SDK and Install additional dependencies

Now go into File > Examples, and scroll down to “Zentser ESP SDK”, and you have the sample template code with all the included libraries.

Step 2: Zentser Mobile App

60f9a974c3cced008df4a005_1.png
60f9a98bd7a85350a881c882_2.png
60f9a9a5668856723be299ab_3.png
60f9aa68f2dbe71590f9ac1a_4.png
60f9aa855e0b0c15dfef9f94_5.png

Install the app for iOS or for Android.

Sign up After installing and launching the app, sign up. You can register by validating your email and creating an account. Alternatively, authenticate with your social Google or Facebook identity.

In the app, create a new device. Before you click the “Create device” button, I recommend editing your “Device name” and “Sensor name” text fields. As a naming best practice:

For “Device name” enter where or what you are measuring. For example, I would enter ‘Basement’ for tracking that the temperature there is above freezing For “Sensor name” enter what you are measuring. Optionally, include the units. For example, I would enter “Temp (F)” Now click “Create device”

Once you see generated code for your device, click on “Export code” to send yourself a copy. You will need to get it over to a computer to program your ESP2866 microcontroller. You can mail the code to yourself or save it in a cloud storage file.

Step 3: Hardware

Hardware diagram.png

Here’s the hardware I use for my personal configuration:

  • ESP8266 - a low-cost microcontroller with Wi-Fi
  • DHT22 - an accurate temperature & humidity sensor

Triple-check your positives and negatives before connecting the wires. If you smell a burning smell, you know you fried something. Toss the burnt part and try again.

Now connect your ESP8266 microcontroller to a micro-USB, then plug a regular USB end into your computer.

Make sure to use a data cable USB. Do not use a charge-only USB cable. It won't program your microcontroller

Step 4: Program the Device

610abd9a3fe292d2e3d878c1_Arduino 3.png
610abe2aa324f96173638550_Arduino 4.png
610abfd4fb7bea4262a032f2_Arduino 5.png
610ac0d2380a5bc8b74a4331_Arduino 6.png
610ac195c030f7f768d936d9_Arduino 7.png

In the Arduino IDE, we will need one additional library with its dependencies for the DHT sensor.

Also, ensure that the connected board is the correct esp8266 and the Port is correctly selected.

Then in the template code, enter your Wi-Fi information so that the board can successfully connect to the internet. Replace everything between the “--- START ---” and “--- END ---” comments with the code that you saved from Zentser mobile application. Then verify the sketch compiles successfully.

After you see that there are no issues in compiling, upload the code to the microcontroller.

You can check on the serial monitor that the information is sent successfully from your sensor to Zentser.

Step 5: Almost Done

60f9d3e0610e8208828b6dfd_Configured Sensor in Zentser.png
Threshold Config.png

Go back into your mobile Zentser app. You should now see a numeric value presented for your device. If you drill down, you can even see timeline graphs with your temperature readings.

Click on the section "Below and Above Values." There you can edit the thresholds and enable notifications to trigger when the comfort range is exceeded.

Now you can use a similar setup to detect:

  • Leaks in the laundry room
  • Baby wake up noises
  • Flammable and poisonous gas detection
  • When to empty the dehumidifier
  • and more