Automatic Snow Wake-up Call

5,529

33

8

Introduction: Automatic Snow Wake-up Call

Getting out of the house in the morning can be a flurry of activity after a few inches of the white stuff settles over night. Wouldn't it be nice to be woken up a little earlier on those days to take the stress out of the morning? This project does just that!

This project uses an Arduino, a distance sensor, and IFTTT (an easy to use website) to automate a wake-up call to your phone if it's snowed overnight. Once ready, you'll place the device you built at a high point (for example on a tripod) and point it down at the ground. From there it will constantly measure the distance between itself and the ground. As it snows, the "ground" moves up towards it, so the distance it measures decreases. If there's a big enough difference between the evening and the morning, the device will alert you that it snowed!

The electronics are simple to connect and I'll provide the code, so let's jump right in!

Supplies:

  1. A Wifi enabled Arduino-compatible microchip. For this project I'm assuming you'll use the ESP8266 NodeMCU Development Board, which I recommend for many reasons:
    • It has Wifi built in.
    • It exposes pretty much all the pins you might want.
    • It provides an easy USB interface for programming.
    • It handles the board reset when uploading code, and exposes reset buttons for debugging.
  2. A TF Mini Lidar range sensor.
    • Note there are cheaper ultrasonic sensors like the HC-SR04, but soft snow muffles sound enough that they don't work for this.
  3. A mini breadboard.
  4. A tripod or any solution for mounting the sensor a few feet above the snow.
  5. A micro usb cable.
  6. An extension cable.
  7. A usb charger.
  8. A plastic container.

Note, items 5 and above can be bought at Dollar Tree pretty easily.

Prices vary, but I was able to do this project for around $50 (not counting the tripod) by shopping at Dollar Tree for the simple parts. The most expensive part by far is the Lidar sensor, which can definitely be re-used for other projects.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Electronics (Hardware)

The electronics for this project should be pretty quick to assemble. Just connect the TF Mini Lidar Distance Sensor to the chip. The wires should connect as described in this excellent SparkFun guide.

Here's a quick summary:

Sensor -> ESP8266

Green -> D2 (aka GPIO 4, which we will use as our RX)

White -> D1 (aka GPIO 5, which we will use as our TX)

Red -> Vin

Black -> Gnd

Step 2: Electronics (Software)

The decision to send you a wake-up call will be made by your microchip, so we need to program it appropriately! To program your chip, we'll use a language called Arduino which you can upload to your chip using the Arduino IDE (software that runs on your computer).

1. Download the Arduino software here. This guide will be referencing the Arduino Desktop IDE menus, so go ahead and download that unless you're super comfortable with the Web IDE.

2. Set up your Arduino Desktop IDE to work with the ESP8266 microchip. The instructions for that can be found here. Going forward, this guide assumes that you got your LED blinking and know how to upload a script to the ESP8266.

3. Download the script to upload to your microchip from https://github.com/robertclaus/snowalert. No need to edit the script. Everything you need to configure will be configurable after you upload the code.

4. Open the script in Arduino and install the libraries it depends on in your system. At the top of the IDE, click: Sketch -> Include Libraries -> Manage Libraries

Then search for and install these libraries:

  • WifiManager by tzapu (version 0.14.0)
  • ArduinoJson by Benoit Blanchon (version 6.14.1)
  • TFminiArduino by hideakitai (version 0.1.1)
  • NTPClient by Fabrice Weinberg (version 3.2.0)
  • ESP_DoubleResetDetector by Khoi Hoang (version 1.0.1)

5. Configure your board for this project. At the top of the IDE, click Tools and adjust these settings:

  • Flash Size - 4M (1M SPIFFS) -- This reserves space for our configuration to be saved.
  • Erase Flash - All Contents -- This makes sure there isn't previous data on the chip.
    • Note, if you ever need to update the code, setting this to Sketch Only will preserve your configuration.

6. Make sure your ESP microchip is plugged into your computer and has an assigned port. Select the correct port in the IDE, and upload!

7. Open the Serial Monitor (Tools -> Serial Monitor) in the Arduino IDE. Then click the Reset button on your chip. Confirm that you get text showing in the Serial Monitor

      Step 3: IFTTT Configuration

      Now that your Arduino is running, we need to configure it to do what we want. For this tutorial, we will use a service called IFTTT that allows us to translate a simple message from our Arduino to more complicated actions.

      For example, if our Arduino says "It Snowed!" then IFTTT should call our cell phone with a wake-up call.

      1. You'll need a free IFTTT account, which you can create at https://ifttt.com/join

      2. To create the new Applet that uses this logic, navigate to Create, or just follow this link: https://ifttt.com/create

      3. Click on This -> Search and select Webhooks -> If it asks you to, click Connect -> Enter snow_alert in the box.

      4. Click on That -> Search and select Phone Call (US Only) -> If it asks you to, click Connect -> If you get a popup, follow the prompts -> Enter a message like It snowed last night! that you would like the phone call to read out for you.

      5. Click Finish to activate your applet.

      6. Test your Webhook by navigating to your Webhooks service settings in IFTTT, and finding the test URL listed there. Navigate to that URL and replace {event} with snow_alert. Then click Test It. If everything is working, you should receive a phone call!

      7. On the test page, save the url towards the bottom of the page. You'll need it in a later step. It should look something like this:

      https://maker.ifttt.com/trigger/snow_alert/with/key/d-Y8rXge5kibp0dkdrCgxu

      For debugging issues, users may also want to log the snow height over time. They can configure a separate IFTTT applet that accepts the snow_measurement webhook and logs to Google Sheets. To do this, simply repeat the steps above, but replace snow_alert with snow_measurement in the Webhooks step above and replace the Phone Call step with the Google Sheets service -> Add row to spreadsheet.

      Step 4: SnowAlert Configuration

      At this point the last software step is configuring the code on your ESP to send the messages to your new IFTTT applet.

      For this configuration, I'm going to recommend you follow the SnowAlert instructions on Github because the instructions here might be outdated if SnowAlert gets new features.

      At the time of writing these instructions, you would do the following.

      Very importantly, all the times you configure need to be in the UTC timezone and in 24 hour time format (not AM/PM).

      1. Decide what time you want to receive the call in the morning. This is your End Time.
      2. Decide what time to start measuring the previous evening. This is your Start Time.
      3. Plug in your ESP and open the Serial Monitor in the Arduino IDE like we did previously.
      4. Connect to the SnowMeasure wifi network on your computer. You should see some activity in the Serial Monitor as you connect.
      5. You should be directed to a setup page in your browser automatically after a few seconds.
      6. Click Configure Wifi
      7. Enter the following values:
        1. SSID - The wifi network the ESP should connect to for internet.
        2. Password - The password to connect to that wifi network.
        3. Start Hour - The hour you want it to measure the snow height in the evening.
        4. Start Minutes - The minute component to the time you want it to measure in the evening.
        5. End Hour - The hour you want it to measure the snow height in the morning (and potentially call you)
        6. End Minutes - The minute component to the time you want it to measure in the morning.
        7. The Alert Webhook URL - This should be the url you saved in the previous step that looks something like this: https://maker.ifttt.com/trigger/snow_alert/with/k...
        8. The Measurement Webhook URL - This should be the same url as above, but replace snow_alert with snow_measurement

      Step 5: Mount the Sensor

      At this point everything should be ready to go. You'll want to cut holes in the plastic container, and mount it somewhere a few feet off the ground. How exactly you mount it will depend on your parts and goal, but here are a few recommendations to get it right.

      • Make sure your sensor is facing down at a slight angle. You don't want it looking straight down since your box will cast a shadow where the snow doesn't hit the ground.
      • You'll want the sensor up off the snow about 2-3 feet.
      • Snow melts into water, so make sure your setup is reasonably waterproof.
      • Make sure you have power! Either a long usb cable, or an extension cord should get you away from a roof to get to a useful spot. Either way, make sure that it's safe outside.

      Step 6: Get the Call!

      If everything goes according to plan, you should get the call in the morning if it snows. If something isn't working, check your distance logs in Google Sheets to see what was actually measured.

      Snow Challenge

      Runner Up in the
      Snow Challenge

      Be the First to Share

        Recommendations

        • Trash to Treasure Contest

          Trash to Treasure Contest
        • Raspberry Pi Contest 2020

          Raspberry Pi Contest 2020
        • Wearables Contest

          Wearables Contest

        8 Discussions

        0
        GTO3x2
        GTO3x2

        15 days ago

        A casual glance at the Lidar sensor shows an operating temperature of 20-60°C and 70,000 lux. Has this worked in practice?

        1
        rclaus
        rclaus

        Reply 14 days ago

        Ya, hasn't had any noticeable issues for me down to ~ -10°C during the night. I haven't had it outside on a really cold night yet. I might just be getting lucky though.

        Another user suggested swapping out for a cheaper VL53L0X sensor, which I checked the spec sheet for and shouldn't have any issues down to -20°C. I think that would be all around better for the project, but I haven't tested it with snow yet. :)

        0
        EdF44
        EdF44

        15 days ago

        Lovely idea- well done. I might have to build something like this, although it's going to have to be sensitive as the UK grinds to a halt with only a few mm of snow!

        You up for a few constructive suggestions that might make it a bit easier/cheaper especially for newbies?

        I am a big fan of the M5StickC ESP32 module for projects like this one - in comes a case with a tiny colour display for about $10 from China. And for $6.50 you can get a time-of-flight distance sensor module that will just plug in and should, I think, have the accuracy you need. It's tiny and can run on a meter-long wire, which could be handy for locating the ESP32 in the dry. This leaves only the sensor needing some protection from the elements.
        See: https://m5stack.com/collections/m5-core/products/stick-c?variant=17203451265114
        See: https://m5stack.com/products/tof-sensor-unit

        I'm busy making myself a little 3d magnetometer using the same module and programmed in Micropython - 'cos it's dead easy. Hopefully I'll post that project but at the moment I'm stuck waiting for PCB's from Shenzen.


        20200210_225934.jpg
        0
        rclaus
        rclaus

        Reply 14 days ago

        I hadn't seen the M5StickC yet. With all the random peripherals and battery built in I might have to order one or two for future projects!

        I'm slapping myself for not thinking of the simpler tof sensor (VL53L0X) when I was putting this together. I had one lying around I could have used!

        Thanks for the great suggestions!

        1
        RobC173
        RobC173

        15 days ago

        It seems that a change in mass might be easier... BUT, this is very cool and creative.

        0
        homer6
        homer6

        Reply 15 days ago

        I had the idea of monitoring the weight of the snow pan, myself. Wonder whether the effects of wind on the measuring devices might disrupt things.

        Agree with you that this is definitely creative. And being snow, it's apt to be cool, also.

        0
        rclaus
        rclaus

        Reply 15 days ago

        You're totally right that it would be easier! It should be fairly straight forward to swap out the sensor and invert the detection logic in the Arduino code. Here's an example sensor you could use: https://www.amazon.com/MakerHawk-Converter-Breakout-Portable-Electronic/dp/B07GQPV6C4

        Fun fact (not really impactful for this rough application), it is surprisingly difficult to correlate snow weight back to height because fresh snow density can vary by quite a bit. See page 5 in here for some example charts: https://ccc.atmos.colostate.edu/pdfs/Judson_Doesken_DensityFreshFallenSnow_BAMS.pdf

        1
        seamster
        seamster

        16 days ago

        Excellent idea, I definitely could use this in my life!