Prerequisites for Weather Station with Alerts

Simuli Virtual Lab

First, log in to your Simuli account and navigate to the Simuli Virtual Lab. Here we will create a new emulated instance of the STM32. Click on the Launch button under STM32 to get started.

This will open the configuration menu. First, provide a name for the project. Then, we will add the SHT2X Temperature and Humidity Sensor and the W5500 Ethernet Module by selecting them from the list of available components. Finally, review that the name for the project and the selected sensors are correct and click on the Launch button.

Once we have clicked on the Launch button, a new instance of the STM32 will be created. It can take a few minutes, so be patient.

Now that our instance is being created, let's move forward to create an Adafruit IO account and configure it.

Adafruit IO

Go to the Adafruit IO website, if you already have an account, you can directly log in and skip to the configuration part. If this is your first time at Adafruit IO, click on the Get Started for Free button at the top. This will take you to a signup page, fill all the details and click on the CREATE ACCOUNT button.

Once the account has been created, go back to the Adafruit IO website. Let's start by creating our feeds. Feeds act as our MQTT topics, where we can either publish our data or subscribe to receive the data. In this case, we will create 3 feeds, to publish temperature and humidity values and send alerts when the temperature crosses a threshold.

Click on Feeds, and then click on view all . This will open up a list of all the feeds currently set up for our account. Let's create our feeds.

Click on the New Feed button, this opens up a pop-up, let's name the first feed Alert . Finally, click on Create to create this new feed. Repeat the same process to create two more feeds called Temperature and Humidity.

Once the feeds have been created, our Adafruit IO setup is complete. We will now set up IFTTT.

IFTTT

Download the IFTTT app on your phone from the Play Store (for Android) or the App Store (for iOS devices). Once the app has been downloaded, create a new account or sign in using a third party service.

Once you have created your account or signed in, you will reach the welcome screen with the Create button. We are now ready to start integrating IFTTT with Adafruit IO.

IFTTT allows quick and easy integrations with a lot of different services. Now we will start creating our IFTTT applet which will be connected to Google Assistant and Adafruit IO. IFTTT acts as a bridge between Google Assistant (our Voice Assistant) and Adafruit IO.

Click on the Create button on the IFTTT welcome screen. This will take you to the new applet creation screen. Here, we have to define the functionality of this applet in an "If This, Then That" format, where the "If This" part acts as the trigger for the applet and the "Then That" part defines the action taken when the trigger is invoked. Click on the Add button next to "If This" to create the trigger for this applet.

Search for Adafruit in the list of services. A prompt will ask you to log in to your Adafruit account. Once logged in, provide the relevant permissions. Now we can choose the trigger action, select Monitor a feed on Adafruit IO. This will take us to a new screen where we can configure the trigger. Start by choosing the Alert feed from the dropdown menu, then select the relationship as equal to and finally keep the value to 1. Click on continue to save our Trigger.

Now we will configure the Action service. Click on the Add button next to "Then That". Now select the Notifications service. You will get two options, either to send a simple notification or to send a rich notification (with pictures and links). For this example, choose the Send a notification from the IFTTT app. Now we can define what the notification is going to say. Let's change it to say Temperature is greater than 40 degrees! . Now tap on Continue to finish configuring the Action service. Now we have set both the trigger and the action. Tap Continue, you will be taken to a review screen. Tap finish and the applet is ready.

In this example, we are sending a notification on the trigger. However, with IFTTT, you can send an SMS, an email, a message in Telegram or Slack among other things. Browse the available services when you are setting the action to see the full list.

Now let's program our STM32 to get the real-time temperature and Humidity readings and send an alert if the temperature crosses a Threshold.

Last updated