Build an IoT Thermometer with Adafruit IO WipperSnapper
2022-04-26 | By Maker.io Staff
License: See Original Project
A recent article investigated the all-new WipperSnapper firmware that lets you connect supported development boards to Adafruit IO easier and faster than ever before. The article also summarized a few of the essential features of Adafruit IO and how you can install the firmware on your development boards. However, the article didn’t discuss creating a cloud project that uses the WipperSnapper firmware. This article leads you through the steps involved in creating a new Adafruit IO project that makes use of WipperSnapper on an official Adafruit Feather HUZZAH 8266 development board.
This image shows the finished project assembled on a solderless breadboard.
About the Project
This finished project will act as a small connected indoor thermometer that measures the humidity and temperature in a room. The ESP8266-based development board communicates with the BME280 module via I2C, and it requests temperature and humidity data every 30 seconds. Then, the development board uploads the measured values to the Adafruit IO cloud, where the website displays them using pre-made widgets. In addition, the ESP8266 also turns on the red LED whenever the temperature surpasses a predefined threshold value. You’ll need to following components to build this project:
Product/Qty
- Adafruit Feather HUZZAH 8266 - 1
- Adafruit BME280 - 1
- 220 Ohm Resistor - 2
- Green LED - 1
- Red LED - 1
- Solderless Breadboard - 1
The Schematic Diagram
As mentioned, the sensor breakout board and the development board communicate via I2C. Therefore, you only need to connect two pins from ESP8266 to the BME280. Then, connect each LED anode to another digital pin on the development board.
A schematic diagram for this project.
Registering Components in Adafruit IO
As mentioned in the previous article, you don’t need to write any source code when using the WipperSnapper firmware with Adafruit IO. However, you still have to tell the development board what to do with the connected sensors and external components. To begin, navigate to the Adafruit IO website, click the WipperSnapper tab, and then make sure that the website detects your device and that it is online:
Navigate to the WipperSnapper page within Adafruit IO. Then verify that the device is online. Click the device to navigate to the device-specific page.
Select the board once you verify it is online. Doing so will bring you to the device-specific page within Adafruit IO. Here, you can register external components in your design and specify how you want them to behave. Start by clicking the new component button in the top-right corner of the website:
Use the highlighted button on the device-specific page to link the development board to external components.
Here, you can select the device you want to add. Note that WipperSnapper is still in development and that the service supports only a limited number of devices and components at this point. However, you can scroll down within the list and select the Adafruit BME280 breakout board:
The website displays all supported external components. Choose the BME280 breakout module.
The website will then ask you to configure that device. It also automatically detects whether the development board found the selected sensor board. For this project, you can deselect the altitude measurement and pressure sensor. However, make sure to enable temperature and humidity readouts and set the update frequency to thirty seconds. Then, click the blue button to create the component.
Enable the BME280’s temperate and humidity sensor. Then, click the highlighted button in the bottom-right corner.
Note that these steps only function if the development board is online and successfully detects the BME280 breakout module. Repeat the same steps for the red and green LEDs once you finish adding the sensor breakout module. Make sure to select the correct digital pins when you add the LEDs. The device page should then look like this:
The device-specific page should now display the humidity sensor readouts and the LED state.
At this point, you’ve already added a complex sensor breakout module and two LEDs to your design without writing a single line of code. Further, the device should begin uploading data to Adafruit IO as soon as you add the components, and you can see how the values update about twice a minute on the device’s page.
Creating a Dashboard for Displaying Sensor Values
Use the links along the top edge of the Adafruit IO website to navigate to the dashboards page. Then, click the blue button on the dashboards page to generate a new dashboard.
Adafruit IO dashboards help you visualize and organize data sent to the cloud by your devices. You can add pre-made widgets that let you view data that your device uploaded to the cloud. In addition, some widgets also allow you to interact with a device. To begin, add a new block to the newly generated dashboard by clicking the gear icon in the top-right corner of the page:
Navigate to the dashboards page within Adafruit IO. Then, click the highlighted button in the top-right corner of the website.
The website then lists the widgets you can add to this dashboard. Start by selecting the gauge widget, which displays a pop-up window for choosing a feed. A feed represents the data source for a widget. In this case, select the humidity value coming from the BME280 breakout board you set up earlier.
Select the humidity sensor value as the data feed for this widget. Make sure not to select multiple values.
Click the blue button in the bottom-right corner to proceed to the next step. Here you can change the display settings of a dashboard widget. You can change these options as you like.
You can change the widget settings as you like. You can also choose an icon by scrolling down.
For the humidity readout, it makes sense to set the minimum value to zero and the maximum to 100, as the sensor returns a percentage. In addition, I set the low warning level to ten and the high warning level to 60. The gauge will turn red if the reading goes below or beyond the warning levels. Repeat the same steps for the temperature gauge. The dashboard should then look similar to this:
The finished dashboard contains two-gauge widgets. I tested the sensor and the threshold values by holding the sensor over a cup of hot water.
Adding Custom Actions to Make the Project React to Events
So far, you’ve added components to your project, and you've linked the values of the sensor to two gauges on a custom dashboard. However, the project doesn’t do much besides displaying the values on a website. Besides this simple functionality, the two LEDs on the breadboard should allow users to quickly determine whether the temperature is too high without having to navigate to the website. The red LED should turn on when the temperature is at least 29 degrees Celsius. Otherwise, the green LED should be on.
You can define this custom behavior using actions within Adafruit IO. To begin, navigate to the actions page and click the “New Action” button. Doing so brings up a relatively large pop-up modal window.
Actions let you define the development board’s behavior without having to write any code.
Here, you can choose between reactive actions and scheduled actions. The Adafruit IO cloud automatically runs reactive actions whenever the development board uploads values that meet a certain requirement. Scheduled actions run periodically, for example, once every hour. Create a reactive action and choose the BME280 temperature sensor as the data source. Then, fill in the form so that the cloud publishes a message to the red LED whenever the temperature value exceeds 29. Repeat these steps for the other cases so that the website displays the following actions:
Add actions so that the green LED turns on when the temperature is less than or equal to 29 degrees. Then, define an action that turns the green LED off if the temperature exceeds 29 degrees Celsius. Analogously add actions for the red LED.
These example actions only use physical hardware present on the breadboard. However, you can also instruct the Adafruit IO cloud to send messages to external APIs or web services such as Twitter.
Summary
The Adafruit IO WipperSnapper firmware for selected development boards makes building IoT projects from scratch easier than ever before. You can effortlessly configure external components, beautiful dashboards, and custom actions once you install the firmware on a supported board and connect it to the Internet.
Start your WipperSnapper project by connecting the components to the development board. Then, make sure that the device appears on the Adafruit IO WipperSnapper page. From there, you can configure components and more complex devices ranging from simple push buttons and LEDs to elaborate sensor breakout modules. Currently, the WipperSnapper software only supports a few boards and modules. However, the developers regularly add new devices, features, and bug fixes.
Once you finish setting up the components, you can add a dashboard to visualize the data sent to the cloud by the development board. The website lets you place pre-made widgets on the dashboard and connect them to a data source, for example, the temperature readout of the BME280 breakout board. Next, you can configure the look and feel of the widgets on your custom dashboard.
Lastly, you can use actions to make the cloud application react to certain events, for example, the temperature exceeding a predetermined threshold value. Events can also run periodically, and they are not limited to the Adafruit IO cloud. You can, for example, make the cloud post tweets or send emails.
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum