<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Initial State - Medium]]></title>
        <description><![CDATA[IoT Dashboards for Real-Time Data - Medium]]></description>
        <link>https://medium.com/initial-state?source=rss----cc2c6209cafb---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Initial State - Medium</title>
            <link>https://medium.com/initial-state?source=rss----cc2c6209cafb---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 07 Apr 2026 19:22:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/initial-state" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Shhh! The Baby’s Sleeping: Our Fun DIY Adventure in Noise Monitoring]]></title>
            <link>https://medium.com/initial-state/shhh-the-babys-sleeping-our-fun-diy-adventure-in-noise-monitoring-eab49cdc2ab0?source=rss----cc2c6209cafb---4</link>
            <guid isPermaLink="false">https://medium.com/p/eab49cdc2ab0</guid>
            <category><![CDATA[baby-sleep]]></category>
            <category><![CDATA[pico-w]]></category>
            <category><![CDATA[diy-projects]]></category>
            <category><![CDATA[initial-state]]></category>
            <category><![CDATA[noise-detection]]></category>
            <dc:creator><![CDATA[Gaurav Marmat]]></dc:creator>
            <pubDate>Wed, 30 Aug 2023 17:54:35 GMT</pubDate>
            <atom:updated>2023-08-30T18:03:59.067Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M9TyDgXWmOr55di_ANTRoQ.png" /></figure><p>Okay, folks, gather around for a story — it’s adventure time!</p><p>You know how our little bundles of joy, our babies, are the superheroes of sleep? They have the superpower to sleep through anything, and yet another superpower to wake up to the quietest sound! So, this adventure is all about how I created a ‘Silence Guardian’ for my baby’s room using some cool tech.</p><p><strong>Once Upon a Tech Time…</strong><br>Our quest begins with the mighty Raspberry Pi Pico W, a microcontroller with WiFi superpowers, and a friendly sidekick — a low-cost LM393 sound detection module. This dynamic duo teamed up to listen for any sounds that might disturb our sleeping superhero.</p><p><strong>To the Cloud!</strong><br>But what’s a superhero story without some magic? That’s where <a href="http://initialstate.com/">Initial State</a> comes in. It’s a magical realm (data streaming service) where the Pico sends signals (sound detection events) if it hears a loud noise. Initial State keeps an eye (or ear!) on these signals and sends a message in a flash (text notification) if it detects a loud event.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4AuoadJGypGsZu1moavVCw.png" /><figcaption>Text Notifications to your phone</figcaption></figure><p><strong>Casting Spells with MicroPython</strong><br>Every magic trick needs a spell, right? Our spell is written in MicroPython, a wizard-friendly version of Python 3 that’s perfect for casting spells (coding) on microcontrollers.</p><p><strong>The Adventure Unfolds</strong><br>We embarked on our quest with great enthusiasm, but every good adventure has its challenges. We first tried using a magic tool called Direct Memory Access (DMA), but it proved to be a tricky beast. So, we took a different path, treating our LM393 sidekick as a simple ‘yes/no’ sensor (high/low signal) and monitoring small ‘rolling’ windows of time to detect noises.</p><p><strong>The Art of Listening</strong><br>We spent some time fine-tuning our noise detection. It was like teaching our Pico to understand the difference between a whisper and a shout. I used a magical device called <a href="https://www.tek.com/en/products/oscilloscopes/5-series-mso">an oscilloscope</a> that lets me see the sounds the Pico was hearing, making it easier to adjust our noise detection. But even without an oscilloscope, you can teach your Pico to listen — just use print statements in your spell (code) to understand what it’s hearing.</p><p><strong>And They Lived Quietly Ever After</strong><br>Our DIY adventure turned out to be a great success! We’ve become the guardians of silence for our little superhero’s dreams. And the best part? If we’re too loud, our phones get a text, reminding us to use our inside voices.</p><p>So, fellow adventurers, are you ready to embark on your own quest for quiet? Grab your gear, cast your spells, and let’s give our little superheroes the peaceful dreams they deserve!</p><p><strong>Pictures<br></strong>We decided to attach our sensor right next to the baby monitor camera, with the mic sensor facing the door. Also, we highly recommend befriending someone with a 3-d printer to create a nice little case for your project. And of-course, good wire management for the project will teach your baby good organization skills 😜</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*exUW1S0tf3_wSr6icKQHbQ.png" /><figcaption>Used the existing camera stand to attach our sensor pointing towards the door</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zcs2vJoiOhnnQIqk0Ykfjg.jpeg" /><figcaption>Pico + Sensor</figcaption></figure><p><strong>Things you’ll need</strong></p><ol><li>Pico W with <a href="https://micropython.org/download/RPI_PICO_W/">MicroPython image</a></li><li>Microphone Sensor (<a href="https://www.amazon.com/gp/product/B00XT0PH10/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;psc=1">link</a>)</li><li>Micro USB cable with wall adapter to power up your project. (<a href="https://www.amazon.com/Raspberry-Supply-SoulBay-Adapter-Android/dp/B07CVH21NC/ref=sr_1_2?crid=1SKNM2ISVLZQY&amp;keywords=micro+usb+power+adapter+for+raspberry+pi+pico+w&amp;qid=1693338453&amp;sprefix=microusb+power+adapter+for+raspberry+pi+pico+%2Caps%2C88&amp;sr=8-2">link</a>)</li><li>Soldering Station is a nice to have</li></ol><p><strong>Wire everything together as below</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F5Mo_vqnQygrIGn8ERaDGQ.png" /><figcaption>Wiring the Microphone sensor to Pico w</figcaption></figure><p><strong>Optional: </strong>Being able to see electrical signals on a scope is extremely helpful in understanding what your sensor is hearing and what your microcontroller is seeing. The pink signal is what my pico received when I made some noises. The blue signal is the 3V out of the pico.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xRTQKh9lTIEmkXGvQQTFrw.png" /><figcaption>‘Seeing’ our sounds as electrical signals</figcaption></figure><p><strong>Code</strong><br>Here is my code if you want to try this out. I’ve over-saturated with comments to help newbies like me get started easily.</p><pre># Import necessary libraries  <br>import machine  <br>import utime  <br>import network  <br>import urequests as requests  <br>import ujson  <br>import secret as s  <br>import gc  <br>  <br># Define the pin connected to the microphone sensor&#39;s output  <br># IDK why and makese no sense but PULL_UP works better than PULL_DOWN. Magic!<br>mic_sensor_pin = machine.Pin(0, machine.Pin.IN, machine.Pin.PULL_UP)  <br><br>  <br># Set the duration of the rolling window in seconds  <br>rolling_window_duration = 1  <br>  <br># Set the number of samples to collect per second.<br># The Pico struggles with higher sample rate <br>samples_per_second = 500    <br>  <br># Set the number of consecutive windows to consider for a loud event  <br>consecutive_windows_threshold = 3  <br>  <br># Initialize an empty list to store the rolling window data  <br>rolling_window_buffer = []  <br>  <br># Initialize a variable to keep track of the number of sent messages  <br>sent_count = 0  <br>  <br># Function to connect to WiFi  <br>def connect_wifi(ssid, password):  <br>    # Initialize the WiFi interface  <br>    wlan = network.WLAN(network.STA_IF)  <br>    wlan.active(True)  <br>    try:  <br>        # Check if the device is already connected to WiFi  <br>        if not wlan.isconnected():  <br>            print(&#39;Connecting to WiFi...&#39;)  <br>            wlan.connect(ssid, password)  <br>            # Wait until the device is connected to WiFi  <br>            while not wlan.isconnected():  <br>                pass  <br>        print(&#39;Connected to WiFi with IP address&#39;, wlan.ifconfig()[0])  <br>    except:  <br>        print(&#39;Failed to connect to WiFi!&#39;)  <br>  <br># Function to send data to the API  <br>def send_data(label, value):      <br>    # Perform garbage collection to free up memory <br>    # As Pico was running out of resources here. <br>    gc.collect()    <br>    # Prepare the data to be sent  <br>    values = {&quot;events&quot;: [{&quot;key&quot;: label, &quot;value&quot;: value}]}      <br>    try:    <br>        # Send a POST request to the API  <br>        response = requests.post(s.url, headers=s.headers, json=values)      <br>        # Close the connection after the request is completed  <br>        response.close()   <br>    except Exception as e:    <br>        print(&quot;Failed to send data:&quot;, e)  <br>  <br># Connect to WiFi  <br>connect_wifi(s.ssid, s.password)  <br>utime.sleep(2)  <br>  <br># Start the main loop<br># The logic is simple: monitor a window of time, count high signals (noises),<br># If its more than the threshold, send event to Initial State<br>while True:  <br>    # Calculate the rolling window size in number of samples  <br>    rolling_window_size = int(rolling_window_duration * samples_per_second)  <br>      <br>    # Collect the current state of the microphone sensor  <br>    rolling_window = [mic_sensor_pin.value() for _ in range(rolling_window_size)]  <br>      <br>    # Count the number of loud sound events in the rolling window  <br>    loud_sound_count = sum(1 for state in rolling_window if state == 1)  <br>      <br>    # Check if the number of loud sounds is above the threshold  <br>    if loud_sound_count &gt; (rolling_window_size * 0.1):  <br>        # Add a loud sound event to the rolling window buffer  <br>        rolling_window_buffer.append(1)  <br>          <br>        # Check if the number of consecutive loud sound events is above the threshold  <br>        if len(rolling_window_buffer) &gt;= consecutive_windows_threshold:  <br>            # Increase the sent count  <br>            sent_count += 1  <br>            # Clear the rolling window buffer  <br>            rolling_window_buffer.clear()  <br>              <br>            # Send data to the API indicating a loud sound event  <br>            # Had to include sleep since pico wasn&#39;t fast enough. <br>            send_data(&quot;Loud Noise&quot;, 1)  <br>            utime.sleep(3)  <br>            send_data(&quot;Loud Noise&quot;, 0) # to make my dashboard look nice <br>            utime.sleep(3)  <br>    else:  <br>        # Clear the rolling window buffer if no loud sound was detected  <br>        rolling_window_buffer.clear()  <br>  <br>    # Sleep for a while to adjust the sample rate  <br>    utime.sleep_ms(10000 // samples_per_second)<br></pre><p>Here is the secrets.py file with all the API and wifi stuff:</p><pre>#initial State stuff<br>url = &#39;https://groker.init.st/api/events&#39;<br>headers = {<br>  &#39;Content-Type&#39;: &#39;application/json&#39;,<br>  &#39;X-IS-AccessKey&#39;: &#39;Your API Key&#39;,<br>  &#39;X-IS-BucketKey&#39;: &#39;Your Bucket ID&#39;,<br>  &#39;Accept-Version&#39;: &#39;~0&#39;}<br><br><br>#Wifi Stuff<br>ssid = &quot;Your WIFI Name&quot;<br>password = &quot;Your Wifi password&quot;</pre><p><strong>Bonus use case, Use at your own risk<br></strong> If your spouse’s work-from-home early morning ‘loud’ meetings wake you up, place one of these sensors on their desk! Works as a great sleep guardian for you too 😜</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eab49cdc2ab0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/initial-state/shhh-the-babys-sleeping-our-fun-diy-adventure-in-noise-monitoring-eab49cdc2ab0">Shhh! The Baby’s Sleeping: Our Fun DIY Adventure in Noise Monitoring</a> was originally published in <a href="https://medium.com/initial-state">Initial State</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streaming Data from Pico W to InitialState Dashboards]]></title>
            <link>https://medium.com/initial-state/streaming-data-from-pico-w-to-initialstate-dashboards-4aad86c3a58e?source=rss----cc2c6209cafb---4</link>
            <guid isPermaLink="false">https://medium.com/p/4aad86c3a58e</guid>
            <category><![CDATA[fridge]]></category>
            <category><![CDATA[initial-state]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[sensors]]></category>
            <category><![CDATA[pico]]></category>
            <dc:creator><![CDATA[Initial State]]></dc:creator>
            <pubDate>Mon, 14 Aug 2023 19:36:38 GMT</pubDate>
            <atom:updated>2023-08-15T01:11:27.078Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qZpUW3O3va_Yf-PMIRwqfA.png" /></figure><h4>Pre-reqs</h4><ol><li>Pico W</li><li>Free Initial State account</li></ol><h4>Parts List</h4><ol><li>Wires / Soldering station: to make all the connections.</li><li>Raspberry Pi PICO W:</li><li>Follow <a href="https://projects.raspberrypi.org/en/projects/get-started-pico-w/1">this guide</a> to install the latest micro python on your Pico w</li><li>DHT sensor: This is a popular humidity and temperature sensor with one limitation: it records 1 sample per second. This isn’t really an issue for my project. These have a 3-pin design for +, —, and data. If you need help, <a href="https://www.upesy.com/blogs/tutorials/use-dht11-humidity-temperature-sensor-on-pi-pico-with-micro-python-script">here</a> is a great tutorial.</li></ol><p>I was recently in the market for a small fridge to store breast milk and baby formula. I did not want to pay a premium for the ‘baby’ marketed products. So, I ended up buying an ‘affordable’ mini fridge without a temperature or a humidity sensor. From what I could find online, the baby food needs to stay &lt; 4° C (39.2° F) and &lt; 65% relative humidity. So wanted to build something that’s :</p><ol><li>cheap,</li><li>easy to put together,</li><li>measures temperature and humidity to test if the fridge is even good enough. I didn’t want to blindly trust the marketing claims.</li><li>send me notifications if temp/humidity falls outside my defined specs like the times when we forget to close the fridge door.</li></ol><p>Pico W is my favorite DYI home automation board these days. It runs off a USB power bank, is really tiny, has excellent support for sensors, plenty of GPIOs, and has an excellent community with code examples. It is a 3.3v board so take care when trying to run 5v sensors.</p><p>Initial State is a great dashboarding service: Just send/stream any kind of data to it and you have great visualizations of your data. You can start with a 14-day trial or use the student-free tier, or the individual tier at $9.99/month, which has text notifications integrated and great pre-build visualization options for different data types.</p><figure><img alt="Time Series Data from various sources flowing through your Initial State account to Dashboards &amp; Visualizations." src="https://cdn-images-1.medium.com/max/1024/1*0CjMnEJB1VDpw7hkw1FTqw.png" /></figure><p>There are plenty of Initial State examples for streaming data for the regular raspberry pi models. Since you don’t have to worry about computing and storage so much, you can just download the <em>ISStreamer</em> package into your Python project and get going. Pico W is built differently: slightly limited compute and storage. So, we must make use of the micro python alternate libraries to the popular libraries we use more often. Here is a quick summary:</p><ol><li><em>Ujson</em>: Lightweight and fast JSON data formator for uPython.</li><li><em>Urequests</em>: This is a uPython alternative to the popular Requests package. This provides user-friendly HTTP clients with clean objects. This is what sends the data to your Initial State Dashboard</li></ol><h3>Quick Guide</h3><p>Start by connecting long wires from your Pico W to the DHT sensor. While the sensor will stay inside your fridge, your Pico W needs to stay outside the fridge. So, consider where you will place your Pico W and how far from a wall outlet if you are not using a power bank.</p><p>For connecting the DHT sensor, I picked nearby pins for convenience. See the diagram below:</p><figure><img alt="Pico W pinout from raspberrypi.com" src="https://cdn-images-1.medium.com/max/352/1*G1ePztqPtrfco1CxuhQxEg.png" /></figure><h4>Writing Code</h4><p>I use Thonny for Raspberry PI(s). <a href="https://projects.raspberrypi.org/en/projects/get-started-pico-w/1">Here</a> is a great getting-started guide.</p><p>We will create two files: One to hold our secret information and another for the actual program. The neat thing about Pico W is that if you create a <em>main.py</em> file, it automatically runs that on bootup.</p><p><em>Secret.py</em></p><p>This is where we will store our wifi name/password, the Initial State API keys, and bucket information. This is what my file looks like</p><p>Code for <em>secret.py</em> :</p><pre>#initial State stuff<br>url = &#39;https://groker.init.st/api/events&#39;<br>headers = {<br>  &#39;Content-Type&#39;: &#39;application/json&#39;,<br>  &#39;X-IS-AccessKey&#39;: &#39;ist_YourAccessKey&#39;,<br>  &#39;X-IS-BucketKey&#39;: &#39;YOURBUCKETKEY&#39;,<br>  &#39;Accept-Version&#39;: &#39;~0&#39;}<br><br><br>#Wifi Stuff<br>ssid = &quot;yourWifinetworkName&quot;<br>password = &quot;yourWiFipassword&quot;</pre><p>To generate your Initial State API keys and bucket information, login to your account, and create a new bucket as below. Note down the API/endpoint (URL in <em>secret.py</em>), the access key, and bucket key to update your <em>secret.py</em></p><figure><img alt="Create new bucket within Initial State" src="https://cdn-images-1.medium.com/max/764/1*Vr6xq5F_YKIDFET2VK7JFw.png" /></figure><p>Code for my <em>main.py</em> file</p><pre>import network<br>import urequests as requests<br>import ujson<br>import secret as s<br>import machine<br>import time<br>from machine import Pin<br>import dht<br><br>#button = machine.Pin(18, machine.Pin.IN, machine.Pin.PULL_UP)<br><br><br>def connect_wifi(ssid, password):<br>    wlan = network.WLAN(network.STA_IF)<br>    wlan.active(True)<br>    try:<br>        if not wlan.isconnected():<br>            print(&#39;Connecting to WiFi...&#39;)<br>            wlan.connect(ssid, password)<br>            while not wlan.isconnected():<br>                pass<br>        print(&#39;Connected to WiFi with IP address&#39;, wlan.ifconfig()[0])<br>    except:<br>        print(&#39;Failed to connect to WiFi!&#39;)<br><br>connect_wifi(s.ssid, s.password)<br>time.sleep(5)<br><br>while True:<br>    sensor = dht.DHT11(Pin(28))<br>    try:<br>        sensor.measure()<br>        sensorTemp = sensor.temperature()<br>        sensorHumidity = sensor.humidity()<br>        print(f&quot;Temperature : {sensorTemp:.1f}&quot;)<br>        print(f&quot;Humidity    : {sensor.humidity():.1f}&quot;)<br>        values = [<br>            {<br>                &quot;key&quot;: &quot;Temperature&quot;,<br>                &quot;value&quot;: sensorTemp<br>                <br>            },<br>            {<br>                &quot;key&quot;: &quot;Humidity&quot;,<br>                &quot;value&quot;: sensorHumidity<br>                <br>            }<br>            <br>            ]<br>        response = requests.post(s.url, headers=s.headers, json=values)<br>        print(response.text)<br>        time.sleep(10)<br><br><br>    except Exception as e:<br>        print(&#39;Error occurred while executing new code!&#39;)<br>        print(&#39;Error details:&#39;, e)</pre><p>This is what my Initial State Dashboard looks like</p><figure><img alt="Initial State dashboard with temp and humidity graphs" src="https://cdn-images-1.medium.com/max/936/1*wcP9ckZVJvf3H9ZnIyUYIg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4aad86c3a58e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/initial-state/streaming-data-from-pico-w-to-initialstate-dashboards-4aad86c3a58e">Streaming Data from Pico W to InitialState Dashboards</a> was originally published in <a href="https://medium.com/initial-state">Initial State</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[This Initial State IoT Integration Lets You Know When Your Data Stops Streaming]]></title>
            <link>https://medium.com/initial-state/this-initial-state-iot-integration-lets-you-know-when-your-data-stops-streaming-4ebfa574b1d9?source=rss----cc2c6209cafb---4</link>
            <guid isPermaLink="false">https://medium.com/p/4ebfa574b1d9</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[iot]]></category>
            <dc:creator><![CDATA[Elizabeth Adams]]></dc:creator>
            <pubDate>Tue, 02 Feb 2021 14:44:41 GMT</pubDate>
            <atom:updated>2021-02-02T15:07:44.894Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2lruEQjTQ6B6IgivwSwqZg.png" /><figcaption>Edited Image by <a href="https://unsplash.com/@jorgedevs">Jorge Ramirez</a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><p><a href="https://support.initialstate.com/hc/en-us/articles/360041087352-Bucket-Watchdog-Integration?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20%5BFUS%5D%20-%20bucket%20watchdog%20support">Bucket Watchdog</a> is one of the codeless integrations offered in the <a href="https://www.initialstate.com/?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20%5BSU%5D">Initial State</a> Integration Marketplace. It has the ability to monitor the number of events your bucket has received during a designated time period. You can then set a trigger on the event counts reported and know immediately if a device has stopped sending data.</p><p>It may not seem as flashy as <a href="https://www.initialstate.com/weatherstack/?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20%5BFUS%5D">Weatherstack Weather</a> or as cool as <a href="https://www.initialstate.com/coincap/?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20%5BFUS%5D">Cryptocurrency</a>, but it has the potential to be the most powerful integration if used correctly. I am going to walk you through how to install the Bucket Watchdog Integration, how to configure it to monitor your bucket, and how to set trigger alerts so you know when data stops streaming.</p><p>Initial State is a data visualization software that can be used for real-time data monitoring and historical data evaluation. It offers a free tier for students with an active edu email address, an individual tier for hobbyists and prototypers for $9.99/month, and an enterprise tier for businesses starting at $20/month. Every account is given a 14-day free trial to test out all features and functions on the platform.</p><h4>How to Navigate to the Bucket Watchdog Integration</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bz_TNDDLiYhWMQvGe4lnoQ.png" /><figcaption>Initial State Homepage</figcaption></figure><p>The Bucket Watchdog integration can be found in the <a href="https://support.initialstate.com/hc/en-us/articles/360036577972-Introduction-to-Integration-Marketplace?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20%5BFUS%5D">Integration Marketplace</a>. When you are logged into the app you will see a section for the Integration Marketplace on your homepage. Click on the Bucket Watchdog integration to go directly to the integration. Or click view all integrations to navigate to the marketplace. There you can go to the Bucket Watchdog integration by clicking details on the Watchdog integration. Both these ways will take you to the Bucket Watchdog integration page.</p><h4>How to Configure the Bucket Watchdog Integration</h4><p>To start the process click Begin Setup. This will open the Integration Setup window on the right side of your screen. This is where you will configure your integration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A4tp_HexFru2oZbh7JNSBA.png" /><figcaption>Bucket Watchdog Integration</figcaption></figure><p>Let’s go through all the integration setup details and explain in detail what each option entails.</p><p><strong>Give This Integration A Name</strong> — This is exactly what it sounds like. Choose any name for this integration. This is how you will identify it in your list of active integrations. For example, if this was going to be used for my home temperature bucket I would name it Bucket Watchdog Home Temperature.</p><p><strong>Watched Bucket</strong> — Here you can choose which bucket you want the integration to monitor. The dropdown will contain a list of all your data buckets that are on your bucket shelf. You can only select one bucket.</p><p><strong>Monitoring Period</strong> — This is how long you want the integration to look into the past to check for events. This field requires a little critical thinking on your part. You want to select a period based on how often your device sends data to your bucket.</p><p>Let’s say you have a bucket that gets temperature and humidity every 5 minutes. That means 2 events are received every 5 minutes. So if you set the Monitoring Period for 1 minute, it’s not long enough to see the events. If you set the Monitoring Period for 5 minutes, it should see 2 events. If you set the Monitoring Period for 10 minutes, it should see 4 events.</p><p>Another example is if you set your Monitoring Period for 15 minutes but your device only sends events once an hour. Three times out of four your integration would show that you have zero events in the last 15 minutes. That is not helpful in trying to determine if a device has stopped sending data.</p><p>Select a time frame that makes sense for your bucket based on how you are sending in events.</p><p><strong>Choose a Bucket</strong> — You can send this Watchdog signal into any existing bucket, including the one you are monitoring, or you can create a new bucket solely for this integration.</p><p>There are pros and cons to both options. If you choose to send it to a new bucket, you can have your Watchdog integration by itself and that makes calculating your trigger easier. If you send it into an existing bucket, let’s say the one you are monitoring, then the event from the integration is included in the watchdog count. I’ll explain this further in the trigger section.</p><p><strong>How Often Do You Want New Data?</strong> — You can choose to have this integration update every 15 minutes, every 30 minutes, every hour, or every day. The more frequent the update the more credits it requires.</p><p>This is a choice that should be based on how often you need the data, how many credits you have available, and how long your Monitoring Period is. If you need to know ASAP if a signal stops sending, 15 minutes is the best option. If you just need to know if a signal goes down, regardless of how soon it happens then go with 1 hour.</p><p>The integration will have an initial run when it is first started and then will run the frequency chosen at the top of the next hour. If you choose every 15 minutes and start the integration at 4:53 it will immediately run and then start running every 15 minutes beginning at 5:00.</p><p>Once you have made your selections, click Start Integration to complete the setup. You will receive a message letting you know the installation was successful and it will give you a link to direct you to the bucket where your integration is now streaming.</p><h4>How to Set a Bucket Watchdog Integration Trigger</h4><p>Your selections are made and your integration is now streaming into a bucket. To make full use out of this integration you need to <a href="https://support.initialstate.com/hc/en-us/articles/360002974332-Introduction-to-Triggers?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20%5BFUS%5D">set a trigger</a> to alert you if you receive fewer events in your bucket than anticipated.</p><p>There are two sets of logic for this, which depend upon whether you sent the integration into an existing bucket or a new bucket. If you send the Bucket Watchdog to a new bucket, it will show you the number of events during your Monitoring period in the bucket you selected. If you send the Bucket Watchdog to an existing bucket, you will see the number of events during your monitoring period in the bucket plus the bucket watchdog signal itself, which counts as one event. TLDR, if you send to an existing bucket you need to account for the Bucket Watchdog signal adding one event to the count.</p><p>You should see the watchdog signal in your data bucket with an initial value. This value is how many events were counted during the Monitoring Period you set. This is the value you should expect to consistently see in your bucket. Typically, anything below this threshold means a device has stopped sending data. That is what we want to be alerted to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UnE4k1XNFDKg6sDzcw8mwA.png" /><figcaption>Trigger Editor</figcaption></figure><p>In the bucket where your integration resides, go to the bucket settings. Click on the Triggers tab to create a Trigger. Click Create New Trigger to open the Trigger editor. Enter watchdog_event_count_[integration name] as the stream key, it should come up as an option when you click on the box. Choose your operator as less than. Enter the value as any number below your actual watchdog count. In Notices, you can enter any email or phone number where you want to receive the alert at.</p><p>Once you enter all this information the message template box will become visible. The box will be populated with “{{bucketKey}}: {{streamKey}} -&gt; {{triggeredValue}}.” You can change this to anything you want. Put in a message to yourself that you will understand or that gives context to the alert you will receive. There is a dropdown at the top right of the message template box that says insert. These are variables you can add to your message that will update based on your bucket’s information. For example, if you insert [[bucket key]] in the message it will be replaced with your actual bucket key when the alert is sent.</p><p>When you are finished editing your Triggers settings click Create on the editor and click Done at the bottom. This will finalize your Trigger and you will receive alerts any time your threshold is met.</p><h4>Troubleshooting</h4><p>There are a few ways you could set this integration up that would cause some false alarms, which is the last thing you want when it’s an important signal you are monitoring.</p><p><strong>Frequency and Monitoring Period Aren’t Aligned</strong></p><p>Ensure your Monitoring Period makes sense with the frequency of events streamed to your bucket. If you set a Monitoring Period of 5 minutes, but your bucket only receives events once every hour then your integration will tell you that it sees 0 events most of the time except for the one time per hour when events are streamed. See the issue here? You’d constantly get an alert that no events happened.</p><p><strong>Watchdog Signal Events Are Not Accounted For</strong></p><p>If you send your Watchdog events to the same bucket you are monitoring, the watchdog events will also be counted in the number of events the bucket has received. You should adjust the threshold for your trigger to account for this.</p><p>Bucket Watchdog monitors your data streams for you so you never have to worry if things are still streaming smoothly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ebfa574b1d9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/initial-state/this-initial-state-iot-integration-lets-you-know-when-your-data-stops-streaming-4ebfa574b1d9">This Initial State IoT Integration Lets You Know When Your Data Stops Streaming</a> was originally published in <a href="https://medium.com/initial-state">Initial State</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Plug-In Pi Zero Display and Show Something Useful]]></title>
            <link>https://medium.com/initial-state/how-to-build-a-plug-in-pi-zero-display-and-show-something-useful-fd402c912a22?source=rss----cc2c6209cafb---4</link>
            <guid isPermaLink="false">https://medium.com/p/fd402c912a22</guid>
            <category><![CDATA[makers]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <dc:creator><![CDATA[Jamie Bailey]]></dc:creator>
            <pubDate>Mon, 12 Oct 2020 13:16:58 GMT</pubDate>
            <atom:updated>2020-10-12T13:16:44.118Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Raspberry Pi Zero Plug-In Display" src="https://cdn-images-1.medium.com/max/1024/1*8Q6BUAhamvta1C16O9scUA.jpeg" /></figure><h3>Introduction</h3><p>I wanted to create a simple, compact display driven by a Raspberry Pi Zero that plugs into a power outlet to display some useful information in my kitchen. No visible wires hanging out or anything that looks funky. I assumed someone already makes a Pi Zero case + power supply combo that I could just buy and plug in. Alas, I found no such convenient product on the interwebs (why?!?!?). Unwilling to accept defeat, I came up with a solution using off-the-shelf parts. This ended up being a fun little project from the hardware to the software. I am hoping I can save someone from the same frustrations I had by documenting this build.</p><p>In this project, we will:</p><ul><li>Build a compact Raspberry Pi Zero display that plugs into a power outlet using cheap, off-the-shelf components.</li><li>Set up a Pi Zero to run a simple Python script on boot that retrieves information from a web API and cycles through that info on the display.</li></ul><h3>Parts and Materials</h3><figure><img alt="Raspberry Pi Zero Plug-In Display Parts and Materials" src="https://cdn-images-1.medium.com/max/1024/1*CUm4ILWkt6ikGLQ6tNfD4w.jpeg" /><figcaption>Raspberry Pi Zero Plug-In Display Parts and Materials</figcaption></figure><p>Here are the parts I used for my final build:</p><ul><li>Raspberry Pi Zero WH ($14, <a href="https://www.adafruit.com/product/3708">link</a>).</li><li>Adafruit 2.23&quot; 128x32 OLED Bonnet ($22.50, <a href="https://www.adafruit.com/product/4567">link</a>).</li><li>16 GB micro SD card ($6, <a href="https://www.amazon.com/Sandisk-Ultra-Micro-UHS-I-Adapter/dp/B073K14CVB/">link</a>).</li><li>Dodoli 12W USB wall charger ($10 for two, <a href="https://www.amazon.com/gp/product/B07JHZXCQD/">link</a>).</li><li>UCEC USB-A male to USB micro male adapter ($9 for two, <a href="https://www.amazon.com/gp/product/B00TAM0MZW/">link</a>).</li><li>Pi Zero case (optional).</li></ul><p>The plan is to run the Pi Zero headless. I keep and reuse one wireless keyboard/mouse (<a href="https://www.amazon.com/Keyboard-Rii-Portable-Controller-Rechargeable/dp/B07D2BG6R5/">link</a>) and an HDMI cable with an HDMI mini adapter (<a href="https://www.amazon.com/Cable-Matters-Mini-HDMI-Adapter/dp/B004PW1XRS">link</a>) attached to a TV to set up any Pi Zeros for the first time.</p><p>Assembly is simple. The OLED display plugs into the 40-pin GPIO header of the Pi Zero. The USB micro male adapter plugs into the USB power port of the Pi Zero and the USB charger provides the actual power. You will need to format the SD card and install the Raspberry Pi OS (a great tutorial on getting your Pi set up for the first time can be found <a href="https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up">here</a>).</p><h3>Don’t Do This!!</h3><figure><img alt="Pi Zero Display Backwards Fail" src="https://cdn-images-1.medium.com/max/1024/1*zAisHF-2LTjzeMdhGJVAgQ.jpeg" /><figcaption>Pi Zero Display Backwards Fail</figcaption></figure><p>My first attempt at finding the parts to use for this project looked like the image above. I bought the wrong USB charger because I failed to take into account that USB-A plugs in only one way. That USB wall charger orients the display toward the wall. No bueno. Make sure the USB-A plug is oriented like the one in the previous section (<a href="https://www.amazon.com/gp/product/B07JHZXCQD/">link</a>)!!</p><h3>Alternative Setup</h3><figure><img alt="Altnerative Plug-In Pi Zero Display Parts" src="https://cdn-images-1.medium.com/max/1024/1*R-vACbo5BHxoylf4LPWRBQ.jpeg" /><figcaption>Altnerative Plug-In Pi Zero Display Parts</figcaption></figure><p>The Nekmit USB charger I bought first has both a USB-A port that is oriented in the wrong direction (useless!) and a USB-C port that can plug in either direction (useful!). Unfortunately, I could not find a USB-C male to USB micro male adapter. But, I did find a couple of adapters to connect together to make it work. This build is a bit more expensive but gets the job done:</p><ul><li>Raspberry Pi Zero WH ($14, <a href="https://www.adafruit.com/product/3708">link</a>).</li><li>Adafruit 2.23&quot; 128x32 OLED Bonnet ($22.50, <a href="https://www.adafruit.com/product/4567">link</a>).</li><li>16 GB micro SD card ($6, <a href="https://www.amazon.com/Sandisk-Ultra-Micro-UHS-I-Adapter/dp/B073K14CVB/">link</a>).</li><li>Nekmit 30W USB-C charger ($20, <a href="https://www.amazon.com/gp/product/B07Y36PSH5/">link</a>).</li><li>USB-C female to USB micro male adapter ($7 for five, <a href="https://www.amazon.com/gp/product/B07GH5KJH2/">link</a>).</li><li>USB-C male to USB-C male adapter ($10, <a href="https://www.amazon.com/gp/product/B07GTNZL1M/">link</a>).</li></ul><figure><img alt="Alternative Plug-in Pi Zero Display" src="https://cdn-images-1.medium.com/max/1024/1*RGMaUqtbcCvK5ESS392s0g.jpeg" /><figcaption>Alternative Plug-in Pi Zero Display</figcaption></figure><h3>Display Something Useful — Detailed Example</h3><figure><img alt="Plug-in Pi Zero Display In Action" src="https://cdn-images-1.medium.com/max/1024/1*dODz3IZ4MC_KIdtBvE9lRg.gif" /><figcaption>Plug-in Pi Zero Display In Action</figcaption></figure><p>With the hardware in place, it is time to set up the Pi Zero to display something useful. I recently installed a Pi Zero in my crawl space to monitor temperature and humidity (and wrote up the details of this project <a href="https://medium.com/initial-state/how-to-build-a-crawl-space-humidity-monitor-with-a-raspberry-pi-669f2a632cf4">here</a>). I am sending the sensor data from my crawl space to <a href="https://www.initialstate.com?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20pi-zero-display%20-%20%5BSU%5D">Initial State</a>. Instead of viewing this data on the web dashboard, I want it to be displayed on my Pi Zero display in my kitchen along with sensor data from my attic and outside weather information. Since my Pi Zero is headless, I also want to display the IP address in case I need to SSH into it again.</p><p>Once Raspberry Pi OS is installed (<a href="https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up">instructions</a>) and you have set up WiFi (<a href="https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/5">instructions</a>), you will need to enable both SSH (for remote access) and i2c (for the OLED display). At the Pi terminal type:</p><pre>sudo raspi-config</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FjWrvJf-h31c6U49YQ2nUA.png" /></figure><p>Select 5 Interfacing Options, P5 I2C, and select &lt;YES&gt; to enable i2c.</p><p>Select 5 Interfacing Options, P2 SSH, and select &lt;YES&gt; to enable SSH. Select &lt;Finish&gt; to save and exit.</p><p>Next, install the Python library to allow interfacing the Adafruit OLED Bonnet:</p><pre>sudo pip3 install adafruit-circuitpython-ssd1305</pre><p>Since I am going to read data from my <a href="https://www.initialstate.com?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20pi-zero-display%20-%20%5BSU%5D">Initial State</a> account in this example, I want to install the <a href="https://github.com/initialstate/python_reader">Initial State Read API Python module</a> to make writing my Python script easier:</p><pre>sudo pip install ISReader</pre><p>The following Python script rotates through displaying four screens of data — my crawl space temperature/humidity, my attic temperature/humidity, outside temperature/humidity, and the Pi Zero IP address. To use this script as it is, modify the User Settings section with your Initial State access key (<a href="https://support.initialstate.com/hc/en-us/articles/360002898512-Streamer-Concepts-Streaming-Access-Key">more info</a>), bucket key (<a href="https://support.initialstate.com/hc/en-us/articles/360002913891-Streamer-Concepts-Data-Buckets">more info</a>), and stream names to be read.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c98ccff724f52c4411f8236e1636d4d/href">https://medium.com/media/0c98ccff724f52c4411f8236e1636d4d/href</a></iframe><p>The Python code above is easy-to-follow and can serve as a template to displaying whatever information you need. For example, you can use it to display information from other web APIs or just other data from Initial State (e.g. stock data, detailed weather data, Chuck Norris jokes).</p><h3>Remotely Accessing Your Pi</h3><ul><li>If you want to test out remotely configuring your Pi, at the Pi terminal type:</li></ul><pre>hostname -I</pre><p>This will return the IP address of your Pi. At your <em>laptop</em> terminal, type:</p><pre>ssh pi@&lt;insert Pi ip address&gt;</pre><p>For example:</p><figure><img alt="SSH into your Pi from your laptop" src="https://cdn-images-1.medium.com/max/1024/1*RfRoOdnvqPQ5S9-LEz3acg.png" /><figcaption>SSH into your Pi from your laptop</figcaption></figure><p>Once you can successfully SSH into your Pi, you may want to make it boot directly to the console instead of loading the desktop UI. You can do this as follows:sudo raspi-config -&gt; 3 Boot Options-&gt; B1 Desktop / CLI-&gt; B2 Console Autologin-&gt; &lt;ok&gt;-&gt; exit.</p><h3>Running on Boot</h3><p>The final piece of the puzzle is to have the Pi Zero run this script on boot. This will allow you to plug your Pi Zero into a power outlet and it start displaying data without any other manual steps. At the Pi terminal:</p><pre>crontab -e</pre><p>At the bottom of the text file, add the following line of text (modify the path and script name to your specific path/script name), save, and exit:</p><pre>@reboot python3 /home/pi/runoled.py &amp;</pre><p>Notice the 30 second delay on line 46 of the example script. This allows the Pi to establish a WiFi connection before it attempts to hit a web API.</p><h3>Conclusion</h3><p>Being able to plug a Pi Zero with an OLED display into a wall outlet and it actually look good is oddly satisfying. I really like the fact that I can reuse this project to display whatever information I want in the future. This project can be particularly useful in a media closet, server room, or in a lab setting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd402c912a22" width="1" height="1" alt=""><hr><p><a href="https://medium.com/initial-state/how-to-build-a-plug-in-pi-zero-display-and-show-something-useful-fd402c912a22">How to Build a Plug-In Pi Zero Display and Show Something Useful</a> was originally published in <a href="https://medium.com/initial-state">Initial State</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use a Soil Moisture Sensor to Keep Your Plants Alive]]></title>
            <link>https://medium.com/initial-state/how-to-use-a-soil-moisture-sensor-to-keep-your-plants-alive-51a2294b88e?source=rss----cc2c6209cafb---4</link>
            <guid isPermaLink="false">https://medium.com/p/51a2294b88e</guid>
            <category><![CDATA[makers]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[gadgets]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Elizabeth Adams]]></dc:creator>
            <pubDate>Wed, 23 Sep 2020 13:56:10 GMT</pubDate>
            <atom:updated>2021-12-02T15:56:26.946Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LWyVfJOHa-Z85GUX_1-7qA.jpeg" /><figcaption>Edited Unsplash Photo via <a href="https://unsplash.com/@leoeye">Leonardo Iheme</a></figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FYXDoPfLlGHs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DYXDoPfLlGHs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FYXDoPfLlGHs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d27a9c971ed8127472ef174496ab3006/href">https://medium.com/media/d27a9c971ed8127472ef174496ab3006/href</a></iframe><p>Every good plant mom (or dad) knows there are two important things to keep your indoor plants alive: light and water. The balance of getting the right amount of these two things is like walking a tight rope. As the type of millennial who accidentally kills succulents on the regular, I needed to find a way to keep my plants alive.</p><p>I like to add technology to all aspects of my life, so I thought how can I monitor my plants so I stop killing them? I’ve written tutorials about monitoring temperature before so why not try light and moisture. After a quick Adafruit search, the sensors I needed were in the mail. The next thing I had to do was get more information about how to take care of the plants I own.</p><p>Each plant requires different amounts of light and water. You can easily find information about how much light is required for your specific plant online. Indoor plants can range from low light to bright light. My house only gets low to medium light at best. It’s important to know what lighting your home has and to pick plants that will fit your lighting situation.</p><p>You now should know your plant and know how much sun it needs. How can you determine whether it is getting enough light? If your plant’s leaves are dark, have bleached patches, or are dried out, your plant may be getting too much sun. You need to move it to a shadier location. If your plant has small pale leaves or weak stems, it may be getting too little sun. You’ll need to move it to a sunnier location. Seems simple enough.</p><p>Now on to water. If your plant’s leaves are yellow and softening, you may be watering it too much. In this case, you should water it less. If your plant has brown, crispy leaves or the leaves falling off, your plant is too dry. The good rule of thumb I’ve been told is to check the soil with your finger. If the soil is wet or damp, you don’t need to water it. If the soil is dry it needs to be watered. The amount of water you need varies for each plant. The soil type shouldn’t matter that much.</p><p>This all seems very simple, yet somehow my plants keep dying. This project has fixed that! I found a way to measure soil moisture and ambient light. I’ll detail how I put this project together, how I remotely monitor my plants, and how this simple solution gave me a green thumb.</p><h3>What You’ll Need</h3><p>This is a list of what I used for this project:</p><ul><li>(2) <a href="https://www.adafruit.com/product/3708">Raspberry Pi Zero WH</a> ($14 each) with <a href="https://www.adafruit.com/product/1995">power chargers</a> ($7.50 each)</li><li>(2) <a href="https://www.adafruit.com/product/4266">SD Card with NOOBS</a> ($14.95 each)</li><li><a href="https://www.adafruit.com/product/4026">Adafruit STEMMA Soil Sensor — I2C Capacitive Moisture Sensor</a> ($7.50)</li><li><a href="https://www.adafruit.com/product/4681">Adafruit BH1750 Ambient Light SensorLight sensor, soil moisture sensor</a> ($4.50)</li><li><a href="https://www.adafruit.com/product/4397">STEMMA QT / Qwiic JST SH 4-pin Cable with Female Sockets</a> ($0.95)</li><li><a href="https://www.adafruit.com/product/3950">JST PH 4-Pin to Female Socket Cable — I2C STEMMA Cable</a> ($1.50)</li><li><a href="https://www.initialstate.com/?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Indoor%20Plants%20-%20%5BSU%5D">Initial State</a> — or any data visualization platform ($9.99/mo)</li></ul><p>For this design, I am using Raspberry Pi Zero WH, because they are inexpensive and the header is pre-soldered. A Raspberry Pi 3 or 4 could be used, it would just be overkill. The only issue with the Raspberry Pi Zero WH is it can sometimes be hard to find and there is usually a purchasing limit of 1 per order due to manufacturing limitations.</p><p>This design doesn’t make sense to replicate for all my indoor plants. That would be too costly and repetitive. The plan would be to monitor a single plant for 1–2 months until I got the right balance of sun and light and then move the setup to the next plant.</p><p>You’ll want a keyboard and monitor to be able to easily get your Pi’s up and running. I have some that I use to get every Pi I buy started. Some of my Pi’s are actually connected to monitors always and others I just connect to set them up and reuse the keyboard and monitors when needed.</p><p>I used a Raspberry Pi 3 as one of the Pi’s because I have one constantly connected to a monitor. This lets me put my dashboard on the monitor for a constant view of my data. This setup is a little over the top for what we are doing, but I really love the dashboard view on the Pi monitor.</p><h3>Hardware</h3><p>You’ll need to connect your Raspberry Pi’s to their respective sensors. This is easily done if you purchased the two cables in the material list or using female to female jumper wires.</p><p>To connect your Pi to the soil sensor, you’ll need to connect the following pins:</p><ul><li>Pi GND to sensor GND (black wire)</li><li>Pi 3V3 to sensor VIN (red wire)</li><li>Pi SDA to sensor SDA (white wire)</li><li>Pi SCL to sensor SCL (green wire)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*7VU3tBKNnZG2eN3tPj523g.png" /><figcaption>Raspberry Pi &amp; Soil Moisture Sensor connection via <a href="https://learn.adafruit.com/adafruit-stemma-soil-sensor-i2c-capacitive-moisture-sensor/python-circuitpython-test">Adafruit</a></figcaption></figure><p>To connect your Pi to the light sensor, you need to connect the following:</p><ul><li>Pi GND to sensor GND (black wire)</li><li>Pi 3V to sensor VCC (red wire)</li><li>Pi SDA to sensor SDA (blue wire)</li><li>Pi SCL to sensor SCL (yellow wire)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*53mSwiU6kskGqOgaJl13OA.png" /><figcaption>Raspberry Pi &amp; BH1750 Ambient Light Sensor connection via <a href="https://learn.adafruit.com/adafruit-bh1750-ambient-light-sensor/python-circuitpython">Adafruit</a></figcaption></figure><p>The connections will be slightly different for the BH1750 if you are using jumper wires and a soldered header versus the female socket cable pictured above. If you are using this alternative setup, your connection is as follows:</p><ul><li>Pi 3V to sensor VCC (red wire)</li><li>Pi GND to sensor GND (black wire)</li><li>Pi SCL to sensor SCL (yellow wire)</li><li>Pi SDA to sensor SDA (blue wire)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*WGXxGYzXtA619Arm2h3lBA.png" /><figcaption>Raspberry Pi &amp; BH1750 Ambient Light Sensor connection via <a href="https://learn.adafruit.com/adafruit-bh1750-ambient-light-sensor/python-circuitpython">Adafruit</a></figcaption></figure><p>My preference is to always use cables vs having to solder a header. Soldering the header onto these small devices can be hard if you aren’t well-practiced with soldering. They say practice makes perfect so maybe give it a try.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0T-JpImCHOgDZXL6hCWgHA.jpeg" /><figcaption>Raspberry Pi Zeros connected to Soil Sensor &amp; Ambient Light Sensor</figcaption></figure><h3>Test Your Sensors</h3><p>For this project, I am using Python 3. You’ll need to have that downloaded and set as your default Python version on your Raspberry Pi. I followed <a href="https://installvirtual.com/how-to-install-python-3-8-on-raspberry-pi-raspbian/">these instructions</a> to install Python 3 on my Pi’s and it went really well (just took a while to download it all).</p><p>Both sensors require I2C to be enabled on your Pi’s. You can do this one of two ways. One way is to go to your Raspberry Pi Configuration on your monitor, enable I2C, and reboot your Pi.</p><p>The other way is to type this into the command prompt:</p><pre>sudo raspi-config</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rfaQGzjLZFK8J5Gy.png" /></figure><p>Select 5 Interfacing Options, P5 I2C, and select &lt;YES&gt; to enable i2c. Select &lt;Finish&gt; to save and exit. You can test out the connection to the sensor. On your Pi type the following in the command prompt:</p><pre>sudo i2cdetect -y 1</pre><p>You should see something like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yyjWZI3pCX-HRr2R.png" /></figure><p>The sensor is detected on a Pi at address 0x76. This should show your sensor at address 0x76 (possibly address 0x77). If you don’t see either, check your wiring, make sure i2c is enabled in raspi-config, and reboot.</p><p>*You may need to install pip if your Python version does not have it preinstalled.</p><pre>sudo apt install python-pip</pre><p>Next, you’ll need to add three Adafruit libraries &amp; the Initial State Streamer Module to get the sensors working and stream our data. The first is the Blinka library. This provides CircuitPython support in Python.</p><pre>$ pip3 install adafruit-blinka</pre><p>The second is the library for the soil sensor</p><pre>$ sudo pip3 install adafruit-circuitpython-seesaw</pre><p>The third is the library for the light sensor</p><pre>$ sudo pip3 install adafruit-circuitpython-bh1750</pre><p>The last one is the Initial State Streamer Module</p><pre>$ sudo pip3 install ISStreamer</pre><p>Once those are installed we can test each sensor accordingly.</p><p>To test the soil sensor, created a python script called soil_simpletest.py. Copy and paste the code below (<a href="https://learn.adafruit.com/adafruit-stemma-soil-sensor-i2c-capacitive-moisture-sensor/python-circuitpython-test">from Adafruit’s tutorial</a>) into the script, save, and exit the text editor.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/34e97060901567a511d6868e183f18d5/href">https://medium.com/media/34e97060901567a511d6868e183f18d5/href</a></iframe><p>To run the script type:</p><pre>$ python3 soil_simpletest.py</pre><p>You will see soil moisture (amount of water in the soil) values and temperature values if it is connected properly.</p><p>On your other Pi, you can test the BH1750 sensor. Create a script called bh1750_simpletest.py. Copy and paste the code below (<a href="https://learn.adafruit.com/adafruit-bh1750-ambient-light-sensor/python-circuitpython">from Adafruit’s BH1750 tutorial</a>) into the script, save, and exit the text editor.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/634fde13a5d40f73519914a6d0c5462e/href">https://medium.com/media/634fde13a5d40f73519914a6d0c5462e/href</a></iframe><p>To run the test script type:</p><pre>$ python3 bh1750_simpletest.py</pre><p>You will see lux values if the sensor is connected properly.</p><h3>Initial State</h3><p>We have data but now we want to monitor that data. I think <a href="https://www.initialstate.com/?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Indoor%20Plants%20-%20%5BSU%5D">Initial State</a> is a great solution for that, but you can choose to use any data visualization platform. This tutorial will show you how to use Initial State but you can modify the code to send data to any platform of your choosing.</p><p>Initial State is a data visualization software that can be used for real-time data monitoring and historical data evaluation. It offers a free tier for students with an active Edu email address, an individual tier for hobbyists and prototypers for $9.99/month, and an enterprise tier for businesses starting at $20/month. Every account is given a 14-day free trial to test out all features and functions on the platform.</p><p>Once you <a href="http://iot.app.initialstate.com/?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Indoor%20Plants%20-%20%5BSU%5D">register for an account</a>, you can go to your settings and view your access keys. An access key allows you to send data into your account. You’ll use your access key in the Python script later in the article.</p><h3>Stream Data with Python</h3><p>You’ve connected your hardware, tested your sensors, and chosen your data platform. Now we can stream data from your Pi’s and sensors to Initial State and create dashboards from that data.</p><p>For your Pi connected to the soil sensor, you will use the code below. Create a python script called is_soil.py and copy and paste the code below. You’ll need to make a few changes that I have detailed below before it is ready to be run.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/160104e4c138bafc5f566e9a714f5aac/href">https://medium.com/media/160104e4c138bafc5f566e9a714f5aac/href</a></iframe><p>For the Pi connected to the light sensor, you will use the code below. Create a python script called is_ambientlight.py and copy and paste the code below. You’ll need to make a few changes that I have detailed below before it is ready to be run.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ee0b67bfeeebe308c888ba9c7b3c8f0e/href">https://medium.com/media/ee0b67bfeeebe308c888ba9c7b3c8f0e/href</a></iframe><p>In both code scripts, you can modify the lines in the User Settings area.</p><ul><li>SENSOR_LOCATION_NAME — This helps you identify which sensor you are streaming data from.</li><li>BUCKET_NAME — This names your bucket and should be the same for both scripts.</li><li>BUCKET_KEY — This is an identifier telling Initial State what data bucket you want to send data to. This should be the same for both scripts.</li><li>ACCESS_KEY — You can find your Initial State access key by going to the settings page on your account. This should be the same for both scripts.</li><li>MINUTES_BETWEEN_READS — This is how long you want to script to wait until it reads from the sensor again.</li></ul><p>By making your access key and bucket key the same for each script, you will be streaming both sensors’ data in the same bucket.</p><p>To run the soil sensor code type:</p><pre>$ python3 is_soil.py</pre><p>To run the ambient light sensor code type:</p><pre>$ python3 is_ambientlight.py</pre><h3>IP Address</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*23TKZNIP8VqmgsiPKXQjuw.jpeg" /><figcaption>Pi Process Dashboard</figcaption></figure><p>I will always recommend <a href="https://github.com/initialstate/pi-process-dashboard/wiki">sending the IP address of your Pi to your dashboard</a>. This makes life easier so that if something goes awry, you can easily SSH into your Pi and get it resolved. No additional hardware is required, just another Python script to run in the background. You can stream the IP address to the same bucket as your plant data.</p><h3><strong>Auto-Run on Reboot</strong></h3><p>This is an important step in the process. If you set your Pi sensor code to run on reboot then if you lose power and it comes back, your code will start to automatically run when the Pi restarts. This can save you some time and heartache. Trust me.</p><p>In the Pi terminal type:</p><pre>crontab -e</pre><p>If this is the first time you have run crontab, it may ask you which text editor you want to use (I selected nano). Add the following line to the bottom of the crontab text file then save and exit:</p><pre>@reboot nohup python3 /home/pi/plantmonitor/is_soil.py &amp;</pre><p>or:</p><pre>@reboot nohup python3 /home/pi/plantmonitor/is_ambient.py &amp;</pre><p>You will need to specify the exact path of your script. Mine is kept in a folder called “plantmonitor.”</p><p>The nohup command is important. This stands for “no hangup” and allows you to create a process that runs in the background without stopping, even if your terminal window is closed. If you run your script from an SSH prompt without the nohup command, the script will exit as soon as your SSH connection is broken.</p><h3>Plant Dashboard</h3><p>You’ve got everything connected and your code is running, now it’s time to play with the data!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5eL2lyqnPKRiy4gSRCiPWg.png" /><figcaption>Initial State plant monitor dashboard</figcaption></figure><p><strong>Soil Moisture Values</strong></p><p>The soil sensor uses a capacitive touch measurement system to determine soil moisture. The soil moisture level can range from 200 (very dry) to 2000 (very wet). You can set the min and max on your gauge tile to these values.</p><p><strong>Temperature Values</strong></p><p>The soil sensor also has an internal temperature sensor that gives you ambient temperature readings. It is not highly accurate but can give you readings with +/- 2 degrees accuracy. It is a nice addition to be able to add this data to your dashboard.</p><p><strong>Ambient Light (Lux) Values</strong></p><p>The ambient light sensor measurements are in units of Lux (the SI unit of measurement for light. The sensor can measure from 0.0001 lux (moonless, overcast night) to 65,000 lux (direct sunlight). Plants that need low light can survive on the lower level of this range and plants that need direct light need the upper level.</p><p><strong>Tiles</strong></p><p>You have three data streams in your dashboard: temperature, ambient light, and moisture. I made three rows for each of the signals and made a pattern: summary tile, gauge tile, and line graph. For temperature I use the thermometer gauge tile, for moisture I use the liquid level gauge tile, and for ambient light, I use the arc gauge tile.</p><p>I specifically designed this dashboard to fit well on my Raspberry Pi monitor. I created <a href="https://support.initialstate.com/hc/en-us/articles/360002911751-Duplicating-a-Data-Bucket?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Indoor%20Plants%20-%20%5BFUS%5D%20-%20duplicate">duplicated views</a> for my desktop and <a href="https://support.initialstate.com/hc/en-us/articles/360002794132-Mobile-Support?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Indoor%20Plants%20-%20%5BFUS%5D%20-%20mobile">mobile</a> with a different arrangement of tiles and additional tiles included.</p><p><strong>Background Image</strong></p><p>Initial State allows you to choose a <a href="https://support.initialstate.com/hc/en-us/articles/360031958212-Add-a-Tiles-Dashboard-Background-Image?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Indoor%20Plants%20-%20%5BFUS%5D%20-%20background%20image">background image from Unsplash</a>, specify a background color, or <a href="https://support.initialstate.com/hc/en-us/articles/360031424331-Upload-Custom-Background-Image?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Indoor%20Plants%20-%20%5BFUS%5D%20-%20custom%20image">upload a custom background image</a>. This gives you limitless possibilities for dashboard creation. I searched for an indoor plant and choose an Unsplash image for mine.</p><p><strong>Mobile</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/283/1*yqS5P1FmZpo1EWi9RjAkTQ.jpeg" /></figure><p>Another good view to create for your dashboards is a <a href="https://support.initialstate.com/hc/en-us/articles/360002794132-Mobile-Support?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Indoor%20Plants%20-%20%5BFUS%5D%20-%20mobile">mobile view</a>. It’s easy to duplicate your dashboard and create a specific design that looks good on your phone and shows you all the necessary information in one small window.</p><p>All you need to do is stack your three signals in tiles in a column and set the tiles to the gauge types you want. This will make it so when you open your phone to view the dashboard you will have a compact view like the one you see here.</p><p><strong>Weatherstack Weather</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rj5mWKw6PuK9hEIpJ35jTw.png" /><figcaption>Initial State plant monitor dashboard with weather data</figcaption></figure><p>Not only can you have light, temperature, and plant moisture data in your dashboard, you can also stream in local weather data through the <a href="https://www.initialstate.com/weatherstack/?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Indoor%20Plants%20-%20%5BFUS%5D%20-%20weatherstack">Weatherstack Integration</a> in the Initial State <a href="https://support.initialstate.com/hc/en-us/articles/360036577972-Introduction-to-Integration-Marketplace?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Indoor%20Plants%20-%20%5BFUS%5D%20-%20data%20market">Integration Marketplace</a>. All you have to do is set up the integration with your zip code or coordinates and you can stream temperature, cloud cover, and current forecast. All these things will affect how much ambient light your plant is getting.</p><p><strong>Bucket Watchdog</strong></p><p>If you have your Pi processes set up to run on reboot, you are good to go if your Pi restarts. But what happens if your Pi has an issue and shuts off completely? You’ll want to know if your dashboard stops receiving data so you can get it fixed quickly. The <a href="https://support.initialstate.com/hc/en-us/articles/360041087352-Bucket-Watchdog-Integration?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Indoor%20Plants%20-%20%5BFUS%5D%20-%20bucket%20watchdog">Bucket Watchdog Integration</a> in the Initial State Integration Marketplace can monitor the signals sent to your bucket and alert you if it receives fewer signals than anticipated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jyT2HzVpJ2_QoNMdAca5-g.jpeg" /><figcaption>Initial State plant dashboard on Raspberry Pi monitor</figcaption></figure><p>This project is slowly helping me with my plant mom skills. My goal is to kill slightly fewer plants this year now that I can monitor how much light and water they are getting. I encourage you to give this project a try and let me know how it goes!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51a2294b88e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/initial-state/how-to-use-a-soil-moisture-sensor-to-keep-your-plants-alive-51a2294b88e">How to Use a Soil Moisture Sensor to Keep Your Plants Alive</a> was originally published in <a href="https://medium.com/initial-state">Initial State</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Raspberry Pi Refrigerator/Freezer Monitor]]></title>
            <link>https://medium.com/initial-state/how-to-build-a-raspberry-pi-refrigerator-freezer-monitor-f7a91075c2fd?source=rss----cc2c6209cafb---4</link>
            <guid isPermaLink="false">https://medium.com/p/f7a91075c2fd</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[sensors]]></category>
            <category><![CDATA[makers]]></category>
            <dc:creator><![CDATA[Rick Kuhlman]]></dc:creator>
            <pubDate>Thu, 03 Sep 2020 15:39:36 GMT</pubDate>
            <atom:updated>2023-08-30T14:12:38.411Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GiGKJfcn0gNzR28mOarwzg.jpeg" /></figure><p>Breast Milk — or liquid gold as many moms attest — can be extremely difficult to generate and keep in order to create a consistent supply for your little one.</p><p>One afternoon, my wife called me in tears. She noticed that the chest freezer in our pantry suddenly quit working. Months worth of breast milk was ruined. She was understandably depressed. So much so, that I never mentioned that I lost a few important things too — three racks of ribs, a pork butt, and a whole box of mozzarella sticks.</p><p>Losing breast milk really sucks, but there are lots of stories about refrigerators and freezers malfunctioning with devastating consequences. In March of 2018, two fertility clinics lost frozen embryos within days of each other — first in <a href="https://www.chicagotribune.com/lifestyles/health/ct-eggs-embryos-damage-fertility-clinic-20180309-story.html">Ohio</a>, and then in <a href="https://www.cbsnews.com/news/2nd-fertility-clinic-has-freezer-failure-jeopardizing-thousands-of-frozen-eggs-and-embryos/">San Francisco</a>.</p><p>This tutorial will tell you exactly how to build a smart freezer thermometer that SMS/Texts and emails if it has a problem. You can make this fully-monitored reliable solution for temperature and humidity in a freezer or refrigerator at a cost of around 30 dollars. The system also monitors the temperature sensor acquisition device in case it malfunctions. With this double-redundancy, you can be confident that if temperatures start to deviate or the device stops working, you will be notified in plenty of time to make arrangements.</p><blockquote>Can’t I just throw a wireless SmartThings sensor in the freezer? Unfortunately, No — alkaline batteries and lithium batteries do not work when frozen.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FhSwVGgmGjhU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhSwVGgmGjhU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FhSwVGgmGjhU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/452ff71ea62be59ac9e1058f8b481437/href">https://medium.com/media/452ff71ea62be59ac9e1058f8b481437/href</a></iframe><h3>Refrigerators and Freezers</h3><p>The only real difference between a working refrigerator and a freezer is temperature range. However, when they malfunction or a power outage occurs the timeframes for keeping food at a safe temperature varies widely, and it depends on what’s inside. Food is one thing, but what about certain medicines, vaccines, embryos, criminal DNA evidence, or even those <a href="https://www.vice.com/en_us/article/bmdjkq/would-you-pay-dollar80000-to-freeze-your-head-if-it-meant-you-had-a-second-shot-at-life">cryogenic head-freezing services</a>.</p><blockquote><strong>Did you know?</strong> A <strong>full</strong> freezer runs more efficiently and last longer in a power outage, because there’s less space for warm air to intrude when the door opens. Also, there is more frozen material to keep the space cooler longer.</blockquote><ul><li>Refrigerator |Operating Temperature: 36°F to 40°F | Spoilage: 4 Hours</li><li>Freezer | Temperature: -2°F to 0°F | Spoilage: up to 48 hours</li></ul><p><strong><em>note: </em></strong><em>Spoilage times vary widely if you open the door. Keep it closed if you can help it.</em></p><h3>Materials Needed</h3><ul><li><a href="https://www.sparkfun.com/products/14277">Raspberry Pi Zero W </a>— $10 Raspberry Pi, great for headless applications, because it’s small, cheap, and has integrated Wifi.</li><li><a href="https://www.amazon.com/16GB-Micro-SDHC-Class-Flash/dp/B0047FR4M6/ref=sr_1_1_sspa?dchild=1&amp;keywords=micro+sd+card&amp;nav_sdd=aps&amp;pd_rd_r=725e64bb-e18f-4756-a2ad-bf3bd9cd9262&amp;pd_rd_w=WURde&amp;pd_rd_wg=5nlnW&amp;pf_rd_p=e47220c0-687b-448f-b180-4a20654b7464&amp;pf_rd_r=MZNENCFMWCF7CE01GZ2F&amp;qid=1598880949&amp;refinements=p_n_feature_two_browse-bin%3A6518303011&amp;s=pc&amp;sr=1-1-spons&amp;psc=1&amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUExRFpOUUdGMUNRR1NQJmVuY3J5cHRlZElkPUEwMDk3NDYyMklNMDY5UzRRM0RBMiZlbmNyeXB0ZWRBZElkPUEwOTMwMTY2MVFWQ1dYRFBEOTlQVSZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU=">MicroSD card</a> — 16GB is enough for the operating system and code.</li><li><a href="https://www.adafruit.com/product/2652">BME280 </a>— Integrated temperature and humidity sensor. You can find these for very cheap, but you’ll want it already integrated onto a breakout board, and it needs to expose the I2C lines for this tutorial code to work.</li><li><a href="https://www.digikey.com/product-detail/en/hammond-manufacturing/1551QGY/HM1128-ND/2094866">Hammond Miniature ABS Enclosure</a> — Model: 1551QGY — used to enclose and mount the sensor inside the freezer.</li><li><a href="https://www.digikey.com/product-detail/en/te-connectivity-amp-connectors/A9AAT-0808F/A9AAT-0808F-ND/137565">Flat Flex Cable</a> — TE Connectivity Part: A9AAT-0808F — This is crucial, we need an extremely flat cable to bridge the seal of the freezer without causing an air leak. In addition, the linked cable already has solder tabs at the proper spacing for standard through-holes on the Pi and the BME280 protoboard.</li></ul><h3>Hardware Setup</h3><p>We are just going to wire the sensor directly to the Raspberry Pi — No extra components required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QFSF2xI_AsKJtML7_6SBiA.png" /><figcaption>Wiring diagram for connecting Raspberry Pi Zero W to Adafruit BME280</figcaption></figure><ol><li>Modify the cable — The protoboard for the BME280 has 7 solder points, but the cable has 8 connectors. I used a utility knife to carefully strip off one conductor.</li><li>Solder to the sensor board — this is where choosing the right flat flex cable comes in handy. The solder tabs already line up with the holes.</li><li>Modify enclosure — I needed to Dremel away the lip of the mounting ridge for the cable to friction fit and exit the enclosure.</li><li>Mark your signals — before closing the clamshell enclosure, it is a good idea to mark the signals on other end of the cable with a sharpie. We’ll need to locate the two wires for I²C : Clock — SCL and Data — SDA. Also locate your power pins and ground.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ggpCPnjHp-uOmeYRCydYg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QXPTH9OYJh-4gnK18xZHsA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jNFR_0fICgpzH46r-9FWeQ.png" /><figcaption>Solder the sensor, modify the enclosure, and close it up.</figcaption></figure><ol><li>Cut Flat Flex into “flying leads” — Slice each of the flat flex conductors you need into individual wires so they are flexible enough to go through the proper connection points.</li><li>Solder — I soldered the leads right to the board, but there are lots of way to interface between the Raspberry Pi I/O and your flat flex leads.</li><li>Install — The flat flex goes between the freezer seal and the edge of the freezer. Sensor on the inside — Pi on the out side. Use double sided Velcro or suction cups so that you can easily take the sensor in and out.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*av2uuOKf-6n6FAuKuZirWA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0JBAEnb3Q_07ZmbpCYve6Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MDTdMsW10-Do1qlY3pxhnA.png" /><figcaption>Connected to the proper I/O and mounted with velcro in the fridge</figcaption></figure><p><strong><em>troubleshooting notes:</em></strong><em> (1) If you use the BME280 from Adafruit, you should solder in a jumper from CS to VIN to increase I²C reliability. (2) I connected VIN to the 5V pin on the Pi. This is not always the case because some BME280 breakout boards use the 3.3V.</em></p><h3>Software: Raspberry Pi Setup</h3><p>Our goal is to bring up the Raspberry Pi Zero W with a fresh operating system, and enable I2C.</p><ol><li><strong>Get Raspbian Lite</strong> onto your MicroSD card using and SD card reader for your computer. Once you can access the SD card from a computer, use the <a href="https://www.raspberrypi.org/downloads/">imagers available from raspberry Pi </a>to get a fresh image installed.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k3YTFufujw1LUEbY1kG70g.png" /></figure><p>2. <strong>Enable SSH </strong>— After the imager finishes you should see a root directly on the SD card named boot . Simply create an empty file called ssh to enable ssh. Yeah that’s it for that.</p><p>3. <strong>Setup Wifi</strong> — create a simple text file and call it wpa_supplicant.conf. Edit the file with your own wifi credentials like this:</p><pre>country=us<br>update_config=1<br>ctrl_interface=/var/run/wpa_supplicant</pre><pre>network={<br> scan_ssid=1<br> ssid=&quot;MyNetworkSSID&quot;<br> psk=&quot;MyPa55w0rd&quot;<br>}</pre><p>4. <strong>Move your SD card</strong> from your PC to the socket on your raspberry pi and apply power. You need to wait about 30 seconds or so until your device connects to wifi.</p><h3>Software: Get an SSH Terminal</h3><p>In order to log in to your device, you’ll need to SSH in. First though, you need to find your Raspberry Pi IP address on your local network. There are a couple of ways of doing that from your computer:</p><ol><li>A fresh raspberryPi image will have a hostname of raspberrypi . Try searching for that in your router device list.</li><li>Open the terminal on your computer and try pinging it. ping raspberrypi.local</li><li>If those don’t work take a deeper dive at the <a href="https://www.raspberrypi.org/documentation/remote-access/ip-address.md">IP Address page</a> on raspberrypi.org</li></ol><p>Once you get your IP Address use SSH in the terminal to log in to your device. pi is a default username and the default password is raspberrypi</p><pre>ssh pi@192.168.86.30</pre><h3>Software: I²C Setup</h3><p>I²C is not on by default and the fresh install of Raspbian Lite does not have all the drivers.</p><ol><li>Enable I²C in the OS by opening the configuration menu:</li></ol><pre>sudo raspi-config</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*km125W3QZu_bMH24.png" /></figure><p>Select 5 Interfacing Options, P5 I2C, and select &lt;YES&gt; to enable i2c. Select &lt;Finish&gt; to save and exit.</p><p>2. Install smbus and i2c-tools</p><pre>sudo apt-get install -y python-smbus i2c-tools</pre><p>3. Verify installation using this command. If you see something like the output below, you are good.</p><pre>lsmod | grep i2c_</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*xxwM6ztdPlHMfFUP22GvRg.png" /></figure><p>4. This is the moment of truth! Test your connection to the I²C bus of the BME280 sensor. You should see an address at 0x76 or 0x77 like below. Take note of the address, we’ll need it later.</p><pre>sudo i2cdetect -y 1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*Zs5CynuJcF5YwCznJj6TpQ.png" /></figure><h3>Software: Install Python Libraries</h3><ol><li>First let’s get pip to make everything easier. pip comes pre-installed on Raspbian full but not Raspbian lite.</li></ol><pre>sudo apt install python3-pip</pre><p>2. Install the BME280 pre-made raspberry pi driver, which gives us quick access to the sensor readings in our code.</p><pre>sudo pip3 install RPi.bme280</pre><p>3. Install the Initial State streamer library which creates a simple data stream connection to Initial State for monitoring, alarming, and the dashboard.</p><pre>sudo pip3 install ISStreamer</pre><h3>Software: Python Code</h3><p>Now we are finally ready to drop some code. To start a new program on the Pi, use nano and copy/paste the code below:</p><p>nano freezer_monitor.py</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/de692404bcd3640aab6693b7174449f4/href">https://medium.com/media/de692404bcd3640aab6693b7174449f4/href</a></iframe><ul><li>The User Settings area is for you to fill in your desired names and sampling. It is a good idea to use 10 minutes as a preset minimum for this use-case.</li><li>You will need an access Key from Initial State. Register for a <a href="https://go.init.st/register-iot?utm_source=medium&amp;utm_medium=web&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20how-to-monitor-freezer">free trial</a>, with no credit card required. The account access key has to be specified on line 10. Copy/paste this key from your Initial State account settings. (<a href="https://support.initialstate.com/hc/en-us/articles/360002898512-Streamer-Concepts-Streaming-Access-Key?utm_source=medium&amp;utm_medium=web&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20freezer-monitor-more-info">more info</a>).</li><li>You’ll also need to fill in the I²C Address we found after setting up and testing the bus. Edit line 16. Mine was 0x77, yours may be something else. I’ve seen 0x76 on other BME280 sensor setups.</li><li><strong>WHILE TESTING: </strong>Uncomment lines 36–37 and Comment line 40. I added some code in the bottom to test your implementation more efficiently. It reduces the sleep time so you see faster sensor reads and prints them to console.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*GKCImS8j3HZPn5aBs3McRA.png" /><figcaption>With the testing code, you’ll see sensor output, and you should be seeing data on a dashboard in Initial State.</figcaption></figure><ul><li><strong>FINAL PRODUCT: </strong>Comment lines 36–37 and uncomment line 40.</li></ul><pre>python3 freezer_monitor.py</pre><h3>Build a Web Dashboard</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hvVouk0NCv3loL7CEnH8Fw.png" /><figcaption>You can check on my actual fridge if you like! Public Link — <a href="https://go.init.st/clht3qr?utm_source=medium&amp;utm_medium=web&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20freezer-monitor-dashboard-example">https://go.init.st/clht3qr</a></figcaption></figure><p>Go to your Initial State account (<a href="https://iot.app.initialstate.com/?utm_source=medium&amp;utm_medium=web&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20how-to-monitor-freezer-iot">https://iot.app.initialstate.com</a>), click on the “❄ Pantry Freezer” bucket name on your bucket shelf, and view the data coming into your dashboard. It’s live now, so go nuts… customize your dashboard by adding and sizing line graphs, gauges, statistics, images etc. (<a href="https://support.initialstate.com/hc/en-us/sections/360000629511-Tiles?utm_source=medium&amp;utm_medium=web&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20freezer-monitor-more-info">more info</a>). Use expressions to <a href="https://support.initialstate.com/hc/en-us/articles/360003153712-Rounding-Decimals?utm_source=medium&amp;utm_medium=web&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20freezer-monitor-more-info">round decimals</a> and <a href="https://support.initialstate.com/hc/en-us/articles/360003171991-Unit-Conversion?utm_source=medium&amp;utm_medium=web&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20freezer-monitor-more-info">convert to degrees Fahrenheit</a> if you like. Make it easy to read</p><blockquote><strong>Wanna see a public dashboard of my actual fridge? </strong><a href="https://go.init.st/clht3qr?utm_source=medium&amp;utm_medium=web&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20freezer-monitor-dashboard-example"><strong>https://go.init.st/clht3qr</strong></a></blockquote><h3>Brass Tacks: Alert me when temperature goes wrong</h3><p>Monitoring on a dashboard is one thing, but the real value comes when we turn this into a smart thermometer <em>alarm</em>. We need to set an alert when the temperature drifts too high. SMS/Text and email coupled with a smart phone essentially deliver audible and visual alarms. This is done via triggers in Initial State. With a hosted IoT platform, the system can watch temperatures 24/7 and send you an email and a text when things go wrong.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ctxgl1jwCeiLsS-MdtEiWw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*byGSvMtIdnr1ntJg0BUawQ.png" /><figcaption>Set a trigger in Initial State to watch and alert on you fridge temperature 24/7.</figcaption></figure><h3>Make it Reliable: Run on Startup and/or Reboot</h3><p>To make our setup more robust, we need to kick off our Python script every time our Pi boots. This way the temperature monitor will restart without any intervention when we have a power outage.</p><p>Adding a process that runs on boot is really easy. At the Pi terminal:</p><pre>crontab -e</pre><p>It might ask which text editor you want to use (e.g. nano). Add one line to the bottom of the crontab file save and exit:</p><pre>@reboot nohup python3 /home/pi/freezer_monitor/freezer_monitor.py &amp;</pre><p>You will need to specify the exact path of your script. In the example above, I created a directory called freezer_monitor and the script is called freezer_monitor.py.</p><p>Now your code will run headless any time your Pi reboots.</p><h3>Make it Reliable: The Watchdog</h3><p>Anything can happen, so you need a foolproof way of “monitoring the monitor.” We could do more process monitoring on the Pi itself, but the broadest way to make sure everything is running is to make sure the “heartbeat” of data is continuing to come at regular intervals from the device. If the device breaks, looses power, looses internet, or stops working, the Initial State Watchdog trigger can alert you in a timely fashion. Access the Watchdog Trigger in the <a href="https://support.initialstate.com/hc/en-us/articles/360036577972-Introduction-to-Integration-Marketplace?utm_source=medium&amp;utm_medium=web&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20freezer-monitor-more-info">Initial State Integration Marketplace</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vJiycf6cBh6rKobcMxT-bA.png" /><figcaption>Configure the Bucket Watchdog Data Integration</figcaption></figure><p>The bucket watchdog counts incoming data points in the specified time interval. In the image above, I set the watchdog to watch my “Pantry Freezer” Bucket and return the count every 15 minutes. Since the code sends something every 10 minutes, we expect the number in the last 15 minutes to always be &gt; 1. This logic becomes the trigger you make in your dashboard that ultimately sends you a text and/or email.</p><p><strong><em>Note: </em></strong><em>The reason you set it to 1 and not 0 is because the watchdog itself sends one data point. If the devices stops sending, then that count will go down to one.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rvyUlmqsRgqcuY8rbgY_Ew.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*reX0xnnYXtmqmykWtb9NGw.png" /><figcaption>When data points haven’t been received in 15 minutes, send an SMS and Email Alert.</figcaption></figure><h3>Conclusion</h3><p>Monitoring refrigerators and freezers should be more common than it is. Shouldn’t my freezer just do this out of the box? Shouldn’t commercial units? Well until that day, use this tutorial to create a cheap redundant system for critical assets in just a few hours.</p><p>Ahhh… Although our family is through the breastfeeding phase, I can finally sleep at night knowing my two prime briskets from my last Costco run are safe and sound (and frozen)! My freezer alarm’s got me covered.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7a91075c2fd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/initial-state/how-to-build-a-raspberry-pi-refrigerator-freezer-monitor-f7a91075c2fd">How to Build a Raspberry Pi Refrigerator/Freezer Monitor</a> was originally published in <a href="https://medium.com/initial-state">Initial State</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Logging and Supervising Your Remote Temperature Monitor]]></title>
            <link>https://medium.com/initial-state/logging-and-supervising-your-remote-temperature-monitor-db4278859853?source=rss----cc2c6209cafb---4</link>
            <guid isPermaLink="false">https://medium.com/p/db4278859853</guid>
            <category><![CDATA[diy]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[makers]]></category>
            <category><![CDATA[temperature-monitoring]]></category>
            <category><![CDATA[iot]]></category>
            <dc:creator><![CDATA[Rachel-Chloe Gregory]]></dc:creator>
            <pubDate>Mon, 24 Aug 2020 20:28:05 GMT</pubDate>
            <atom:updated>2020-08-24T20:28:05.458Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="IoT Sensor Watchdog Dashboard" src="https://cdn-images-1.medium.com/max/1024/0*GQotTbdcRHXehSrR" /></figure><p>With the rise of the Internet of Things (IoT) came the rise of affordable sensors — the most popular being remote temperature sensors. Temperature has a wide range of uses, from energy savings and comfort to safety and refrigeration.</p><p>You put temperature sensors in every building you’re in charge of, you’ve got an app to see the current temperature, but what about temperature trends over a long period of time? What if one of your wireless sensors goes offline without you knowing? That’s where Initial State’s new Bucket Watchdog service comes in.</p><h3>Background Info: Initial State</h3><p><a href="https://www.initialstate.com/?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20watchdog%20-%20%5BSU%5D">Initial State</a> is an Internet of Things platform for data visualizations. You can stream real-time data into your Initial State account and build dashboards and custom trigger alerts from your data. The user friendly platform also allows you to view historical data.</p><h3>Background Info: Bucket Watchdog Integration</h3><figure><img alt="Initial State Bucket Watchdog Integration tile" src="https://cdn-images-1.medium.com/max/574/0*oWHS7JV6OR3G4sqx" /></figure><p>The <a href="https://support.initialstate.com/hc/en-us/articles/360041087352-Bucket-Watchdog-Integration?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20watchdog%20-%20%5BPV%5D">Initial State Bucket Watchdog Integration</a> remotely monitors your data bucket to ensure it’s continuously receiving data. Setting it up is as easy as a few button clicks, and you can set trigger alerts to let you know when a sensor has stopped streaming.</p><h3>Case Study: Warehouse Sensors</h3><p>Imagine you have a set of warehouses in multiple locations that you’ve outfitted with the latest wireless sensors to monitor temperature. Not only is it important that each warehouse stays within a certain temperature range, but you need to know if any sensors go offline. Disconnected sensors could mean anything from a poor internet connection to a power outage, which could be disastrous for your warehouse contents.</p><h4>Step 1: Connect your sensors to Initial State</h4><p>If you haven’t set up your sensor network yet, there are a variety of ways for you to get started. We have a large library of tutorials that detail how to create a sensor network with <a href="https://medium.com/initial-state/how-to-build-your-own-esp32-temperature-monitor-6967b797b913">ESP32</a>, <a href="https://medium.com/initial-state/how-to-build-a-raspberry-pi-temperature-monitor-8c2f70acaea9">Raspberry Pi</a>, <a href="https://support.initialstate.com/hc/en-us/sections/360000823331-SmartThings-Integration?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20watchdog%20-%20%5BPV%5D">SmartThings</a>, <a href="https://support.initialstate.com/hc/en-us/articles/360001541991-Streaming-from-IFTTT?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20watchdog%20-%20%5BPV%5D">IFTTT</a>, an <a href="https://support.initialstate.com/hc/en-us/categories/360000176032-Data-Sources?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20watchdog%20-%20%5BPV%5D">Initial State SDK</a> and our <a href="https://support.initialstate.com/hc/en-us/articles/360001525792-Streaming-via-RESTful-Events-API?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20watchdog%20-%20%5BPV%5D">API</a>. Once you have an Initial State account, it’s easy. You can see from the video below just how simple it is to create remote temperature monitoring systems with Initial State.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FXWRQdPAqEIU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXWRQdPAqEIU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FXWRQdPAqEIU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c3e8228f364fd0af2d10f7f53c7edce/href">https://medium.com/media/7c3e8228f364fd0af2d10f7f53c7edce/href</a></iframe><p>Below, you can see my dashboard of readings from my temperature monitoring system in four different warehouses.</p><figure><img alt="Remote Temperature Monitor" src="https://cdn-images-1.medium.com/max/1024/0*V1jeQmtiwsTcsT-l" /><figcaption><em>I have four different sensors reporting at 15 minute intervals</em></figcaption></figure><h4>Step 2: Add the Watchdog integration to your dashboard</h4><p>Once you’ve got your Initial State dashboard up and running, you can add the Bucket Watchdog integration to make sure your sensors are still streaming. To do this, click the link on your Initial State home page to go to the <a href="https://integrations.initialstate.com/#/marketplace?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20watchdog%20-%20%5BPV%5D">Integration Marketplace</a>.</p><p>Click “Details” under the “Bucket Watchdog” integration. You’ll have to authorize Initial State to access your data, then click “Begin Setup” to go to the setup window.</p><p>In the setup window enter the name of the integration. I named mine “Warehouse Bucket Watchdog”. Choose the bucket to monitor from the dropdown — my bucket is “Warehouse Monitor”. The monitoring period is how many minutes you’re expecting events. My sensors are reporting every 15 minutes, so I chose the 15 minute interval. If you don’t need to check that frequently, you can choose every 30 minutes, every hour, or daily.</p><figure><img alt="Initial State Bucket Watchdog Integration Setup Page" src="https://cdn-images-1.medium.com/max/1024/0*LlhxmLFb-DTIHPee" /><figcaption><em>My Watchdog Integration setup for the bucket “Warehouse Monitor”</em></figcaption></figure><p>Once you make all your selections, click “Start Integration”. You should see your new bucket appear on the bucket shelf.</p><p>This is what my Bucket Watchdog bucket looks like:</p><figure><img alt="Remote Temperature Monitor" src="https://cdn-images-1.medium.com/max/1024/0*1KENqeBzuhVF9KNL" /><figcaption><em>I added the fun emoji using </em><a href="https://support.initialstate.com/hc/en-us/articles/360003152772-Map-Values-to-Emojis?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20watchdog%20-%20%5BPV%5D"><em>Real-Time Expressions</em></a></figcaption></figure><p>I have four different sensors, each sending only one temperature value every 15 minutes. The Watchdog sees that four new values have been added to my dashboard in the past 15 minutes. If I had a longer check interval (like an hour), the Watchdog would see more than four events. For an hourly check, there should be sixteen events.</p><p>The Watchdog integration is very useful for noticing a problem quickly. With lots of data in your dashboard, especially a lot of temperature readings at or around the same value, it can be difficult to spot a dead sensor. In the image below, Warehouse 2’s sensor has been dead for 30 minutes, but you can hardly tell.</p><figure><img alt="Remote Temperature Monitor" src="https://cdn-images-1.medium.com/max/1024/0*DdFrx4buuhoR-Ug3" /></figure><p>The Watchdog dashboard makes it extremely obvious:</p><figure><img alt="Remote Temperature Monitor" src="https://cdn-images-1.medium.com/max/1024/0*Dwnb1K9p1yVhRH-M" /></figure><p>And the best part? You don’t even need to look at the dashboard for it to tell you something has wrong when you add Triggers.</p><h4>Step 3: Add Triggers to your Watchdog stream</h4><p><a href="https://support.initialstate.com/hc/en-us/articles/360002974332-Introduction-to-Triggers?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20watchdog%20-%20%5BPV%5D">Triggers</a> are Initial State’s built-in email or text alert system. They give you the ability to set an action that will occur on a specified condition for your data stream.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*5w67k-1SeMUs5TLo4-pUfw.png" /></figure><p>To set a trigger, simply click on “Settings” underneath your Watchdog bucket and select the “Triggers” tab. Click “Create New Trigger” to set up your trigger conditions and add a verified phone number or email address.</p><p>In my warehouse example, I want to know if my stream events ever drop below four in a fifteen minute period, so I set up the trigger on the right.</p><p>Now I get a text message any time my streams fall below four!</p><h3>Conclusion</h3><p>Remote temperature sensors are only useful if you can keep an eye on them remotely. From temperature to humidity readings, from warehouses to smart homes, wireless sensors are becoming more important to everyday business.</p><p>There are an infinite number of ways to maximize your data using Initial State and the Bucket Watchdog, from adding <a href="https://medium.com/initial-state/build-a-weather-dashboard-that-sends-alerts-using-a-weather-data-api-deccdd56e2a9">weather station data to your dashboard</a>, to <a href="https://support.initialstate.com/hc/en-us/articles/360003264631-Add-Icon-to-iOS-Home-Screen">adding an icon to your iOS home screen</a> for a mobile app like experience, and so much more. Keep an eye on your investments with real-time alerts and historical records of outages and time to get back online.</p><p>There is never a better time than now to g<a href="https://go.init.st/register-iot?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BFeat%5D%20-%20watchdog%20-%20%5BSU%5D">et started with Initial State</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db4278859853" width="1" height="1" alt=""><hr><p><a href="https://medium.com/initial-state/logging-and-supervising-your-remote-temperature-monitor-db4278859853">Logging and Supervising Your Remote Temperature Monitor</a> was originally published in <a href="https://medium.com/initial-state">Initial State</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Monitor Your Boat During the Winter Months]]></title>
            <link>https://medium.com/initial-state/how-to-monitor-your-boat-during-the-winter-months-d89f7d76a88d?source=rss----cc2c6209cafb---4</link>
            <guid isPermaLink="false">https://medium.com/p/d89f7d76a88d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[makers]]></category>
            <category><![CDATA[diy]]></category>
            <dc:creator><![CDATA[Elizabeth Adams]]></dc:creator>
            <pubDate>Thu, 06 Aug 2020 14:30:02 GMT</pubDate>
            <atom:updated>2020-09-01T17:02:06.865Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DUwEGdoS9MeeaghoWoGuyA.jpeg" /><figcaption>Unsplash photo by <a href="https://unsplash.com/@kristelhayes">Kristel Hayes</a></figcaption></figure><p>It’s summer time and for some of us that means sunshine, outdoors, and water. If you are lucky enough to live near an ocean or lake and you are a boat owner, that can also mean that it’s boat time.</p><p>During the summer months it is much easier to monitor your boat because you are always on it. What happens when summer ends and you need a way to make sure things are sitting smoothly while you are away? Some boat monitoring systems can run you thousands of dollars and be a pain to install. What if there was a way to spend less and still be able to monitor your boat in real-time and get alerts when things go awry?</p><p>This is a DIY solution using a Raspberry Pi, some electronics, and Initial State to monitor your boat, so you can have all the data when you are on it and when it’s in the slip. You can monitor temperature, battery voltages, shore power, and bilge pump cycles. This remote monitoring solution allows you to monitor your boat from anywhere in the world. It will give you a peace of mind knowing your boat is safe and secure.</p><p>There are a lot of reasons why you would want to know what is going on with your boat in the slip. For example, let’s examine bilge pump cycles. As the name suggests, bilge pumps pump water. They push water out of the bilge (lowest point on the inside of the boat) so that your boat doesn’t sink. Water can get into your bilge a multitude of ways: spray while driving the boat, rain and storms, missing plug. Today most bilge pumps are automatic but what happens if one fails? Being able to monitor how often your bilge pump is cycling can give you assurance yours is still in working condition and is pushing the bilge water out.</p><p>Let’s next look at shore power. Shore power is what you use for power when you have your boat docked and not running. This not only charges your battery but also lets you run AC powered devices on your boat. Constant shore power during the winter months is necessary to keep your batteries charged and Pi running. And if the power is out, who knows what else might be wrong. You can’t monitor your boat if you Pi is dead.</p><p>Lastly, battery voltages and temperature are a no brainer. Is the temperature too hot or too cold? Is that going to affect your boat and the devices on it? Are your batteries dead and need to be replaced? This kind of general information is important to have a clear picture of the health of your boat.</p><p>This project was implemented by the very smart and very creative John Poindexter. John was gracious enough to let me share this project with the world so please enjoy.</p><h3>Basics of What You’ll Need</h3><p>First things first, you’ll need a <strong>boat</strong>. The boat used in this project was a 1990 Hunter Passage 42 sailboat. While this project is tailored to this boat, you can modify what is documented to fit your boat.</p><p><a href="https://www.adafruit.com/product/3055"><strong>Raspberry Pi 3</strong></a> &amp; <a href="https://thepihut.com/products/noobs-preinstalled-sd-card"><strong>SD Card</strong></a><strong> </strong>to collect and send data.</p><p><a href="https://www.initialstate.com/?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Boat%20Monitor%20-%20%5BSU%5D%20-%20boat%20monitor"><strong>Initial State</strong></a> to log data, view real-time conditions, and send alerts.</p><p><a href="https://www.radioshack.com/search?q=prototyping+board"><strong>RadioShack General Purpose Prototyping Board</strong></a>.</p><p><a href="https://kicad-pcb.org/"><strong>KiCad</strong></a> for interface board layout or PCB design.</p><p><a href="https://www.netgear.com/service-providers/products/mobile/mobile-hotspots/AC815S.aspx"><strong>Netgear AirCard 815S mobile hotspot</strong></a><strong> </strong>for internet connectivity.</p><p>A few <strong>miscellaneous electronic accessories</strong> for your interface between the boat inputs and the Raspberry Pi.</p><p>*Note: This project is not for the faint of heart. This is one for those who like a challenge and enjoy building their own systems. When it’s all said and done, you’ll feel good knowing you built it yourself.</p><h3>The Details</h3><p><strong>Raspberry Pi</strong></p><p>I recommend using a <a href="https://www.adafruit.com/product/3055">Raspberry Pi 3</a> or Raspberry Pi 4. It can connect to WiFi and send your data to a real-time monitoring solution. If your Pi isn’t already set up, you can follow the instructions on <a href="https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up">Raspberry Pi’s blog</a> to get started.</p><p><strong>Raspberry Pi keyboard &amp; monitor</strong></p><p>While not absolutely necessary to this project, a Raspberry Pi keyboard and monitor make it a lot easier to work with your Pi and get things done. The <a href="https://www.sunfounder.com/10-1-inch-hdmi-lcd.html">Sunfounder monitor</a> and <a href="https://www.logitech.com/en-us/product/wireless-touch-keyboard-k400r">Logitech Wireless Touch Keyboard K400</a> were both used in the making of this project.</p><p>For the keyboard to be compatible with the latest version of Raspbian, you’ll need to install <a href="https://github.com/pwr-Solaar/Solaar">Solaar</a>. Solaar is a Python version of the Logitech Unifying software.</p><p>Run the following in the terminal window of your Raspberry Pi:</p><pre>sudo apt-get install solaar</pre><p>After installation, you can find the Solaar app under the Accessories of the Pi as well as on the top menu bar. In addition to providing a pairing function it also shows the state of the battery.</p><p>There are lots of options for Raspberry Pi monitors and keyboards. Any one you choose will be good and make working with your Pi easier.</p><p><strong>Mobile Hotspot</strong></p><p>This <a href="https://www.netgear.com/service-providers/products/mobile/mobile-hotspots/AC815S.aspx">mobile hotspot</a> is used since marina WiFi can be unreliable for continuous connectivity. Really any mobile hotspot will do, you just need something that allows you to be continuously connected to WiFi. Follow the directions for the device you buy to set it up.</p><p>You’ll want to <a href="https://projects.raspberrypi.org/en/projects/raspberry-pi-using/3">connect your Pi to the WiFi</a> (whether marina or hotspot). Your hotspot will have 3 passwords: WiFi password, guest password, and admin login password. You can use the WiFi password to connect your Pi.</p><p>Your hotspot does have a battery but to keep it continuously running you’ll want to leave it plugged in. This is also why shore power is so important. Without power your Pi and hotspot both die, which will require an in person visit to resolve.</p><p><strong>Initial State</strong></p><p><a href="https://www.initialstate.com/?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Boat%20Monitor%20-%20%5BSU%5D">Initial State</a> is a data visualization software that can be used for real-time data monitoring and historical data evaluation. While this is the data visualization platform that is used for this project, you can use any platform that allows you to send in data via an API.</p><p>Initial State offers a free tier for students with an active edu email address, an individual tier for hobbyists and prototypers for $9.99/month, and an enterprise tier for businesses starting at $20/month. Every account is given a 14-day free trial to test out all features and functions on the platform.</p><p>Once you <a href="http://iot.app.initialstate.com/?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Boat%20Monitor%20-%20%5BSU%5D">register for an account</a>, you can go to your settings and view your access keys. An access key allows you to send data into your account. You’ll use your access key in the Python script later in the article.</p><p><strong>SSH’ing &amp; IP Address</strong></p><p>One of the issues that occurred while doing this project was that the Raspberry Pi IP address wasn’t static and changed frequently. This makes it difficult to remotely SSH into your Pi when you don’t know the IP address. There is an easy solution for this.</p><p><a href="https://github.com/initialstate/pi-process-dashboard/wiki">The Pi Process tutorial</a> shows you how to monitor your Pi’s processes and it’s IP address. You can send the IP address of your Pi to your Initial State dashboard. Knowing your Pi’s IP address makes it easy for you to remotely SHH into your Pi to access it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*23TKZNIP8VqmgsiPKXQjuw.jpeg" /><figcaption>Initial State Pi IP address dashboard</figcaption></figure><p><strong>Interface Board</strong></p><p>You‘ll need to find a copy of your boat’s schematics. You can generally find this in your user manual or online. This will help you to understand the boat’s inputs. The interface board will be a connection between the boat’s inputs and the Raspberry Pi. You can use KiCad to design the layout for the connections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vVjcgz_eessfHPgHFTh5HQ.png" /><figcaption>Boat Monitoring System Interface Board Electrical Layout</figcaption></figure><p><strong>Project Layout</strong></p><p>This diagram shows the entire project layout including the Raspberry Pi, boat inputs, and interface board.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X4ZjWAYQhvm3ddqZvOFs2A.jpeg" /><figcaption>Boat Monitoring System Layout</figcaption></figure><p>This is a list of the boat inputs and what was needed for connection to the Raspberry Pi.</p><p>Bilge Pump Cycles — PTV12010WAH 12V to 5V Power, R40–11D2–12 Counter Relay</p><p>Shower Power — 3.3V Bus, Ground Bus, BTA6–2C-J-CW-120 120VAC Relay</p><p>Battery1 &amp; Battery 2 V — Voltage Divider, MCP3008 8 Channel ADC</p><p>Temperature — 12 VDC Fan, DS18B20 Temperature Sensor</p><p>Raspberry Pi — Ribbon Cable</p><p><strong>General Purpose Board or PCB</strong></p><p>Now that you have your design, you’ll need to layout your interface board. You have two options for this: you can use a general purpose board with wired connections (RadioShack Universal Board) or design a printed circuit board (KiCad). A general purpose board might be easier to start with as you can easily change things around, but a PCB tends to be neater when it comes to wiring and layout.</p><p>Rather than soldering the devices directly to the board, you can use sockets and headers to make replacing devices in the future easier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uXcFePh-zAtpSCC0PhaiKA.png" /></figure><p><strong>Finished Hardware</strong></p><p>You can connect your Raspberry Pi and your boat inputs to the interface board. You should check and recheck your wiring because it would be very easy to blow your Raspberry Pi with an incorrect connection. Thankfully, Raspberry Pi’s aren’t too expensive but it’s definitely a mistake you don’t want to make so be careful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z6OJASnJylHsNqOyH5GeIQ.png" /><figcaption>Boat Inputs connected to Interface Board connected to Raspberry Pi 3</figcaption></figure><h3>Python Code</h3><p>You can view the entire python code below and at this <a href="https://gist.github.com/3899736901be1c94841e3056b55b1f9e.git">link</a>. What this code does is read the inputs from your boat and send that data to Initial State.</p><p>There is a single change that needs to be made within the code for you to be able to send data to your own dashboard. Line 122— Update with your access key from Initial State. You can change the bucket name and bucket key if you so choose.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/83a6ff79f2a40ade84fd5d16cfc93b70/href">https://medium.com/media/83a6ff79f2a40ade84fd5d16cfc93b70/href</a></iframe><h3>Monitoring Your Data</h3><p>Once everything is connected and your Pi is running the Python script, you should start receiving daily data updates on Initial State. When the data first arrives it will be automatically laid out for you but I recommend you take advantage of the customization options within Initial State to create a dashboard that is not only functional but one that looks good too.</p><p>You can add a <a href="https://support.initialstate.com/hc/en-us/articles/360031424331-Upload-Custom-Background-Image?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Boat%20Monitor%20-%20%5BFUS%5D%20-%20custom%20bg%20image">custom background image</a> of your boat or layout of your electronics. You can change the temperature tile to a thermometer and set <a href="https://support.initialstate.com/hc/en-us/articles/360002741552-Data-View-Type-Gauge?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Boat%20Monitor%20-%20%5BFUS%5D%20-%20gauge">color ranges</a> so you know if it is high or low immediately by the visual color representation. You can set any of your signals to a line graph to view historical trends of the data. You can add a map tile and enter the GPS coordinates for your boat’s location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xfPQuJIYfTOquSa7Qkbfcg.png" /><figcaption>Initial State Dashboard — Tiles</figcaption></figure><p>You can see a real-time summary of your data in your Tiles dashboard. The <a href="https://support.initialstate.com/hc/en-us/articles/360002856752-Introduction-to-Waves?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Boat%20Monitor%20-%20%5BFUS%5D%20-%20waves">Waves app</a> gives you a separate but important way to view the data. Waves is great for viewing historical trends and identifying anomalies in your data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7u79DJ_3WDrrVT29uIDUeA.png" /><figcaption>Initial State Dashboard — Waves</figcaption></figure><p>In addition to the data you can pull from your boat, you can add weather information to your dashboard. The <a href="https://medium.com/initial-state/build-a-weather-dashboard-that-sends-alerts-using-a-weather-data-api-deccdd56e2a9?source=friends_link&amp;sk=f1bbd770b2addd104fbf8da1dde541ff">Weatherstack Integration</a> in Initial State requires no code and is easily set up with just a few clicks. You just add your coordinates or zip code and you can get weather forecast data every 15 minutes or hourly. You can send this data into your boat dashboard to monitor weather conditions and storms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*CANYZ0sA03zeifFjYH-oZw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*Qao228e7GK7ItHI6W1WUug.jpeg" /><figcaption>Trigger sent via SMS. Mobile view of dashboard.</figcaption></figure><p>You’ll want to <a href="https://support.initialstate.com/hc/en-us/articles/360002992631-Getting-Started-with-Triggers-Step-By-Step-Test-?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Boat%20Monitor%20-%20%5BFUS%5D%20-%20triggers">set triggers</a> on your dashboard so you can be alerted immediately if data falls outside of the normal thresholds. You can receive an alert via email or SMS. To do this, go to your triggers tab in your bucket settings. Here you can select which signal you want to monitor, the operator (equal to, less than, greater than, etc.), and the threshold value. Choose the contact you want to be notified by (email or phone number). Click done and your trigger is set. You can add up to 20 of these alerts per dashboard.</p><p>You can create a desktop view and a <a href="https://support.initialstate.com/hc/en-us/articles/360003264151-Introduction-to-Mobile-Support?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20Boat%20Monitor%20-%20%5BFUS%5D%20-%20mobile">mobile view</a> of your dashboard. This allows you to have a perfectly laid out dashboard for both viewing options. Your desktop view could be more in depth and your mobile could be a snapshot view to allow you to see updates quickly.</p><p>With so many tools now available, DIY has become more accessible than ever. So get out there and build your own boat monitoring system.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d89f7d76a88d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/initial-state/how-to-monitor-your-boat-during-the-winter-months-d89f7d76a88d">How to Monitor Your Boat During the Winter Months</a> was originally published in <a href="https://medium.com/initial-state">Initial State</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Crawl Space Humidity Monitor with a Raspberry Pi]]></title>
            <link>https://medium.com/initial-state/how-to-build-a-crawl-space-humidity-monitor-with-a-raspberry-pi-669f2a632cf4?source=rss----cc2c6209cafb---4</link>
            <guid isPermaLink="false">https://medium.com/p/669f2a632cf4</guid>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[sensors]]></category>
            <dc:creator><![CDATA[Jamie Bailey]]></dc:creator>
            <pubDate>Mon, 13 Jul 2020 12:57:14 GMT</pubDate>
            <atom:updated>2020-10-12T14:32:31.693Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Raspberry Pi Crawl Space Humidity Monitor" src="https://cdn-images-1.medium.com/max/1024/1*uh5i4rqQu9_-PDydBnUT-w.jpeg" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-gD9M-6V8mY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D-gD9M-6V8mY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-gD9M-6V8mY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4876db24d06d8f0b06d61f8dfe08cc14/href">https://medium.com/media/4876db24d06d8f0b06d61f8dfe08cc14/href</a></iframe><h3>Introduction</h3><p>There isn’t a more important and less pleasant part of your home than the crawl space. Unless you enjoy dark, dirty, claustrophobic places, there is a good chance you rarely visit your crawl space. The health of your home is highly dependent on the health of your crawl space. Nothing wreaks havoc on your crawl space like excess moisture problems. Mold growth, wood rot, and insects thrive in dark, wet spaces. If you want to keep an eye on the health of your crawl space, you need to monitor its humidity levels.</p><p>This tutorial will show you how to <em>remotely</em> monitor your crawl space humidity from your mobile device and/or laptop. This will allow you to not only see the current humidity level but also see the historical data over time without having to frequently go down there. This tutorial will also show you how to set up trigger alarms to text/email you whenever your humidity exceeds a certain threshold.</p><h3>Background</h3><figure><img alt="Vented crawl space with vapor barrier" src="https://cdn-images-1.medium.com/max/1024/1*QxY9y-KTdya0IDct5PiQMQ.jpeg" /><figcaption>Vented crawl space with vapor barrier</figcaption></figure><h4>Crawl Space Types</h4><p>Like most new houses in Tennessee, my house has a vented crawl space. Several crawl space vents around the house let outside air circulate under the floor, which, in theory, helps dry out any condensation that may form. There is a crawl space vapor barrier installed which covers the entire floor. This barrier keeps the moisture in the soil from being absorbed by everything in the crawl space including the floor joists. If everything works like it should, my crawl space should stay dry and mold free.</p><p>Other types include encapsulated and conditioned crawl spaces. These types are sealed from the outside and may include mechanical dehumidifiers to pull moisture out of the air.</p><h4>Relative Humidity</h4><p>When we measure humidity, we are measuring relative humidity. Relative humidity is the amount of water vapor in the air relative to how much water vapor the air can hold. Relative humidity is expressed in %. This is different than absolute humidity, which is the actual amount of water vapor contained in the air. Absolute humidity is expressed as grams of moisture per cubic meter of air (g/m3).</p><p>Warm air can hold more water vapor than cold air. If warm air moves from the outside into a cooler crawl space, the relative humidity will increase ~2.2% for every 1 °F decrease in temperature. For example, if the temperature is 90 °F and 60% humidity outside and that air moves into a vented crawl space that is 70 °F, the relative humidity inside the crawl space (assuming no other influences) would be (90–70)*2.2 + 60% = 104%. If our crawl space reaches 100% humidity, condensation forms (what we don’t want).</p><p>Any analysis of humidity in my vented crawl space requires monitoring the temperature of my crawl space as well as the humidity and temperature outside. Otherwise, I will have no idea if there are any other influencers affecting humidity.</p><h3>The Hardware You Need</h3><ul><li>Power outlet or extension cord in your crawl space (I had an electrician put an outlet in for $100).</li><li>WiFi in your house.</li><li>Raspberry Pi (3 or 4) or Raspberry Pi Zero W(H). $35 or $10 respectively.</li><li>Micro SD card ($4).</li><li>Raspberry Pi power supply ($8).</li><li>BME280 temperature/humidity sensor (<a href="https://www.amazon.com/Onyehn-Temperature-Humidity-Barometric-Pressure/dp/B07KR24P6P/">$4.50</a>/ea).</li><li>Female to female jumper wires (<a href="https://www.amazon.com/GenBasic-Piece-Female-Jumper-Wires/dp/B01L5ULRUA/">$5</a>).</li></ul><p>I bought a Raspberry Pi Zero W kit for <a href="https://www.amazon.com/Vilros-Raspberry-Starter-Power-Premium/dp/B0748MPQT4/">$29</a> which also includes a case, a mini HDMI adapter, and a micro USB adapter. The Zero W requires you to solder the pin headers onto the board. If you can find a Pi Zero WH, the headers are pre-soldered. The Raspberry Pi 3 and 4 have pre-soldered pin headers. The BME280 linked above also requires you to solder a four-pin header. There are some versions of this sensor available that have the headers pre-soldered.</p><p>I have a wireless keyboard/mouse that I keep around for setting up each of my Raspberry Pis the first time. Once that Pi is set up, the keyboard/mouse is no longer needed. I use something like <a href="https://www.amazon.com/Upgraded-Rii-Wireless-Keyboard-Raspberry/dp/B00Z81U3YY/">this</a>.</p><p><em>*note: I experimented with multiple BME280 sensors as well as multiple DHT22 sensors. The BME280 sensors were, by far, the most consistent and accurate humidity sensors. The DHT22 humidity readings were all over the place from sensor to sensor.</em></p><h3>The Software You Need</h3><ul><li>The free <a href="https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/2">Raspbian operating system</a> for your Raspberry Pi.</li><li>A Python script (included in this tutorial).</li><li>An <a href="https://www.initialstate.com?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20crawl-space%20-%20%5BSU%5D">Initial State</a> account for data streaming and visualizations ($9.99/mo).</li></ul><p>This tutorial will utilize a paid web service, Initial State, for creating the dashboards, storing historical data, retrieving local weather data, and sending SMS/email alerts. All of these functions are fully hosted and available in a web app (hence the $9.99/mo). You can replace this part of the tutorial with another web service or build your own if the $9.99/mo is a no-go for you.</p><h3>Assembly</h3><figure><img alt="Raspberry Pi Zero wiring for a BME280 temperature and humidity sensor" src="https://cdn-images-1.medium.com/max/1024/1*UjpQeTsM2YKT-i9cVh4tTQ.png" /><figcaption>Raspberry Pi wiring for a BME280 temperature and humidity sensor</figcaption></figure><p>The BME280 sensor will have four pins you need to connect to your Raspberry Pi (same pinout for either a Pi Zero or Pi 3/4).</p><ul><li>BME280 VIN pin connects to Pi pin 1 (3.3V).</li><li>BME280 GND pin connects to Pi pin 6 (GND).</li><li>BME280 SCL pin connects to Pi pin 5 (SCL).</li><li>BME280 SDA pin connects to Pi pin 3 (SDA).</li></ul><h3>Software Setup</h3><p>You will need a monitor and keyboard to set up your Raspberry Pi the first time. Once it is set up, you won’t need either a monitor or a keyboard to run when deployed in your crawl space.</p><h4>Raspberry Pi Setup</h4><ul><li>You need to install the Raspbian operating system on your Pi. Follow the instructions at <a href="https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up">https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up</a>.</li><li>Connect your Pi to your WiFi network <a href="https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/6">https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/6</a>.</li><li>The BME280 sensor requires you to enable i2c on your Pi. At the Pi terminal type:</li></ul><pre>sudo raspi-config</pre><figure><img alt="sudo raspi-config" src="https://cdn-images-1.medium.com/max/1024/1*WWUIQ3lL1LTLaNbF201ptQ.png" /><figcaption>raspi-config</figcaption></figure><p>Select 5 Interfacing Options, P5 I2C, and select &lt;YES&gt; to enable i2c. Select &lt;Finish&gt; to save and exit.</p><ul><li>Let’s test out the connection to the sensor. On your Pi,</li></ul><pre>sudo i2cdetect -y 1</pre><p>You should see something like the following:</p><figure><img alt="BME280 detected on a Pi at address 0x76" src="https://cdn-images-1.medium.com/max/1024/1*N5Uqrmmn2SAJ0G_it_AH4A.png" /><figcaption>BME280 detected on a Pi at address 0x76</figcaption></figure><p>This should show your sensor at address 0x76 (possibly address 0x77). If you don’t see either, check your wiring, make sure i2c is enabled in raspi-config, and reboot.</p><ul><li>(optional) If you want to remotely configure your Pi (which you do because you don’t want to have to go down to your crawl space unnecessarily), enable SSH on your Pi: <br>sudo raspi-config, Select 5 Interfacing Options, P2 SSH, and &lt;YES&gt; to enable SSH. &lt;Finish&gt; to save and exit.</li><li>(optional) If you want to test out remotely configuring your Pi, at the Pi terminal type:</li></ul><pre>hostname -I</pre><p>This will return the IP address of your Pi. At your <em>laptop</em> terminal, type:</p><pre>ssh pi@&lt;insert Pi ip address&gt;</pre><p>For example:</p><figure><img alt="SSH into your Pi from your laptop" src="https://cdn-images-1.medium.com/max/1024/1*OlKuKD-OX2IMwHibw05RTg.png" /><figcaption>SSH into your Pi from your laptop</figcaption></figure><p>Once you can successfully SSH into your Pi, you may want to make it boot directly to the console instead of loading the desktop UI. You can do this as follows:sudo raspi-config -&gt; 3 Boot Options-&gt; B1 Desktop / CLI-&gt; B2 Console Autologin-&gt; &lt;ok&gt;-&gt; exit.</p><h4>Python Setup</h4><ul><li>There are two Python modules you need to install, one to communicate with the BME280 sensor and one to send data to your Initial State account. On your Pi, run the commands:</li></ul><pre>sudo pip install RPi.bme280</pre><pre>sudo pip install ISStreamer</pre><h4>Initial State</h4><ul><li>Register for an account at <a href="https://api.init.st/auth/#/register/?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20crawl-space%20-%20%5BSU%5D">https://api.init.st/auth/#/register</a> .</li><li>This will start a 14-day free trial (no credit card required for the trial).</li></ul><h4>Python Script</h4><ul><li>The following script will read temperature and humidity from your BME280 and send the results to your Initial State account every ten minutes.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3796762f0cf8bc5aa5533cdcebd66bb8/href">https://medium.com/media/3796762f0cf8bc5aa5533cdcebd66bb8/href</a></iframe><ul><li>Place this script onto your Pi.</li><li>Your Initial State account access key has to be specified on line 10. Copy+paste this key from your Initial State account (<a href="https://support.initialstate.com/hc/en-us/articles/360002898512-Streamer-Concepts-Streaming-Access-Key">more info</a>).</li><li>If you want to change to metric units or change the number of minutes between sensor reads, modify lines 11 and 12.</li><li>If the i2c address was different than 0x76 in the Raspberry Pi setup section, change the value accordingly on line 17.</li><li>Kick off the script on your Pi to start streaming sensor data to your Initial State account:</li></ul><pre>python crawlspace.py</pre><h3>Building a Web Dashboard</h3><figure><img alt="Crawl space humidity monitor dashboard" src="https://cdn-images-1.medium.com/max/1024/1*YiD-iJ6OzhnpDA1oNyBCZw.jpeg" /><figcaption>Crawl space humidity monitor dashboard — live version at <a href="https://go.init.st/fcpp6ll"><strong>https://go.init.st/fcpp6ll</strong></a></figcaption></figure><p>Go to your Initial State account (<a href="https://iot.app.initialstate.com/?utm_source=medium&amp;utm_medium=article&amp;utm_campaign=%5BS%5D%20-%20%5BTut%5D%20-%20crawl-space%20-%20%5BSU%5D">https://iot.app.initialstate.com</a>), click on the “💦 Crawl Space” bucket name on your bucket shelf, and view the data coming into your dashboard. You can customize your dashboard by adding and sizing line graphs, gauges, statistics, etc. (<a href="https://support.initialstate.com/hc/en-us/sections/360000629511-Tiles">more info</a>).</p><h4>Bringing in Local Weather</h4><p>There is no way to do proper analysis of humidity in a vented crawl space without also logging the outside temperature/humidity. Luckily, Initial State has a nice integration with Weatherstack which lets you bring local weather data into your dashboard. You can add your local weather data to your existing data bucket by following the steps outlined in <a href="https://support.initialstate.com/hc/en-us/articles/360036580532-Weatherstack-Integration">this support article</a>. A more detailed tutorial can be found in this <a href="https://medium.com/initial-state/build-a-weather-dashboard-that-sends-alerts-using-a-weather-data-api-deccdd56e2a9">Medium article</a>.</p><p>Instead of bringing in every available weather signal from Weatherstack, I recommend selecting only the most relevant data such as curr_weather_desc, curr_temp, and curr_humidity. Too many unncessary data streams make it hard to create an effective dashboard.</p><h4>Dashboard Templates</h4><figure><img alt="Crawl space humidity mobile dashboard" src="https://cdn-images-1.medium.com/max/1024/1*RWjSk22dD6Js0W4cmfUfyA.jpeg" /><figcaption>Crawl space humidity mobile dashboard — live version at <a href="https://go.init.st/k8qw5fd"><strong>https://go.init.st/ol4pfy0</strong></a></figcaption></figure><p>If you want a good starting point for a dashboard layout, you can import one of the two dashboards designed for this tutorial by following the instructions in <a href="https://support.initialstate.com/hc/en-us/articles/360032365591-Importing-a-Dashboard-Design-Template">this support article</a>. All you need are the share URLs for the dashboards above (<a href="https://go.init.st/fcpp6ll">https://go.init.st/fcpp6ll</a> for the desktop version and <a href="https://go.init.st/k8qw5fd">https://go.init.st/ol4pfy0</a> for the mobile version).</p><p>You can create a second view of the same data by following <a href="https://support.initialstate.com/hc/en-us/articles/360002798032-Create-Multiple-Dashboards-from-One-Data-Bucket">this support article</a>. This will allow you to have both a desktop and a mobile version of your data.</p><h4>Pi IP Address</h4><p>If you would like to add the IP address of your Pi to your dashboard (always handy in case you need to SSH into it and don’t remember the IP address or DHCP changes it), use the following modified Python script (make the same modifications to ACCESS_KEY, METRIC_UNITS, etc. as before).</p><p>You will need to install the psutil Python module before using this script:</p><pre>sudo pip install psutil</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec48d5189a68c43a827625728301d2c0/href">https://medium.com/media/ec48d5189a68c43a827625728301d2c0/href</a></iframe><p>Lines 34–36 stream the current IP address to your dashboard with every read.</p><h4>Adding a SMS/Email Alert</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q9v4dPP0anFdpwEPXkIjRw.png" /></figure><p>If your humidity ever gets above a certain threshold (e.g. 80%), you probably want to get a notification so you can investigate why. Follow the instructions at <a href="https://support.initialstate.com/hc/en-us/articles/360038034111-Trigger-Message-Templates">this support article</a> to set up a custom SMS and/or email trigger alert.</p><h3>Deploying Your Crawl Space Humidity Monitor</h3><figure><img alt="Deployed crawl space humidity monitor" src="https://cdn-images-1.medium.com/max/1024/1*QTXYjeEU3xkZ_nkqzFNQAg.jpeg" /><figcaption>Deployed crawl space humidity monitor</figcaption></figure><h4>Auto-Run on Boot</h4><p>Once everything looks like it is working, you are almost ready to take your Pi + sensor down to your crawl space and fire it up. To make our setup a bit more robust, we need to kick off our Python script every time our Pi boots. This way our humidity monitor will restart without any intervention when we get a restored power outage.</p><p>Adding a process that runs on boot is really easy. At the Pi terminal:</p><pre>crontab -e</pre><p>If this is the first time you have run crontab, it may ask you which text editor you want to use (e.g. nano). Add the following line to the bottom of the crontab text file then save and exit:</p><pre>@reboot python /home/pi/bme280/crawlspace.py &amp;</pre><p>You will need to specify the exact path of your script. In the example above, I created a directory called bme280 and put my Python script there.</p><h4>Hardware Deployment</h4><p>Turn off your Pi and take it down to your crawl space (no monitor, keyboard, or mouse is necessary). It is wise to hang your Pi from the floor joists instead of letting it touch the ground (to avoid any water that may get on the floor). I put a nail in one of the floor joists and draped the power cord over the nail. Turn it on and make sure data starts flowing into your dashboard.</p><h3>Conclusion (Analysis of My Crawl Space)</h3><p>I’ve had my crawl space humidity monitor running for about four weeks at the time of writing this tutorial. I installed this monitor in mid-June, right when the humidity went way up in Tennessee. My averages so far are as follows:</p><p>Crawl space temperature/humidity average: 68.6 °F / 83.2%.<br>Outside temperature/humidity average: 79.0 °F / 69.1%.</p><p>My crawl space averages 10.4° cooler in temperature and 14.1% higher in humidity. I would expect my vented crawl space to average ~92% humidity based on the outside temperature/humidity (using the relative humidity conversion of +2.2% humidity for every 1 °F decrease). This means that I do not have anything happening in my crawl space that is adding humidity. However, I am still uncomfortable with humidity readings that high as mold can grow whenever humidity reaches levels greater than 70% for prolong periods of time.</p><p>My plan is to collect more humidity data over the next few months before deciding if I should convert my vented crawl space into an encapsulated or conditioned crawl space.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=669f2a632cf4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/initial-state/how-to-build-a-crawl-space-humidity-monitor-with-a-raspberry-pi-669f2a632cf4">How to Build a Crawl Space Humidity Monitor with a Raspberry Pi</a> was originally published in <a href="https://medium.com/initial-state">Initial State</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Weather Dashboard that sends alerts using a Weather Data API]]></title>
            <link>https://medium.com/initial-state/build-a-weather-dashboard-that-sends-alerts-using-a-weather-data-api-deccdd56e2a9?source=rss----cc2c6209cafb---4</link>
            <guid isPermaLink="false">https://medium.com/p/deccdd56e2a9</guid>
            <dc:creator><![CDATA[Jeffrey Loucks]]></dc:creator>
            <pubDate>Thu, 18 Jun 2020 17:06:21 GMT</pubDate>
            <atom:updated>2020-06-18T19:04:26.512Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Build a Weather Dashboard that Sends Alerts Using a Weather Data API</strong></h3><figure><img alt="Weather Data API Weather Dashboard" src="https://cdn-images-1.medium.com/max/1024/1*XwC1OKFFjMQG7xD0fbrEIw.png" /></figure><p>The first question I ask in the morning is, “What’s the weather today?” Siri quickly responds with a human-esque retort and gives me the weather forecast data. My iPhone comes with a weather app that I can’t even erase, and being a Tornado survivor, I now have multiple ways to not only check the weather but also to get alerts.</p><p>For years, we’ve used weather data API’s with Initial State to monitor weather in real-time and create weather alerts. There seems to be a trend with these weather API’s of giving access to free weather data, and then closing down the free plan over time. We used to use Wunderground (no longer free) and then we used the Dark Sky API (acquired by Apple and no longer free). Now, we use Weatherstack! Along with changing where we get our weather information, we’ve made it much easier to access it using our new Data Integration Marketplace.</p><p>In this tutorial, I’ll show you just how easy it is to set up a real-time weather dashboard with the Weatherstack integration on Initial State.</p><h3>Step 1: Log in or Create an Account</h3><p>Creating an account at Initial State is easy and free. The individual tier gives you free and full access to the platform for 14-days. After that, it’s only $9.99/mo. If you’re an active student with a .edu or similar email address then it’s completely free, minus a few features such as triggers, shorter data retention and less API calls.</p><p>Simply go to initialstate.com, click the orange Get Started button and register/sign in from there.</p><figure><img alt="Weather Data API Integration on Initial State" src="https://cdn-images-1.medium.com/max/1024/0*_fhBjwobGk3J-vgr" /></figure><h3>Step 2: Using the Data Integration Marketplace</h3><p>Once you’ve logged into your Initial State account, you’ll see a screen like the one below. Before we dive right into setting up the integration, click the “view all integrations” click pointed out in this screenshot. I want to show off all the other integrations we have right now because once you learn how easy it is to set the Weatherstack dashboard up, you’ll be able to do it with all of these. You can create new dashboards for these integrations or add them into other relevant dashboards to make them more robust.</p><figure><img alt="IoT Platform for Streaming and Visualizing Data" src="https://cdn-images-1.medium.com/max/1024/0*BktbStPYrmBophdz" /></figure><p>At the time of writing this tutorial, we have 6 integrations on the marketplace:</p><figure><img alt="Weather Data API Integration" src="https://cdn-images-1.medium.com/max/1024/0*IIn6mtMNShMrDczl" /></figure><ol><li><strong>Initial State’s Bucket Watchdog</strong> is an integration that checks in on your dashboards to make sure they’re still sending data. Nothing worse than setting up your Arduino or Raspberry Pi to collect data only to find the connection was interrupted. This integration will make sure you know as soon as that happens!</li><li><a href="https://www.initialstate.com/coincap/"><strong>CoinCap</strong></a> let’s you stream cryptocurrency market price and volume data to an Initial State dashboard.</li><li><a href="https://www.initialstate.com/fmp/"><strong>FMP</strong></a> streams real-time stock prices.</li><li>The <a href="https://medium.com/initial-state/how-to-build-a-tesla-data-dashboard-with-the-tesla-api-4ebee4b9827c"><strong>Tesla</strong></a> Integration sends location, charge state and other Tesla data to Initial State.</li><li>The <strong>Twitch </strong>integration streams information from twitch channels</li><li>And finally, <a href="https://www.initialstate.com/weatherstack/"><strong>Weatherstack</strong></a><strong>.</strong> Weatherstack streams, well, the weather.</li></ol><p>You’ll notice little Initial State tokens that look like this.</p><figure><img alt="Data Integration Marketplace Token" src="https://cdn-images-1.medium.com/max/82/1*A9mz1AqkDzX_d-RCawFp4w.png" /></figure><p>Each Initial State account is given 10 tokens to use in the marketplace to use any way you please. Each integration costs a different amount of tokens to use based on how much data is streamed and how often the integration calls the API. Right now, users only have access to the 10 tokens they’re given, but eventually you will be able to purchase more.</p><h3>Step 3: Weatherstack</h3><p>Click the details button on the Weatherstack box on the integrations page.</p><p>This page will tell you all of the basic information about the integration and what’s required to use it. In this case, you’ll just need a zip code (or latitude &amp; longitude) of a location that you’ll want to monitor the weather for, and you’ll have to know what units you’ll want to see that data in (metric, scientific or US imperial).</p><figure><img alt="Weather Data API Integration" src="https://cdn-images-1.medium.com/max/1024/0*RCKABZTn8clHVrYI" /></figure><p>Click the Begin Setup button and you’ll see a modal pop up from the right side of your screen. There are just a few easy steps to take before we can start watching that weather data roll in:</p><figure><img alt="Weather Data API Integration" src="https://cdn-images-1.medium.com/max/1024/0*XEQJV_Ue5HvwMFnh" /></figure><ol><li><strong>Give your new dashboard a name.</strong> I named mine Nashville Weather.</li></ol><p><em>Pro tip: I like to use emoji’s in my dashboards names to give them a little more oomph. A quick way to pull up emojis on a Mac is Ctrl+Command+Space bar. For Windows hold the </em><strong><em>Windows button</em></strong><em> and either the period (.) or semicolon (;).</em></p><p>2.<strong> Type in your location.</strong> I use the Zip Code of the area I want to track, but you can also put Latitude and Longitude to be more specific. It’s easy to find the latitude and longitude of your area just by going to google maps, searching for a place and then copying the latitude &amp; longitude out of the browser and pasting it into the form. Only US, UK and Canada locations can be used at this time.</p><p>3.<strong> Choose your units.</strong> I chose US/Imperial because I lived in the United States.</p><p>4.<strong> Choose to create a new bucket or send your Weatherstack data to an existing bucket.</strong> For this tutorial, I’m going to create a new bucket/dashboard. However, let’s say you were already monitoring the temperature of the inside of your home, and wanted to add the weather to that dashboard then you could easily do so by clicking “Send data to an existing bucket” and then choosing the dashboard you want to send data to from the drop down.</p><p><strong>Create a new bucket</strong></p><figure><img alt="Send to data bucket" src="https://cdn-images-1.medium.com/max/528/1*6CZ0XvfeWRikZxrS1j4rWA.png" /></figure><p><strong>Send to existing bucket</strong></p><figure><img alt="Send to data bucket" src="https://cdn-images-1.medium.com/max/520/1*wVQBtmIOYwEddLSmlsQPjw.png" /></figure><p>5.<strong> Choose whether you want all the data that Weatherstack will send or if you want just specific weather data to send to your dashboard.</strong> I’m going to send it all because I want to be able to see all of the data trend over time, but if you’re sending to an existing bucket you may not want every piece of weather data crowding your existing data. Please note, if you choose to send all the data then it will load in a pre-made template that our team created for you. Otherwise, the tiles will not be organized in any specific order. Regardless, you can customize them to your needs and visual preference.</p><p><strong>All available data</strong></p><figure><img alt="Stream Weather Data API" src="https://cdn-images-1.medium.com/max/532/1*5By9fn4eBQwzWA3Bub1SCA.png" /></figure><p><strong>I want to select specific data</strong></p><p>If you check this option, then simply just go and check the box next to each piece of weather data that you want to stream to your dashboard like below.</p><figure><img alt="Stream Weather Data" src="https://cdn-images-1.medium.com/max/526/1*Br-zGEIC_AyObSGdERXfGw.png" /></figure><p>7. <strong>Choose how often you want your dashboard to update with weather conditions.</strong> You can choose between every 15 minutes or hour by hour. Keep in mind that sending data every 15 minutes costs an extra token compared to sending it every hour. So, if you’re wanting to use other integrations in the marketplace at the same time then you may want to just poll every hour. You can always stop sending data from the integration and start it again, or change the frequency at which you send data later. However, if you do stop it and start again then there will be gaps in your data. I chose every hour because I want to use this dashboard to send weather alerts, and measure data over time. So, I don’t need data to update every 15 minutes.</p><p><strong>8. Click Start Integration.</strong> Now you’re streaming data from Weatherstack! Click the “View in the IoT App” button to see the first data points roll in.</p><figure><img alt="Weather Dashboard Integration" src="https://cdn-images-1.medium.com/max/328/1*REWXmpI4IyM3xksnbUV3LA.png" /></figure><p>9.<strong> Customize your dashboard.</strong> If you’re streaming to a new bucket, we’ve set you up with a template to get you started. However, you should make it your own! Press the down arrow in the top center of your dashboard to bring down the timeline, click Edit Tiles, move some tiles around, resize them and change the background. Make the dashboard the way you want it so that it’s easy for you to ingest the data you want to collect.</p><p>You can also use other Weatherstack templates that we’ve <a href="https://support.initialstate.com/hc/en-us/articles/360036580532-Weatherstack-Integration">created for you here.</a></p><p>To add a little more context to your dashboard, you can also <a href="https://support.initialstate.com/hc/en-us/articles/360003332491-Add-a-Map-to-Your-Dashboard">add a map</a> that shows the location of where you’re monitoring the weather.</p><p>Your dashboard might look a little bare at first, but give it some time and it will fill up with beautiful historical weather data.</p><figure><img alt="Weather Data API Integration" src="https://cdn-images-1.medium.com/max/1024/1*3z1hl59F9p9fIPqb2Q3l7g.png" /></figure><h3>Step 4: Setting Weather Alerts</h3><p>As I mentioned in the introduction of this post, my wife and I recently survived a Tornado that tore through Nashville on March 3rd. Since then, I’ve learned that it’s important to set multiple alerts from different sources for severe weather. I follow a local meteorology group on Twitter, I pay for the StormWatch+ app, I have a NOAA certified weather radio and I’m also setting some alerts on my weather dashboard on Initial State. It might sound like overkill, but in my experience, having just one option to get alerts is not enough. When the Tornado hit our house, the iPhone alert didn’t wake us up and we were awakened by the sound of the storm hitting our home. We didn’t have much time to react. Now I have multiple ways to get alerts for different weather scenarios just in case I don’t hear one, or if one comes through a little late.</p><p>If you have a student account with Initial State, you won’t be able to do this step as triggers is only available on the Individual tier and above.</p><p>Here’s how you set up a weather alert on Initial State:</p><figure><img alt="Weather Data API Alerts" src="https://cdn-images-1.medium.com/max/1024/0*oh_bqoK_sfYKhREq" /></figure><ol><li><strong>Click “settings” under the dashboard</strong> that you want to set alerts on.</li><li><strong>Click Triggers</strong> in the top middle of the settings panel.</li><li><strong>Click “+ Create a new trigger.”</strong></li><li><strong>Enter the signal key that you want to monitor.</strong> You can get the stream key by going to the edit tile menu on your dashboard, clicking the tile you want to monitor and copying the text in the signal key box. For this trigger, I’ll monitor the forecasted weather. (Get signal key from edit tile screen)</li></ol><figure><img alt="Weather Data API Weather Alerts" src="https://cdn-images-1.medium.com/max/1024/0*jeF8CzClvLyRDl7A" /></figure><p>5. <strong>Change the operator from “=” to “match.”</strong> This is telling the app to look for the partial match of a string. So, it doesn’t have to be an exact match of exactly what the forecasted weather is.</p><p>6. <strong>Type whatever value you want to track in the forecast.</strong> I typed “rain” in value. Now the match operator will look for the word rain in the forecasted weather tile. So, if it says “moderate rain at times”, heavy rain, or “Rainn Wilson is listening to Purple Rain” it will set the trigger off. It just has to have the word rain in it. You can set it for any phrase that you’d like to track. I’m still monitoring the words Weatherstack uses for different forecasts so I can set up better and more frequent alerts over time. Fair warning here, I found that rain is in the forecast a lot. So, I get quite a few texts on this key value. You may want to watch the data over time and find a key value that is more specific to what you’re looking out for.</p><p>7. <strong>Enter your phone number.</strong> If you haven’t done this already it will need to send you a verification code to verify that you’re sending triggers to your phone and not someone else’s.</p><p>8. <strong>Type in what you want your message to say.</strong> I erased what was in there and put “Looks like it might rain. Go ahead and check the weather… Unless you want to get wet. Message from Weatherstack: {{triggeredValue}}” This way when I get a text, I’ll be able to go to the easiest and most trusted weather source I have near me at the time.</p><p>You can set multiple triggers on your data at the same time. You could also set a trigger for when the chance of thunder or snow is above a certain percentage, for current weather, or whatever else you think might be helpful. Keep in mind, you should always have multiple ways to get weather alerts. Just one way of receiving alerts is not enough.</p><p>Now, you’ve created a weather dashboard and set weather alerts that you can add into your weather alert mix! We’d love to see how you’ve customized your dashboards or how you used the integration marketplace. If you’ve made something that you want to show off then send a screenshot, or if you’re comfortable sharing your live dashboard, public share URL to us on Twitter using @initialstate. We’d love to see it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=deccdd56e2a9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/initial-state/build-a-weather-dashboard-that-sends-alerts-using-a-weather-data-api-deccdd56e2a9">Build a Weather Dashboard that sends alerts using a Weather Data API</a> was originally published in <a href="https://medium.com/initial-state">Initial State</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>