Introduction: Wemos Heat Pump Failure Alarm

How it works
Sensor stores temperature in Thingspeak. Thingspeak reacts to low temperature (Heat pump failure) or no updates (No Wi-Fi or power loss) and sends trigger word to Maker. IFTTT sends notifications (email) depending on trigger word.

Step 1: Background and Plan

Background

A colleague asked me for a alarm to notify if the heat pump for any reason stops working while on vacation. I first looked for a solution that was pre-made but couldn’t find any, then thought of building an alarm with a esp8266 but no power means no Wi-Fi, so that didn't work. I needed a “if not a trigger then notification”. Not many trigger-services are set up that way, but a combination of thingspeak and IFTTT turned out to be the solution. Since I didn’t find any Instructables on this I decides to write my very first Instructable. I am a beginner in electronics and programming so have mercy on my layman terms and simplifications. The main purpose of this Instructable is not the creation of the sensor that sends data to Thinsspeak but the overall solution.

Major steps

  • Create a temperature monitor that updates to Thingspeak
  • Setting up accounts on Thingspeak and IFTTT and get IFTTT-app on phone
  • Setting up Thingspeak:
    • Set up a temperature graph in Thingspeak
    • Create a “React” in thingspeak that sends a Trigger to Maker in IFTTT when temperature is under certain level
    • Create a “React” in thingspeak that sends a Trigger to Maker in IFTTT if no data is arriving to Thingspeak
  • Setting up IFTTT
    • When IFTTT (Maker) gets a Trigger sends notifications telling me that

I learned quite a lot in this project and I hope you do to:

  • Thingspeak
  • IFTTT
  • deep sleep
  • Wi-Fi manager

BOM

  • A esp8266 or similar (I use a Wemos)
  • “Any” sensor (shown here is Wemos SHT30 Shield and Dallas ds18b20 variants)
  • Account on thingspeak
  • Account on IFTTT
  • Smartphone

Step 2: Setting Up Accounts on Thingspeak and IFTTT

Just follow the official guide for the accounts.

Setting up account on Thingspeak: https://thingspeak.com/users/sign_up

Setting up account on IFTTT and download app on phone: https://ifttt.com/join

Step 3: Setting Up Thingspeak - Channel for Temperature

  • Log in
  • New Channel
  • Choose channel name, description and name of field 1. (for example: "Vacationguard", "Measures temperature with a Dallas 18b20", "Temperature").
  • Write down the "Write API key" found in "API keys" for later

Step 4: Thingspeak - ThingHTTP

We do the ThingHTTP first because the ThingHTTP will need to point to a React.

A ThingHTTP with URL: https://maker.ifttt.com/trigger/TemperatureLow/with/key/YOURKEY and the rest as shown in picture.

And another ThingHTTP with everything the same but the trigger that is NoUpdate instead of TemperatureLow.

Step 5: Thingspeak - React

Create two reacts under apps/actions/react as shown in pictures.

Step 6: Setting Up IFTTT

    In my applet first create one IFTTTs:

    • New applet
    • Press +this:
    • Search for "Maker webhooks" and click it
    • Connect (if first time)
    • Choose trigger: "Receive a web request"
    • Enter a Event Name ("NoUpdate") for the trigger and press "Create trigger"
    • press +that
    • Search for "email" and click it
    • Choose action: "Send me an email"
    • Edit the Subject and body, for example:
      • Subject: Data have not been updated as expected. Power or Wi-Fi may be off. Trigged: {{OccurredAt}}
      • Body: -

    Then make another applet the same way but with:

    • Event name: TemperatureLow
    • Subject: TemperatureLow
    • Body: Temperature under limit. Current temperature: {{Value1}} Occured at: {{OccurredAt}}

    Step 7: Creating the Sensor

    The sensor can be made in a number of ways. When I first tried this I made it simple and used a Wemos (https://www.wemos.cc/) and Wemos SHT30 shield. If using the SHT30 shield only minor soldering of headers is needed. The connection between D0 and RST in the photo is only a wire and not soldered. Solder it on top of the SHT30 instead to get good connections if using the SHT30 shield.

    I later used a Wemos and a Dallas ds18b20 so that I could fit it into the enclosure I had in mind. I needed to use machine headers for the height but normal headers work just as well if in other enclosure.

    G directly to ground pin on Dallas ds18b20

    D3 to one side of 4,7kOhm resistor then continuing to middle pin of Dallas ds18b20

    3.3V to one side of 4,7kOhm resistor then continuing to power pin of Dallas ds18b20

    In the fritzing illustration the banded wires are on the underside of the board and I did not draw the short connections between the headers and the wires on the bottom. Look at the pictures to get a better view of the connections.

    The lovely enclosure was bought on Ebay:

    http://r.ebay.com/VNOO7u

    Step 8: The Program

    The program is a combination of examples from the wonderful libraries more talented people have written. It samples the temperature and sends it to Thingspeak. I added deepsleap since the Wi-Fi is quite warm and heated the sensor. I also added Wi-Fi manager so that the person that gets the sensor can enter the Wi-Fi and password himself.

    I made two versions and have attached both the program with the SHT30 and the Dallas ds18b20.

    The code is found here and the location of the libraries used is listed below and in the code.

    https://thingspeak.com/

    https://github.com/wemos/WEMOS_SHT3x_Arduino_Libra...

    https://github.com/esp8266/Arduino

    https://github.com/tzapu/WiFiManager

    https://github.com/bblanchon/ArduinoJson

    When uploading program, disconnect the Wemos since the D0-RTS will give upload problems.

    Microcontroller Contest 2017

    Participated in the
    Microcontroller Contest 2017