# Digi-Key IoT Studio Mini Smart Home

## Overview

Danger: 

![](https://cdn-learn.adafruit.com/assets/assets/000/085/319/medium800/sensors_DigiKey_IoT_Home_Kit_open_ORIG_2019_12.jpg?1575491089)

You'll be automating an adorable paper maché house. **The small size of this build lets us explore wiring, user interaction, and firmware deployment without having to get a ladder out.**

After building this project, **you can re-purpose this project for your home or apartment**. We've specifically selected components and sensors which are common in real-world IoT projects. You can also go further with this project, adding sensors to monitor different rooms in your house.

# Digi-Key IoT Studio IDE

Unlike most other IoT platforms, [Digi-Key IoT Studio](https://www.digikey.com/en/resources/design-tools/dk-iot-studio) is&nbsp; **code-less** &nbsp;- all sensor interaction and storage is done automatically by the drag-and-drop IDE. You do not need to install toolchains, code editors or compile any code on your computer!&nbsp; **Digi-Key Studio runs in your web browser** , handles all aspects of developing an Internet-of-Things project, and even compiles your code&nbsp;_remotely_.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/243/medium640/sensors_DigiKey_IoT.png?1575307930)

# Digi-Key IoT Studio Mobile App

You'll build and program a mobile application to monitor and interact with your IoT Home over the Bluetooth Low Energy protocol. The Digi-Key IoT Studio Mobile App also acts as a bridge, sending your home's data to the _free_ Digi-Key IoT Studio Cloud for long-term storage.

![sensors_ezgif.com-resize_(4).gif](https://cdn-learn.adafruit.com/assets/assets/000/085/407/medium640thumb/sensors_ezgif.com-resize_%284%29.jpg?1575574195)

# Modular Smart Home Hub

You'll start by building a hub for your smart home. We designed a modular smart-home hub which uses the Feather form factor. If you want to add more sensors or actuators onto your smart home hub, just snap on a new FeatherWing!

![sensors_smart_home_hub_bb.png](https://cdn-learn.adafruit.com/assets/assets/000/085/252/medium640/sensors_smart_home_hub_bb.png?1575318814)

## Parts
 **This tutorial uses the ESP32 Feather as the microcontroller** brains, **it can use both secure WiFi and Bluetooth LE as transports**.

### Assembled Adafruit HUZZAH32 – ESP32 Feather Board

[Assembled Adafruit HUZZAH32 – ESP32 Feather Board](https://www.adafruit.com/product/3619)
Aww yeah, it's the Feather you have been waiting for, and now with **stacking headers**! The **HUZZAH32** is our ESP32-based Feather, made with the official WROOM32 module. We packed everything you love about Feathers: built in USB-to-Serial converter, automatic...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3619)
[Related Guides to the Product](https://learn.adafruit.com/products/3619/guides)
![Angled shot of an Assembled Adafruit HUZZAH32 – ESP32 Feather Board - with Stacking Headers](https://cdn-shop.adafruit.com/640x480/3619-00.jpg)

To build the smart home's hub, you'll use a Quad 2x2 FeatherWing Kit. This kit contains four identical sets of headers for Feathers/FeatherWings and two prototyping areas.

### Adafruit Quad 2x2 FeatherWing Kit with Headers

[Adafruit Quad 2x2 FeatherWing Kit with Headers](https://www.adafruit.com/product/4253)
This is the **FeatherWing Quad 2x2** - a prototyping add-on and more for all Feather boards. This is similar to our [FeatherWing Proto](https://www.adafruit.com/products/2884) except there are four! The magic of the Quad comes when you want to connect your Feather to...

In Stock
[Buy Now](https://www.adafruit.com/product/4253)
[Related Guides to the Product](https://learn.adafruit.com/products/4253/guides)
![Angled shot of a Adafruit Quad 2x2 FeatherWing Kit with Headers installed. ](https://cdn-shop.adafruit.com/640x480/4253-02.jpg)

For inputs, you'll use the **Analog Devices Featherwing to obtain precision temperature readings** and the **Bosch BME680 to obtain humidity, barometric pressure, and air quality**.&nbsp;

### Adafruit ADXL343 + ADT7410 Sensor FeatherWing

[Adafruit ADXL343 + ADT7410 Sensor FeatherWing](https://www.adafruit.com/product/4147)
Upgrade any Feather board with motion and precision temperature sensing, with this all-in-one sensing FeatherWing. It sports two fantastic sensors from Analog Devices: an ADXL343 triple-axis accelerometer and an ADT7410 precision temperature sensor.

Both sensors are connected over the...

In Stock
[Buy Now](https://www.adafruit.com/product/4147)
[Related Guides to the Product](https://learn.adafruit.com/products/4147/guides)
![Top-down view of a red rectangular sensor.](https://cdn-shop.adafruit.com/640x480/4147-08.jpg)

### Part: Adafruit BME680
quantity: 1
Adafruit BME680 - Temperature, Humidity, Pressure and Gas Sensor
[Adafruit BME680](https://www.adafruit.com/product/3660)

We’ll add **a magnetic door sensor to detect when someone opens a door or window&nbsp;** and add **a**  **buzzer** to make a a loud 2KHz _BEEEEEEEEEP_ when someone opens the door.

### Part: Door Sensor
quantity: 1
Magnetic contact switch (door sensor)
[Door Sensor](https://www.adafruit.com/product/375)

### Part: Buzzer
quantity: 1
Buzzer 5V - Breadboard friendly
[Buzzer](https://www.adafruit.com/product/1536)

For outputs you'll use a **Non-Latching Mini Relay FeatherWing to control a DC motor** &nbsp;- that’s our way of simulating an HVAC unit that turns on when it gets too hot or too cold.

You'll also connect some LED lights to a GPIO pin on the HUZZAH32, so **you can turn on or off the lights from the DK IoT Mobile App** , or when someone opens the door.

### Part: Mini Relay FeatherWing
quantity: 1
Adafruit Non-Latching Mini Relay FeatherWing
[Mini Relay FeatherWing](https://www.adafruit.com/product/2895)

### Part: LED Sequin Pack
quantity: 1
Adafruit LED Sequins - Ruby Red - Pack of 5
[LED Sequin Pack](https://www.adafruit.com/product/1755)

### Part: Spindle Motor (for fan)
quantity: 1
CD DVD Spindle Motor
[Spindle Motor (for fan)](https://www.adafruit.com/product/3882)

### Part: Trifoil Fan
quantity: 1
3-Bladed Trifoil Propeller Fan for DC Motor
[Trifoil Fan](https://www.adafruit.com/product/3896)

You'll need a few JST-PH cables for this build. These cables will allow you to easily remove sensors connected to the IoT Home Hub from the enclosure with a nice _click._

### Part: JST-PH Extension Cable
quantity: 3
JST-PH Battery Extension Cable - 500mm
[JST-PH Extension Cable](https://www.adafruit.com/product/1131)

# Tools and Materials

You also may want to pick up the following materials and tools to complete this project.

### Part: USB Cable
quantity: 1
USB cable - USB A to Micro-B - 3 foot long
[USB Cable](https://www.adafruit.com/product/592)

### Part: Heat Shrink Pack, Assorted Diameters
quantity: 1
Multi-Colored Heat Shrink Pack - 3/32" + 1/8" + 3/16" Diameters
[Heat Shrink Pack, Assorted Diameters](https://www.adafruit.com/product/1649)

### Part: 22AWG Hook-up wire
quantity: 1
Hook-up Wire Spool Set - 22AWG Stranded-Core - 6 x 25ft
[22AWG Hook-up wire](https://www.adafruit.com/product/3111)

### Part: Wire Cutter/Strippers
quantity: 1
Hakko Professional Quality 20-30 AWG Wire Strippers
[Wire Cutter/Strippers](https://www.adafruit.com/product/527)

### Part: Solder
quantity: 1
Mini Solder spool - 60/40 lead rosin-core solder 0.031" diameter - 100g
[Solder](https://www.adafruit.com/product/145)

### Part: Soldering Station
quantity: 1
Hakko FX-888D
[Soldering Station](https://www.adafruit.com/product/1204)

### Part: Craft Knife
quantity: 1
Slice Craft Knife with Ceramic Blade
[Craft Knife](https://www.adafruit.com/product/4306)

# Digi-Key IoT Studio Mini Smart Home

## Reviewing the Internet of Things

Over the videos, we have built up our knowledge, starting from the very lowest levels.

## Transports

We started out with **Transports** where we analyzed the different ways to move bits of data around.

We talked about **small-hop transports** like [Bluetooth Classic and Low Energy](https://learn.adafruit.com/alltheiot-transports/bluetooth-btle), [ZigBee](https://learn.adafruit.com/alltheiot-transports/zigbee-z-wave#zigbee-7-5) and [Z-Wave](https://learn.adafruit.com/alltheiot-transports/zigbee-z-wave#z-wave-7-12), and their use in small scale area networks, such as within a home.

We also covered **longer range transports** like [WiFi](https://learn.adafruit.com/alltheiot-transports/wifi), [SigFox](https://learn.adafruit.com/alltheiot-transports/lora-sigfox#sigfox-8-13) and [LoRa](https://learn.adafruit.com/alltheiot-transports/lora-sigfox#low-power-wide-area-networks-lpwan-8-1) that can cover a building.

Finally, [**long-distance** protocols like Cellular or satellite](https://learn.adafruit.com/alltheiot-transports/lora-sigfox#low-power-wide-area-networks-lpwan-8-1) can connect you anywhere in the world.

**Each transport has different power needs, and bandwidth capabilities**. Some are handy in that they connect directly to the Internet. Some need gateways to access the Internet, which can add cost and complexity. **Transports directly affect your bill of materials and chipset selections** , and&nbsp; **it's very hard to adapt a product to use a new or different transport, and transports don’t have a ton of overlap in their capabilities, so that’s why it’s the first thing to pick**.

![sensors_TRANSPORTS.png](https://cdn-learn.adafruit.com/assets/assets/000/084/882/medium640/sensors_TRANSPORTS.png?1574702938)

## Protocols

Next,&nbsp;[we dove into&nbsp; **Protocols, which is how we program the Transport** &nbsp;we’ve already decided on](https://learn.adafruit.com/alltheiot-protocols). This episode was a super-deep exploration of different transport protocols like&nbsp;[HTTP](https://learn.adafruit.com/alltheiot-protocols/http),&nbsp;[MQTT](https://learn.adafruit.com/alltheiot-protocols/mqtt),&nbsp;[CoAP](https://learn.adafruit.com/alltheiot-protocols/coap)&nbsp;as well as encoding methods such as&nbsp;[XML](https://learn.adafruit.com/alltheiot-protocols/xml),&nbsp;[JSON](https://learn.adafruit.com/alltheiot-protocols/adafruit2-json)&nbsp;and base64 raw data.

**Which one you use depends on your transport speed, bandwidth capabilities, and data responsiveness needs** &nbsp;-&nbsp;[HTTP gives you a direct connection to Internet services, but with a heavy price in data usage](https://learn.adafruit.com/alltheiot-protocols/http).&nbsp;[MQTT is light and nimble, with little overhead data-wise, but requires a gateway to get you the data you want to the greater internet](https://learn.adafruit.com/alltheiot-protocols/mqtt). Usually there’s a little more flexibility in what Protocols and encoding methods you get to use, and&nbsp; **a good decision here can save you money and support pain late** r.

![sensors_adafruit_02.png](https://cdn-learn.adafruit.com/assets/assets/000/084/877/medium640/sensors_adafruit_02.png?1574701330)

## Services

Once we sorted out our hardware transport and our firmware protocol, we moved up the stack to the software Services. Just like protocols encode the data that moves over the lowest-level protocols,&nbsp; **services package up and direct that encoded data.** &nbsp;**Services can also&nbsp;[store data for later analysis](https://learn.adafruit.com/all-the-internet-of-things-episode-three-services/storing-and-processing-data), or&nbsp;[provide meta-services](https://learn.adafruit.com/all-the-internet-of-things-episode-three-services/talking-to-the-internet)**[&nbsp;like notifying you by text-message](https://learn.adafruit.com/all-the-internet-of-things-episode-three-services/talking-to-the-internet)&nbsp;when no data has been reported for 24 hours. You could roll your own, but it’s a huge effort and there’s easily a hundred services available for any sort of IoT usage.

We covered some of the most popular ones, from&nbsp;[Plotly](https://learn.adafruit.com/all-the-internet-of-things-episode-three-services/analytics-and-data-visualization#plotly-9-4)&nbsp;to&nbsp;[Carriots](https://learn.adafruit.com/all-the-internet-of-things-episode-three-services/prototype-friendly-iot-infrastructure#carriots-10-4),&nbsp;[Particle](https://learn.adafruit.com/all-the-internet-of-things-episode-three-services/end-to-end-solutions#particle-dot-io-11-2)&nbsp;to&nbsp;[AWS](https://learn.adafruit.com/all-the-internet-of-things-episode-three-services/large-scale-infrastructure-as-a-service). Some services are prototyper-friendly, or are designed with scientists in mind, others are designed for enterprise-level deployments.&nbsp;[We went through examples of using each service so you can find the right match for the complexity of your product](https://learn.adafruit.com/all-the-internet-of-things-episode-three-services/service-providers).

![sensors_Screen_Shot_2019-04-09_at_4.39.40_PM.png](https://cdn-learn.adafruit.com/assets/assets/000/084/878/medium640/sensors_Screen_Shot_2019-04-09_at_4.39.40_PM.png?1574701551)

## Adafruit IO

After touring all the different services available,&nbsp;[we took a deep dive into our own IoT service,&nbsp;](https://learn.adafruit.com/all-the-internet-of-things-episode-four-adafruit-io)[**Adafruit IO**](https://learn.adafruit.com/all-the-internet-of-things-episode-four-adafruit-io). While we focused on just one service, there’s a lot of similarities between Adafruit IO and other services, so&nbsp; **even if you end up with a different IoT provider, it's beneficial to see how the pieces fit together**.

This was also the first video where we provided code and schematics to build a complete project for temperature logging.&nbsp;[We used WiFi as our transport](https://learn.adafruit.com/all-the-internet-of-things-episode-four-adafruit-io/what-hardware-or-transport-to-use), since its the most popular transport for Internet connectivity. The projects were shown with both Arduino/C microcontroller programming on a&nbsp;[Feather ESP8266](https://www.adafruit.com/product/2821)&nbsp;and in Python on a&nbsp;[Raspberry Pi single board computer](https://www.adafruit.com/product/4295).&nbsp;[The Arduino code utilized MQTT as a protocol,](https://learn.adafruit.com/all-the-internet-of-things-episode-four-adafruit-io/sending-data-to-your-thing#microcontroller-plus-arduino-example-6-9)&nbsp;and&nbsp;[the Raspberry Pi used REST](https://learn.adafruit.com/all-the-internet-of-things-episode-four-adafruit-io/sending-data-to-your-thing#linux-plus-python-example-6-3), showing&nbsp; **you can get similar results with both low-power/low-level microcontrollers and higher-power/high-level microcomputers**.

Together, we went through each step of [signing up for an account](https://learn.adafruit.com/all-the-internet-of-things-episode-four-adafruit-io/how-adafruit-io-works#accounts-and-the-adafruit-io-key-4-4),&nbsp;[making a new feed](https://learn.adafruit.com/all-the-internet-of-things-episode-four-adafruit-io/creating-a-new-feed), creating a&nbsp;[dashboard](https://learn.adafruit.com/all-the-internet-of-things-episode-four-adafruit-io/adafruit-io-front-end-dashboards), and plotting output data. Then, we explored extensions like&nbsp;[webhooks](https://learn.adafruit.com/all-the-internet-of-things-episode-four-adafruit-io/webhooks),&nbsp;[triggers](https://learn.adafruit.com/all-the-internet-of-things-episode-four-adafruit-io/triggers), and&nbsp;[integrations](https://learn.adafruit.com/all-the-internet-of-things-episode-four-adafruit-io/services).

![sensors_Screen_Shot_2019-02-22_at_12.21.48_PM.png](https://cdn-learn.adafruit.com/assets/assets/000/084/880/medium640/sensors_Screen_Shot_2019-02-22_at_12.21.48_PM.png?1574701791)

## Security

After building our first project and connecting it to Adafruit IO, it was time to cover&nbsp;[**Security**](https://learn.adafruit.com/all-the-internet-of-things-episode-five-the-s-in-iot-is-for-security/)[, a wide-ranging but important topic that has thankfully gotten more attention in recent years](https://learn.adafruit.com/all-the-internet-of-things-episode-five-the-s-in-iot-is-for-security/). Security practices are never-ending in complexity, and even as we write, new IoT security alerts and warnings are being published. **Instead of looking at specific exploits or attacks, [we categorized different ways that you can protect and harden your attack surface](https://learn.adafruit.com/all-the-internet-of-things-episode-five-the-s-in-iot-is-for-security/types-of-attacks-how-to-protect-yourself)**. Some of these[&nbsp;](https://learn.adafruit.com/all-the-internet-of-things-episode-five-the-s-in-iot-is-for-security/ways-to-prevent-attacks)techniques are super simple, like having unique, un-guessable passwords. Some are more advanced, like requiring bi-directional TLS certificate checks and hardened crypto-storage.

Either way, [following the checklist we provided in the video will do a lot to protect your product, data and customers from prying eyes](https://learn.adafruit.com/all-the-internet-of-things-episode-five-the-s-in-iot-is-for-security/ways-to-prevent-attacks).

![sensors_adafruit_iot_intro_Security_mov.png](https://cdn-learn.adafruit.com/assets/assets/000/084/881/medium640/sensors_adafruit_iot_intro_Security_mov.png?1574702492)

Finally, we’ve reached this final video - where we will explore using **Digi-Key IoT Studio** , an all-in-one solution for creating a complete IoT prototype or project.

# Digi-Key IoT Studio Mini Smart Home

## What is Digi-Key IoT Studio?

# Developing IoT Projects, Visually

Unlike most other IoT platforms, [Digi-Key IoT Studio](https://www.digikey.com/en/resources/design-tools/dk-iot-studio) is **code-less** &nbsp;- all sensor interaction and storage is done automatically by the drag-and-drop IDE. You do not need to install toolchains, code editors or compile any code on your computer!&nbsp; **Digi-Key Studio runs in your web browser** , handles all aspects of developing an Internet-of-Things project, and even compiles your code&nbsp;_remotely_.

IoT projects involve programming firmware into a device, sending data from a device to "the cloud" and then interacting with the data and device using a website or application. **Digi-Key IoT Studio comprises of three workspaces which simplify development:**

- **Embedded** W **orkspace** to build logic which runs on your device.
- **Application** &nbsp; **Workspace** to design, build, and program an application for your device.
- **Cloud Workspace** to construct flows for sending data to the&nbsp;_free_ DK IoT Studio Cloud or Amazon Web Service.

![sensors_DigiKey_IoT_App_View.png](https://cdn-learn.adafruit.com/assets/assets/000/085/248/medium640/sensors_DigiKey_IoT_App_View.png?1575309285)

![sensors_DigiKey_IoT_Cloud.png](https://cdn-learn.adafruit.com/assets/assets/000/085/249/medium640/sensors_DigiKey_IoT_Cloud.png?1575309302)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/887/medium640/sensors_DigiKey_IoT.png?1574707316)

This high-level integration is possible because IoT Studio has&nbsp;[built in support for a range of transport boards, and sensors](https://www.digikey.com/en/resources/design-tools/dk-iot-components). Note that not&nbsp;_all_&nbsp;boards and devices are supported - lucky for us, there’s plenty of Adafruit products supported, including our series favorites:&nbsp;[the ESP32 Feather](https://www.adafruit.com/product/3405)&nbsp;and&nbsp;[the Analog Devices FeatherWing](https://www.adafruit.com/product/4147).

However, instead of just a simple temperature sensor data logger, **we’ll make a complete home automation system that you can follow along by picking up our IoT Studio Kit**.

![sensors_dk_components.png](https://cdn-learn.adafruit.com/assets/assets/000/084/890/medium640/sensors_dk_components.png?1574707378)

# Digi-Key IoT Studio Mini Smart Home

## Wiring

Danger: 

# BME680 Wiring

You'll be soldering and wiring the BME680 directly on the prototyping grid on the bottom right side of the Quad 2x2 FeatherWing.

**Make the following connections** between the FeatherWing's prototyping grid and the BME680:

- **FeatherWing 3V** &nbsp;to&nbsp; **sensor VIN**
- **FeatherWing GND** &nbsp;to&nbsp; **sensor GND**
- **FeatherWing SCL** &nbsp;to&nbsp; **sensor SCK**
- **FeatherWing SDA** &nbsp;to&nbsp; **sensor SDI**

![sensors_4253-04.png](https://cdn-learn.adafruit.com/assets/assets/000/085/298/medium640/sensors_4253-04.png?1575481632)

![sensors_bme_wing.png](https://cdn-learn.adafruit.com/assets/assets/000/085/299/medium640/sensors_bme_wing.png?1575481703)

# Adding a Buzzer to the Quad FeatherWing

There's another prototyping grid on the bottom left of the Quad 2x2 FeatherWing. You will be adding the buzzer to this grid.

Place the buzzer on the prototyping grid. **Make sure the buzzer's negative (short) lead is placed on the ground rail**. Also, ensure the stacking headers will be able to fit besides the buzzer.

Solder the **buzzer's negative (short) lead** to the **ground rail.**

Solder a wire between **GPIO Pin 12** and the **positive (long) lead** from the buzzer.&nbsp;

![sensors_4253-04.png](https://cdn-learn.adafruit.com/assets/assets/000/085/295/medium640/sensors_4253-04.png?1575481004)

![sensors_IMG_1184.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/296/medium640/sensors_IMG_1184.jpg?1575481525)

![sensors_piezo_wing_bb.png](https://cdn-learn.adafruit.com/assets/assets/000/085/297/medium640/sensors_piezo_wing_bb.png?1575481551)

# **Mini Relay FeatherWing Wiring**

**Solder the 3-Pin terminal block** to the&nbsp;the Non-Latching Mini Relay FeatherWing.

Solder a wire between the **Signal pin** and header **pin 33**.

Then, **solder a red wire to the 3V header** on the Non-Latching Mini Relay FeatherWing. Connect this wire to the **NC pin** on the 3-pin terminal.

![sensors_relay_wing.png](https://cdn-learn.adafruit.com/assets/assets/000/085/256/medium640/sensors_relay_wing.png?1575319754)

# Attaching Female JST Connectors to Quad FeatherWing
You'll use female JST connectors to connect the IoT Hub's base to the fan, LEDs, and door sensor.&nbsp;&nbsp;

Start by **cutting a JST-PH cable in two**. Make sure there's an even length of cable between both connectors.

Then, strip off **5mm** from the red and black cables.&nbsp;

You may want to tin ends of the cables with a bit of solder at this point.

![sensors_ezgif.com-video-to-gif_(6).gif](https://cdn-learn.adafruit.com/assets/assets/000/085/303/medium640thumb/sensors_ezgif.com-video-to-gif_%286%29.jpg?1575482759)

![sensors_ezgif.com-optimize_(4).gif](https://cdn-learn.adafruit.com/assets/assets/000/085/306/medium640thumb/sensors_ezgif.com-optimize_%284%29.jpg?1575483105)

On the top left side of the Quad FeatherWing, make the following connections between the JST-PH connector and the header pins on the FeatherWing:

- **JST-PH Red** to **FeatherWing**  **GPIO 15**
- **JST-PH Black** to **FeatherWing GND**

![sensors_ezgif.com-video-to-gif_(7).gif](https://cdn-learn.adafruit.com/assets/assets/000/085/309/medium640thumb/sensors_ezgif.com-video-to-gif_%287%29.jpg?1575483598)

Just like before, cut and strip another JST-PH connector.

On the top right side of the Quad FeatherWing, make the following connections between the JST-PH connector and the header pins on the FeatherWing:

- **JST-PH Red** &nbsp;to&nbsp; **FeatherWing** &nbsp; **GPIO 12**
- **JST-PH Black** &nbsp;to&nbsp; **FeatherWing GND**

![sensors_ezgif.com-optimize_(5).gif](https://cdn-learn.adafruit.com/assets/assets/000/085/314/medium640thumb/sensors_ezgif.com-optimize_%285%29.jpg?1575483695)

 **Solder all four sets of Feather headers to the Quad FeatherWing.**

Before placing the Feather Huzzah32 and FeatherWings on the Quad FeatherWing, make sure that all the female JST connectors are routed through the middle and out the top of the Quad FeatherWing.

You may want to use tape to secure the cables to the FeatherWing's PCB.

Then, **connect both FeatherWings and the Feather Huzzah32 to the Quad FeatherWing.**

You've successfully built the IoT Home's Hub! Let's move on to building the rest of the IoT Home.

![sensors_IMG_4944.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/300/medium640/sensors_IMG_4944.jpg?1575481984)

![sensors_IMG_7258.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/301/medium640/sensors_IMG_7258.jpg?1575481993)

![sensors_IMG_7741.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/302/medium640/sensors_IMG_7741.jpg?1575482008)

# Digi-Key IoT Studio Mini Smart Home

## Assembly

Danger: 

# Assembling the Door

_Is anybody home?_ To detect when the door is either open or closed, you'll be using a&nbsp;[reed switch](https://www.adafruit.com/product/375). These super simple sensors operate on the principle that when a magnet is less than 0.5" away, the reed switch internally closes. We'll detect this change using a HUZZAH32 and send the door's status to the Digi-Key IoT Studio Project.

These switches aren't&nbsp;_just_&nbsp;for a _cardboard_ home, they've been used in real-world projects such as the [_Adafruit IO Door Detector_](https://learn.adafruit.com/using-ifttt-with-adafruit-io) project.&nbsp;

Using a hot glue gun, **glue the reed switch to the left side of the door-frame**.&nbsp;

If you don't have a hot glue gun handy, you can substitute a piece of double-sided tape instead.

You will want to ensure the switch is firmly in place and does not move around any.

![sensors_glue-magnet.gif](https://cdn-learn.adafruit.com/assets/assets/000/084/731/medium640thumb/sensors_glue-magnet.jpg?1574369850)

Next, grab the closest empty Adafruit/Amazon/Digi-Key box (We _know_&nbsp;you have some around, we do!).

Using a ruler, **sketch a door on a this piece of cardboard**. Then, c **ut it out using a pair of scissors or a knife**.

![sensors_IMG_7111.jpg](https://cdn-learn.adafruit.com/assets/assets/000/084/732/medium640/sensors_IMG_7111.jpg?1574369933)

Using double sided tape or hot glue, **affix the magnet to the door**.

![sensors_glue-hinge.gif](https://cdn-learn.adafruit.com/assets/assets/000/084/733/medium640thumb/sensors_glue-hinge.jpg?1574369992)

There's many ways to assemble a door hinge, we'll use tape to act as a hinge. **Place a strip of tape on the door's edge and line it up with the doorway in the house.** You should be able to open and close the door without it falling off.

For a more permanent option, you may want to use a bamboo skewer like we did in the [IO Home: Security Learning System Guide](https://learn.adafruit.com/adafruit-io-home-security/putting-it-together#step-3000203)

![sensors_IMG_0667.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/321/medium640/sensors_IMG_0667.jpg?1575491723)

![sensors_IMG_4600.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/322/medium640/sensors_IMG_4600.jpg?1575491758)

 **Strip 3mm of the rubber coating from the door sensor cable**. Then, **strip 3mm from the male JST header cable**.

**Slide two narrow lengths of heat shrink down each cable** for the door sensor. Then, **slide a wider length of heat shrink over both cables**.&nbsp;

![sensors_IMG_7905.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/375/medium640/sensors_IMG_7905.jpg?1575562191)

![sensors_IMG_7985.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/376/medium640/sensors_IMG_7985.jpg?1575562222)

Using a soldering iron, **tin the ends of both cables**. Then **apply heat** with the soldering iron **to connect them together**.&nbsp;

Once connected, **slide the heat shrink over the soldering joint** and apply heat.

**Repeat this for both cables (red and black).** Once you're done, **slide the larger piece of heat shrink over both of the cables** and apply heat.

![sensors_ezgif.com-video-to-gif_(8).gif](https://cdn-learn.adafruit.com/assets/assets/000/085/424/medium640thumb/sensors_ezgif.com-video-to-gif_%288%29.jpg?1575586121)

![sensors_IMG_8939.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/427/medium640/sensors_IMG_8939.jpg?1575587160)

![sensors_IMG_2899.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/428/medium640/sensors_IMG_2899.jpg?1575587327)

# Assembling the Fan

In order to attach the DC spindle motor to the roof of the home, you'll build a rafter-like-support using a popsicle stick.

With a pencil, **mark a line 0.5" from the curved portion of the popsicle stick**.

Using wire snips or scissors, **cut along the line you marked**. To avoid splitting the wood, take small "snips" instead of a large cut.

After cutting, you may want to use a file or some coarse sandpaper to **sand down uneven edges**.

![sensors_IMG_0295.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/345/medium640/sensors_IMG_0295.jpg?1575495520)

![sensors_IMG_2194.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/346/medium640/sensors_IMG_2194.jpg?1575495540)

![sensors_IMG_6747.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/347/medium640/sensors_IMG_6747.jpg?1575495550)

- **Insert one end of the popsicle stick** in the inside corner of the roof.
- With a pencil, **mark the popsicle stick at where the inside roof ends.**
- **Using wire snips or scissors, cut along the line** you marked. To avoid splitting the wood, take small "snips" instead of a large cut.
- After cutting, you may want to use a file or some coarse sandpaper to sand down uneven edges.
- **Test-fit the popsicle stick into the roof.**

![sensors_IMG_0348.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/348/medium640/sensors_IMG_0348.jpg?1575495703)

![sensors_IMG_5385.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/349/medium640/sensors_IMG_5385.jpg?1575495714)

![sensors_IMG_2265.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/350/medium640/sensors_IMG_2265.jpg?1575495845)

- **Add a dab of glue (or hot glue) to either side of the popsicle stick**. If the stick in your kit is bowed a little, add the glue to the _bowed side_. The motor will be mounted the flat side of the roof.
- **Insert the popsicle stick into the roof** and **press down** on it until it sets.

Let's leave this piece alone to dry.

![sensors_IMG_7484.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/351/medium640/sensors_IMG_7484.jpg?1575495917)

![sensors_IMG_0940.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/352/medium640/sensors_IMG_0940.jpg?1575496023)

![sensors_IMG_8424.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/353/medium640/sensors_IMG_8424.jpg?1575496046)

![sensors_IMG_0564.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/354/medium640/sensors_IMG_0564.jpg?1575496080)

Modify the propeller by **cutting ~0.4mm off each end of the propeller with a pair of scissors or wire cutters.**

**Press-fit the propeller onto the DC Spindle Motor.** You may need to press hard, it's a _tight_ fit.

![sensors_IMG_8540.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/355/medium640/sensors_IMG_8540.jpg?1575496342)

![sensors_IMG_4548.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/356/medium640/sensors_IMG_4548.jpg?1575496425)

![sensors_IMG_0910.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/357/medium640/sensors_IMG_0910.jpg?1575496490)

 **Strip 3mm of the rubber coating from the door sensor**. Then, **strip 3mm from the male JST header cable**.

**Slide two narrow lengths of heat shrink down each cable** for the door sensor. Then, **slide a wider length of heat shrink over both cables**.&nbsp;

![sensors_IMG_1395.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/382/medium640/sensors_IMG_1395.jpg?1575565154)

![sensors_IMG_0266.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/383/medium640/sensors_IMG_0266.jpg?1575565206)

Using a soldering iron,&nbsp; **tin the ends of both cables**. Then&nbsp; **apply heat&nbsp;** with the soldering iron **&nbsp;to connect them together**.&nbsp;

Once connected,&nbsp; **slide the heat shrink over the soldering joint** &nbsp;and apply heat.

**Repeat this for both cables (red and black).**&nbsp;Once you're done,&nbsp; **slide the larger piece of heat shrink over both of the cables** &nbsp;and apply heat.

![sensors_IMG_01011.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/429/medium640/sensors_IMG_01011.jpg?1575587812)

![sensors_IMG_00452.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/430/medium640/sensors_IMG_00452.jpg?1575587834)

![sensors_IMG_13773.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/431/medium640/sensors_IMG_13773.jpg?1575587876)

![sensors_IMG_60544.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/432/medium640/sensors_IMG_60544.jpg?1575587924)

**Apply a small dab of glue (or hot glue) to the back of the motor**. We've marked on the image where the glue could leak into the motor.

![sensors_Pasted_Image_12_4_19__4_58_PM.png](https://cdn-learn.adafruit.com/assets/assets/000/085/358/medium640/sensors_Pasted_Image_12_4_19__4_58_PM.png?1575496820)

 **Center the motor** above the popsicle stick.

**Before pressing down to set the glue** , **give the fan a spin to ensure it has clearance on all inside sides of the roof.&nbsp;**

**Press down on the motor to set the glue**. Let's leave the roof to dry while we work on the LEDs

![sensors_IMG_0675.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/391/medium640/sensors_IMG_0675.jpg?1575565612)

![sensors_ezgif.com-video-to-gif_(10).gif](https://cdn-learn.adafruit.com/assets/assets/000/085/393/medium640thumb/sensors_ezgif.com-video-to-gif_%2810%29.jpg?1575583769)

# Adding LEDs

You're going to use five Adafruit LED Sequins (in Digi-Key red) to add some lights to your home. These small LEDs only show a single color and don't have digital control, making them simple to add to your home.&nbsp;

Using a JST cable with a male header, **strip off a length of the rubber coating**. Twist the stranded wire together and **tin the bare wire** using a soldering iron.

**Slide a sequin LED over each end of the cable.** Be sure to line up the red JST cable with the positive end (+) of the sequin.

**Solder the front and back of the sequin's copper pads to secure the sequin in-place**.

![sensors_IMG_0425.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/395/medium640/sensors_IMG_0425.jpg?1575567572)

![sensors_ezgif.com-video-to-gif_(11).gif](https://cdn-learn.adafruit.com/assets/assets/000/085/396/medium640thumb/sensors_ezgif.com-video-to-gif_%2811%29.jpg?1575584872)

 **Add a second sequin to the chain, and solder it to the cable.**

Five sequins are included with the Digi-Key IoT Home Kit. You may use all five or less (we used two here). Connect and solder the rest of the sequins.

![sensors_IMG_6611.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/397/medium640/sensors_IMG_6611.jpg?1575567900)

![sensors_ezgif.com-video-to-gif_(12).gif](https://cdn-learn.adafruit.com/assets/assets/000/085/398/medium640thumb/sensors_ezgif.com-video-to-gif_%2812%29.jpg?1575583172)

 **Using hot glue, secure the fan's cabling to the roof**.

Then,&nbsp; **apply hot glue to the JST cable connected to the LED sequins**. You may glue the LED portion down, but, these LEDs are not too bright and adding glue may diffuse them too much.

![sensors_ezgif.com-video-to-gif_(13).gif](https://cdn-learn.adafruit.com/assets/assets/000/085/400/medium640thumb/sensors_ezgif.com-video-to-gif_%2813%29.jpg?1575583294)

![sensors_IMG_0350.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/401/medium640/sensors_IMG_0350.jpg?1575568719)

# Assembling the Smart Home Hub

Connect the Feather HUZZAH32 to the FeatherWing Quad Kit along with the ADI FeatherWing and the Non-Latching Relay FeatherWing.

**Make sure the orientation reflects the image below.**

![](https://cdn-learn.adafruit.com/assets/assets/000/085/399/medium800/sensors_Pasted_Image_12_5_19__12_57_PM.png?1575568681)

# Add a hole for the USB Cable

We'll need to cut a hole on the bottom left side of the home for a USB cable.

 **This portion is more tricky than it appears.** &nbsp;The IOT House is made out of paper maché, not cardboard. If you cut this material slowly with a dull knife or scissors, it will de-laminate. You will want to use a very sharp X-Acto knife or something like the&nbsp;[Slice Craft Knife which has a ceramic blade](https://www.adafruit.com/product/4306).&nbsp;

- On the bottom left side of the home, **measure and mark a hole 20.8mm x 17.4mm**
- Using a sharp blade, **cut a hole for the USB cable** from the bottom left side of the home.
- **Slide the Smart Home Hub into the smart home**

![sensors_IMG_2434.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/402/medium640/sensors_IMG_2434.jpg?1575571012)

![sensors_IMG_7446.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/403/medium640/sensors_IMG_7446.jpg?1575571048)

![sensors_IMG_4836.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/404/medium640/sensors_IMG_4836.jpg?1575571097)

![sensors_ezgif.com-video-to-gif_(14).gif](https://cdn-learn.adafruit.com/assets/assets/000/085/405/medium640thumb/sensors_ezgif.com-video-to-gif_%2814%29.jpg?1575583897)

Connect up all the JST connectors and close the roof of the home.

![](https://cdn-learn.adafruit.com/assets/assets/000/085/320/medium800/sensors_DigiKey_IoT_Home_Kit_open_ORIG_2019_12.jpg?1575491334)

With the Home fully assembled, let's move on to programming it!

# Digi-Key IoT Studio Mini Smart Home

## How Digi-Key IoT Studio Works

Danger: 

We've previously[written about end-to-end services](https://learn.adafruit.com/all-the-internet-of-things-episode-three-services/end-to-end-solutions) which take care things like of data storage, event messaging and APIs like Particle and Electric Imp. Digi-Key has entered the field of end-to-end Internet-of-Things services with their own service, Digi-Key IoT Studio.

However, unlike [Particle](https://learn.adafruit.com/all-the-internet-of-things-episode-three-services/end-to-end-solutions#particle-dot-io-11-2) and [Electric Imp](https://learn.adafruit.com/all-the-internet-of-things-episode-three-services/end-to-end-solutions#electric-imp-11-2), Digi-Key IoT Studio includes built-in board support for _dozens_ of development boards which Digi-Key sells and drag and drop elements for breakouts, sensors, radio modules and more!

Digi-Key IoT Studio is a **web-based** integrated development environment (abbreviated IDE) that allows people of all skill levels to easily construct IoT Projects. You do not need to install software toolchains, code editors or compile any code on your computer! Digi-Key Studio runs in your web browser, handles all aspects of developing an Internet-of-Things project, and even compiles your code _remotely_.

Internet-of-Things projects involve programming firmware into a device, interacting with the device (possibly using a website or application), and sending data from a device to "the cloud". Digi-Key IoT Studio comprises of three workspaces which simplify development: an embedded workspace to build device logic, an Application workspace to build an application for your device, and a cloud workspace to construct a method to send data to the cloud.

## Embedded Workspace
![](https://cdn-learn.adafruit.com/assets/assets/000/084/720/medium800/sensors_DigiKey_IoT_Embedded.png?1574293480)

 **The Embedded Workspace in Digi-Key IoT Studio allows you to build embedded firmware which runs on your microcontroller**. You'll be using this tab to program your HUZZAH32. Digi-Key IoT Studio supports two types of transports - [Bluetooth Low Energy (BLE)](https://learn.adafruit.com/alltheiot-transports/bluetooth-btle) and [WiFi](https://learn.adafruit.com/alltheiot-transports/wifi).

You may configure data to be sent directly to the Digi-Key IoT Cloud over WiFi, or send data to an Application on a device (like a phone or tablet) over BLE.

Once you've finished building up your project's firmware, you can move on to building an application to interact with it.

## Application Workspace
![](https://cdn-learn.adafruit.com/assets/assets/000/084/723/medium800/sensors_DigiKey_IoT.png?1574293572)

 **The Application Workspace allows you to design an interface to interact with your microcontroller from a tablet or smartphone**. This workspace is split into two sides - a visual "App Builder" which allows you to drag and drop interface elements onto an application and a workspace for building the application's logic.

Once you've built up an application, it's time to send data to the Digi-Key IoT Cloud Service!

## Cloud Workspace
![](https://cdn-learn.adafruit.com/assets/assets/000/084/725/medium800/sensors_DigiKey_IoT.png?1574293749)

**The Cloud Workspace uses [WiFi](https://learn.adafruit.com/alltheiot-transports/wifi)&nbsp;and [the MQTT protocol](https://learn.adafruit.com/alltheiot-protocols/mqtt) to send data from your IoT Project to the internet**. As with most [end-to-end solutions](https://learn.adafruit.com/all-the-internet-of-things-episode-three-services/end-to-end-solutions), Digi-Key provides their own Cloud Storage which can store up to 10MB of data per-device. If your IoT project requires a large amount of cloud storage - you can still use Digi-Key IoT Studio. Digi-Key IoT Studio supports sending data from your project to larger cloud storage providers like Amazon AWS.

# Digi-Key IoT Studio Mini Smart Home

## Getting Started

Danger: 

Before you can use Digi-Key IoT Studio, you'll need to install two applications: DK IoT Studio Mobile and IoT Agent.&nbsp;

# **Install DK IoT Studio Mobile App**

The Digi-Key IoT Studio app is an app which works with microcontrollers such as the Adafruit Feather ESP32 Huzzah and the Digi-Key IoT Platform. It lets you monitor your connected projects from your phone or tablet.

[Download Digi-Key IoT for iOS](https://apps.apple.com/us/app/digi-key-iot/id1440810430)
[Download Digi-Key IoT for Android](https://play.google.com/store/apps/details?id=com.digikey.atmosphere.iot&hl=en)
# Install IoT Agent

You'll need the IoT Agent to program your HUZZAH32 from Digi-Key IoT Studio. The IoT Agent is a local application that's used to program hardware from your web browser. It runs on every major desktop operating system:&nbsp;

[Download Digi-Key IoT Agent for Windows](https://developer.atmosphereiot.com/files/clientAgent/atmosphereiotagent-latest%20Setup.exe)
[Download Digi-Key IoT Agent for macOS](https://developer.atmosphereiot.com/files/clientAgent/atmosphereiotagent-latest.dmg)
[Download Digi-Key IoT Agent for Linux](https://developer.atmosphereiot.com/files/clientAgent/atmosphereiotagent-latest-x86_64.AppImage)
_If you encounter an issue with running the IoT Agent_, [post up on the Digi-Key Tech Forum](https://forum.digikey.com/c/IoT/Studio) for support.

# Creating a Digi-Key IoT Studio Project

Once you installed both the Digi-Key IoT Mobile App and IoT Agent, [navigate to the Digi-Key IoT Studio website](https://www.digikey.com/en/iot-development-platform/). You'll be prompted to log in with your Digi-Key account, or create one if you haven't yet.

You'll be brought to the Studio Projects screen. From the Studio Projects screen, **create a new project by clicking the + button**.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/734/medium640/sensors_DigiKey_IoT.png?1574370586)

You'll be creating a project using the Adafruit HUZZAH32 board. **Select the Huzzah32** and **name the project**  **IoT Home**.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/735/medium640/sensors_DigiKey_IoT.png?1574370713)

Once the project is created successfully, you'll be brought to the **Embedded**  **Workspace** for your project.&nbsp;

The embedded workspace in Digi-Key IoT Studio Project allows you to build embedded firmware. You'll be using this workspace to program your HUZZAH32.&nbsp;

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/736/medium640/sensors_DigiKey_IoT.png?1574370761)

Let's get started by building a project which can turn on or off the smart home's LEDs from the mobile app.

# Digi-Key IoT Studio Mini Smart Home

## Turning on the Lights

Danger: 

# Step-by-Step: Embedded Workspace

You're going to create a mobile application to turn on the IoT Home's lights from an application on your phone.&nbsp;

You'll start by adding embedded elements to your workspace. Earlier, you connected the LED lights to a pin on the Feather Huzzah32. You'll use a **GPIO Pin Element** to read or write the state of a GPIO pin.&nbsp;

- &nbsp;From the element toolbox within IoT Studio's Embedded workspace, **click the GPIO Pin element**.
- You should see a new GPIO Pin element appear on your workspace.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/737/medium640/sensors_DigiKey_IoT.png?1574371147)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/738/medium640/sensors_DigiKey_IoT.png?1574371161)

 **Click the GPIOPin element in the workspace** to bring up the element's properties.

- Later in this project, you'll be adding _another_ GPIO element. To avoid confusion, **rename the element** to **GPIOPin14.**

Your IoT Home uses the Feather Huzzah32's GPIO Pin #14 for the LEDs.

- **Change the GPIO Pin to IO14.**

Congrats - you've set up your first IoT Studio Element. Now, you need a way to&nbsp;_interact with_ the LEDs.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/739/medium640/sensors_DigiKey_IoT.png?1574371314)

Digi-Key IoT Studio provides two different types of transports for your Feather Huzzah32 - Bluetooth Low Energy (BLE) and WiFi ("Cloud").

Since you'll be sending a small amount of data (a binary 1 or 0) to the IoT Home from the mobile application, and want it to respond quickly, you're going to use Bluetooth Low Energy as a transport.

- From the element toolbox within IoT Studio's embedded workspace, **click the BLE Gatt Characteristic element**.
- You should see a new element in your embedded workspace named _BLECharacteristicCustom_.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/740/medium640/sensors_DigiKey_IoT.png?1574371459)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/741/medium640/sensors_DigiKey_IoT.png?1574371681)

 **Click the BLE GATT Characteristic Element** to bring up its properties. Later, you'll be connecting this element to a toggle switch on the mobile application. The toggle switch element can only send a 1 or a 0, you'll need to change the Data Type to a boolean.&nbsp;

- **Change Read Data Type** to **Boolean**
- **Change Write Data Type** to **Boolean**
- **Change Notify Data Type** to **Boolean**

&nbsp;

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/743/medium640/sensors_DigiKey_IoT.png?1574371931)

With the BLE GATT element and GPIO element configured, let's connect them together!

- Scroll down in the BLE GATT Characteristic Element Properties until you see **Add Event**.
- **Click the + Symbol** to create a new connector.

![sensors_dk_add_event.gif](https://cdn-learn.adafruit.com/assets/assets/000/084/744/medium640thumb/sensors_dk_add_event.jpg?1574372392)

You're going to **create a connector from the BLE Characteristic Element** to the **GPIO Pin**.

**Click the + Symbol above Add Event in the BLE Charactertistic Element's properties.** Then, **click the GPIO element.**

**Change the connector's ability** to Set State.

![](https://cdn-learn.adafruit.com/assets/assets/000/084/746/medium800thumb/sensors_dk_connect_ble_gpio_lights.jpg?1575407123)

# Step-by-Step: Application Workspace

With the firmware portion of the project completed, it's time to build a mobile application to interact with the embedded project. **Click the Application Tab underneath your project's title** to be brought to the Application workspace.

![](https://cdn-learn.adafruit.com/assets/assets/000/084/747/medium800/sensors_DigiKey_IoT.png?1574372716)

The Application Tab is different from the cloud or embedded tabs - it contains an **Application Builder to design the project's interface** and an **Application Workspace to construct the application's interface and logic**.

Let's begin by changing the display size to match the device you're using.

- On the Application Builder, **click the Add Layout button**.
- **Click the toggle switch** to select the display size that best matches your device's display.
- **Click Save**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/749/medium640/sensors_DigiKey_IoT.png?1574372983)

![sensors_dk_display_sz.png](https://cdn-learn.adafruit.com/assets/assets/000/084/750/medium640/sensors_dk_display_sz.png?1574373013)

Let's add a background image for the application. We created one for the iPhone X display size. You may need to crop/resize the image to fit your device's display.

**Download the background image** by clicking the button below **and save it to your Desktop**.

[Download iot-home-background.png](https://github.com/adafruit/Adafruit_Learning_System_Guides/raw/master/DigiKey_IoT_Home/iot-home-background.png)
From the element toolbox under _Application Interface_, **select the Image element**.

An image element should appear on the workspace and the application builder.

- From the workspace, **click the Image Element&nbsp;** to bring up its element properties.
- From the Image Element's properties, click **Browse** and **select the iot-home-background.png** image you downloaded earlier.

You can move the background image around and resize it to fit the size of the display you're using.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/753/medium640/sensors_DigiKey_IoT.png?1574373311)

![sensors_dk_add_background_img_1.png](https://cdn-learn.adafruit.com/assets/assets/000/084/754/medium640/sensors_dk_add_background_img_1.png?1574373426)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/755/medium640/sensors_DigiKey_IoT.png?1574373493)

![sensors_dk_set_background_2.png](https://cdn-learn.adafruit.com/assets/assets/000/084/756/medium640/sensors_dk_set_background_2.png?1574373565)

You'll notice that there is a BLE Characteristic Element on the Application Workspace -&nbsp; this isn't a mistake. In fact, this is the _same_ element you added to the embedded workspace. **Bluetooth and WiFi elements in IoT Studio often create mirror elements in other workspaces**. One purpose of this is to send data bi-directionally between a mobile application and the embedded firmware.

You'll be be _writing_ the state of the toggle switch from the app to the BLE characteristic element. The firmware will _read_ this element's value and _set the pin to the state of the toggle switch_.

Digi-Key IoT Studio has an element which is perfect for controlling the lights in your home. The toggle Switch element is bi-directional and can be used to send either _1_ or _0_ to the lights to turn them _on_ or _off_.

From Application Interface, **select the Toggle Switch element**.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/757/medium640/sensors_DigiKey_IoT.png?1574373743)

Since you'll be sending data&nbsp; **from&nbsp;** the Toggle Switch element to the BLE Characteristic Element, **change the order of the elements by dragging and dropping**  **them** such that the toggle switch is placed before the BLE Characteristic.

- **Click the Toggle Element on the Workspace** to bring up its element properties and **click Add Event**.
- **Drag a connector from the toggle element** to **the BLE Characteristic element** on your workspace.

![](https://cdn-learn.adafruit.com/assets/assets/000/084/758/medium800thumb/sensors_dk_toggle_1.jpg?1575584369)

Each connector can execute different events based on a _trigger_. We'll want to write the state of the toggle switch (_on or off_) to the BLE Characteristic Element, so we'll use the Toggle Element's _Changed_ trigger.

- From the Application Workspace, **click the Toggle Element** to bring up its properties.
- Verify that the Toggle Element trigger you are modifying is the _Changed&nbsp;_trigger.
- **Set the Ability** to **Write**
- **Set the Value** to **value**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/893/medium640/sensors_DigiKey_IoT.png?1574715763)

You might be wondering why the Toggle element is not appearing on the application builder. The element is on the builder, but it's located in the background layer. The Application Builder supports two layers for images. The background is in front of the toggle element.

**Let's bring the toggle element to the top layer so we can interact with it.**

- From the Application Workspace,&nbsp; **click the Toggle Element**
- From the Application Builder Toolbar, c **lick the&nbsp;_Send to Front_&nbsp;button.&nbsp;**
  - The Toggle Button should appear on the interface.&nbsp;

![sensors_toggle_to_front.gif](https://cdn-learn.adafruit.com/assets/assets/000/084/900/medium640thumb/sensors_toggle_to_front.jpg?1574783164)

To make sure you'll align this element correctly, you'll use Application Builder's _Snap-to-Grid_ feature.

- From the Application Builder Toolbar, **click the&nbsp;_#&nbsp;_icon**.
- **Click the toggle element and drag it underneath the lightbulb icon&nbsp;** on the background image.

![sensors_toggle_place.gif](https://cdn-learn.adafruit.com/assets/assets/000/084/901/medium640thumb/sensors_toggle_place.jpg?1574783649)

# Step-by-Step: Uploading Firmware

You just created embedded firmware and a mobile application. Now, let's program the firmware onto the Feather Huzzah32 and control the IoT Home from your device.

 **Click the Compile button** at the top of your project to compile the project. This will take anywhere from a few seconds to a few minutes, depending on how complicated your project is and how busy the build servers are.&nbsp;

Once compiled successfully, a green status bar across the bottom of the screen will appear telling you that your project is compiled.

If there is a compilation error, a window with a descriptive compiler error will appear over the workspace.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/760/medium640/sensors_DigiKey_IoT.png?1574374732)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/761/medium640/sensors_DigiKey_IoT.png?1574374816)

Next, plug your Huzzah32 into a port on your computer and make sure the IoT Agent application is running in the background (it should be visible in your system tray).

- From the Embedded Tab, **click the Program Firmware** Icon.
- **Select the Serial Port** your Huzzah32 is connected to and **select a serial speed**.
- **Click Program**

The Program Firmware window will update when the programming is complete.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/762/medium640/sensors_DigiKey_IoT.png?1574375095)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/763/medium640/sensors_DigiKey_IoT.png?1574375116)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/764/medium640/sensors_DigiKey_IoT.png?1574375187)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/765/medium640/sensors_DigiKey_IoT.png?1574375195)

If your program uploaded successfully, move on to using the Digi-Key IoT Mobile Application to interact with your IoT Home's lights.

# Step-by-Step: DK IoT Studio Mobile App

The DK Studio Mobile app "works in conjunction with a wireless device (your cell Phone) and the Digi-Key IoT Platform (cloud service) to monitor your custom-built connected things".

Open the application from your device. **Click the Login button** and **log into your Digi-Key account**.

![sensors_IMG_0593.png](https://cdn-learn.adafruit.com/assets/assets/000/084/894/medium640/sensors_IMG_0593.png?1574717441)

![sensors_IMG_0594.png](https://cdn-learn.adafruit.com/assets/assets/000/084/895/medium640/sensors_IMG_0594.png?1574717478)

The DK IoT Studio Mobile App is a pared down version of the web-based Digi-Key IoT Studio. You can't edit or modify code but you can connect to your devices and view their status.

- From the sidebar, **tap the Cube icon**. This will bring up the Devices screen.&nbsp;
- From the top of the Devices screen, **tap the cube with a plus icon (+)**&nbsp;to bring up the _Add Device&nbsp;_screen.

![sensors_rsz_img_0595.png](https://cdn-learn.adafruit.com/assets/assets/000/084/899/medium640/sensors_rsz_img_0595.png?1574717698)

Your IoT Home should appear as a device in range, along with its MAC address and transport (BLE).&nbsp;

- **Tap the device name**
  - Make sure not to unplug the Feather while the app is in the middle of the provisioning process.

![sensors_IMG_0617.png](https://cdn-learn.adafruit.com/assets/assets/000/084/902/medium640/sensors_IMG_0617.png?1574785002)

![sensors_IMG_0618.png](https://cdn-learn.adafruit.com/assets/assets/000/084/903/medium640/sensors_IMG_0618.png?1574785124)

The WiFi Provisioning screen will appear. Since you are using BLE instead of WiFi, **tap the cancel button**.

![sensors_IMG_0619.png](https://cdn-learn.adafruit.com/assets/assets/000/084/904/medium640/sensors_IMG_0619.png?1574785277)

The app should load its Application View. **Tap the toggle button** - the lights should turn on and off!

![](https://cdn-learn.adafruit.com/assets/assets/000/085/267/medium800thumb/sensors_ezgif.com-video-to-gif_%281%29.jpg?1575392661)

# Digi-Key IoT Studio Mini Smart Home

## Monitoring your Home

Danger: 

Now that you can turn on the lights inside your home - you may be asking what&nbsp;_else_ can you do? One popular feature people add to their smart-homes is **environmental monitoring**. Tracking your home's environmental data is useful for both **short-term alerts** (_if the temperature in a room is too low, or the concentration of gas is too high_) and **long-term logging** (_logging data over a long period of time can help us detect abnormalities within the data_)_._

You're going to use the **Embedded Workspace** to build firmware for obtaining precision temperature readings from inside your home using the Analog Devices FeatherWing. Then, you'll add the Bosch BME680 to obtain readings for the relative humidity and the gas level.

Then, you'll use the **Application Workspace** to enhance your mobile application by adding labels to display readings from the sensors inside your home.&nbsp;

Finally, you'll switch to the **Cloud Workspace** to send data from your DK IoT App to DK IoT Studio's Cloud Storage.

# Step-by-Step: Embedded Workspace
You'll begin by adding an **interval element** to your project. Digi-Key IoT uses interval elements to trigger connected elements. You can specify an interval in milliseconds. When the timer expires, it will trigger all elements connected to it.

- From the element toolbox within IoT Studio's Embedded workspace, **click the Interval element**.
- **Move the Interval Element** underneath the BLECharacteristic Element.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/907/medium640/sensors_DigiKey_IoT.png?1574787851)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/908/medium640/sensors_DigiKey_IoT.png?1574787909)

![sensors_int_element.png](https://cdn-learn.adafruit.com/assets/assets/000/084/909/medium640/sensors_int_element.png?1574788314)

Elements for the BME680 or the Sensor FeatherWing are not within the default element toolbox - you'll have to manually add them from within the **Element Library**.

- From the element toolbox within IoT Studio's Embedded workspace,&nbsp; **click Add Element** &nbsp;
- From the Element Library, **search for the**  **BME680**.
- Enable the BME680 library elements by **clicking the toggle button**.
- From the bottom of the Element Library, **click Save**

You will also need to import the ADT7410 sensor library.

- From the element library, **search for the ADT7410FEATHERWING**.
- **Enable the ADT7410FEATHERWING library.**
- From the bottom of the Element Library, **click Save**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/910/medium640/sensors_DigiKey_IoT.png?1574788434)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/911/medium640/sensors_DigiKey_IoT.png?1574788507)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/912/medium640/sensors_DigiKey_IoT.png?1574789207)

The ADT7410 and BME680 sensors should now appear in your Element Toolbox under _Imported_. Let's add the ADT7410 temperature sensor to the workspace.

- From the element toolbox within IoT Studio's Embedded workspace,&nbsp; **click the ADT7410 Temperature Element&nbsp;** to add it to the Workspace.
- **Move the ADT7410 element** underneath the GPIO element.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/913/medium640/sensors_DigiKey_IoT.png?1574789396)

 **Make a new connection** between the Interval Element and the ADT7410 Element.

![](https://cdn-learn.adafruit.com/assets/assets/000/084/918/medium800thumb/sensors_interval_add_event_adt7410.jpg?1575407180)

Every time the interval executes, the interval will trigger the ADT7410FeatherWing element to read the sensor's temperature in degrees Celsius.

Let's create a new BLE GATT Characteristic to read the temperature sensor's value.

- From the element toolbox within IoT Studio's Embedded workspace,&nbsp; **click the BLE GATT Characteristic Element** to add it to the Workspace.
- **Click the BLECharacteristicCustom Element** on the Embedded workspace to bring up its properties.
- **Change the element's name** to BLECharacteristicTemp

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/919/medium640/sensors_DigiKey_IoT.png?1574790263)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/920/medium640/sensors_DigiKey_IoT.png?1574790357)

Let's add a new event to write data to the BLE Characteristic each time the temperature is is read.

- **Click the ADT7410FeatherWing Element**
- **Click Add Event**
- **Add a connector** between the ADT7410FeatherWing Element and the BLECharacteristicTemp Element.

![](https://cdn-learn.adafruit.com/assets/assets/000/084/921/medium800thumb/sensors_connect_adt_ble_temp.jpg?1575407238)

The **debug print element**. This element will print the sensor value to the Huzzah debug UART console (on your computer). This is useful for checking if the sensors are operating correctly, independently of the BLE connection.

- From the element toolbox within IoT Studio's Embedded workspace,&nbsp; **click the Debug Print Element&nbsp;** to add it to the Workspace.
- From the Debug Print Element's properties, **name the element _DebugPrintTemp_**.

You can add a label to differentiate which value is being printed to the console:

- Under _Prepend Text_, add the text&nbsp;_Temperature (\*C):&nbsp;_
  - The temperature reading in the UART terminal will look something like: `Temperature (*C): 25.23`

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/922/medium640/sensors_DigiKey_IoT.png?1574790939)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/923/medium640/sensors_DigiKey_IoT.png?1574791146)

 **Make a new connection between the ADT7410FeatherWing element and the DebugPrintTemp Element.**

![](https://cdn-learn.adafruit.com/assets/assets/000/084/924/medium800thumb/sensors_connect_adt_debug_print.jpg?1575584391)

To summarize - every time the interval's timer expires, the ADT7410 will read the temperature. Once the temperature is read from the sensor, it'll be sent to the BLECharacteristicTemp element and printed to the UART console.&nbsp;

Next, re-do these steps, but for the BME680 sensor.&nbsp;

- From the element toolbox within IoT Studio's Embedded workspace,&nbsp; **click the BME680 Element&nbsp;** to add it to the Workspace.
- **Click the BME680 element** to bring up the properties.
- **Change the I2C Address** to **0x77**
- **Change the trigger** to **_Humidity Read_**

![sensors_Cursor_and_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/268/medium640/sensors_Cursor_and_DigiKey_IoT.png?1575395769)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/925/medium640/sensors_DigiKey_IoT.png?1574792133)

- **Add a connector** from the Interval Element to the BME680 Element.
- In the Interval Element's Properties, **change the BME680's ability** to&nbsp;_Read Humidity (%RH)_

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/927/medium640/sensors_DigiKey_IoT.png?1574793358)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/928/medium640/sensors_DigiKey_IoT.png?1574793379)

Let's add some elements to receive and print the data from the sensor.

- From the element toolbox within the IoT Studio Embedded workspace, **click the BLE GATT Characteristic Element&nbsp;** to add it to the Workspace.
- **Change the name of this element to _BLECharacteristicHumid_**
- From the element toolbox within IoT Studio's Embedded workspace,&nbsp; **click the Debug Print Element&nbsp;** to add it to the Workspace.
- **Change the name of this element to DebugPrintHumid**
- **Modify the Prepend Text** to **_Humidity (%RH)_**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/929/medium640/sensors_DigiKey_IoT.png?1574793758)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/930/medium640/sensors_DigiKey_IoT.png?1574793794)

- **Click the BME680 element** to bring up its properties.
- Under the _Humidity Read_ trigger, **click Add Event**
- **Add a connector**  **between the BME680 element and the BLE Characteristic Element**
- **Add a connector&nbsp;between the BME680 Element and the Debug Print Element.**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/931/medium640/sensors_DigiKey_IoT.png?1574794640)

Next, let's read data from the BME680's gas sensor. This sensor will read its resistance in ohms.

- From the element toolbox within IoT Studio's Embedded workspace,&nbsp; **click the Interval Element&nbsp;** to bring up its properties.
- From the Interval Properties, **click Add Event**
- **Add a connector between the Interval Element and the BME680 Element.**
- **Change the ability of the connector** to _Read Gas Resistance (Ohm)_

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/932/medium640/sensors_DigiKey_IoT.png?1574794838)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/933/medium640/sensors_DigiKey_IoT.png?1574794880)

 **Click the BME680 Element** in the Embedded Workspace to bring up its properties.

**Change the Trigger**  **from Humidity Read** to **Gas Resistance Read**.

You'll notice that there are no events defined for this trigger, but there are connectors from the BME to other elements. Those connectors are specific to the _Read Humidity&nbsp;_trigger. You'll be adding similar events for the _Gas Resistance Read_ trigger.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/934/medium640/sensors_DigiKey_IoT.png?1574798905)

Let's add some elements to receive and print the data from the sensor.

- From the element toolbox within IoT Studio's Embedded workspace,&nbsp; **click the BLE GATT Characteristic Element&nbsp;** to add it to the Workspace.
- **Change the name of this element to&nbsp;_BLECharacteristicGas_**
- From the element toolbox within IoT Studio's Embedded workspace,&nbsp; **click the Debug Print Element&nbsp;** to add it to the Workspace.
- **Change the name of this element to DebugPrintGas**
- **Modify the Prepend Text** &nbsp;to&nbsp;**_Gas (ohms):&nbsp;_**

Once the Elements are configured, **make a connection between the BME680 Element and both elements**.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/935/medium640/sensors_DigiKey_IoT.png?1574799020)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/936/medium640/sensors_DigiKey_IoT.png?1574799076)

Make sure your embedded workspace looks like the following before moving on.

![](https://cdn-learn.adafruit.com/assets/assets/000/084/937/medium800/sensors_DigiKey_IoT.png?1574799187)

# Step-by-Step: Application Workspace

The Mobile Application allows you visually display the sensor values. You'll add **label elements** to the interface to display the values read from the sensors.&nbsp;

Navigate to the Application Tab. The BLE Characteristics you created in the embedded tab may be cluttered. Move them around to organize your workspace.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/938/medium640/sensors_DigiKey_IoT.png?1574799416)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/939/medium640/sensors_DigiKey_IoT.png?1574799522)

With an organized workspace, you're ready to start programming the application's logic.

- From the Element Toolbox, **add an Interval Element**.
- **Click the Interval Element** in the Application Workspace.
- From the Interval Element's Properties, **click Add Event.**
- **Connect the Interval Element to the BLECharacteristicTemp Element**
- **Connect the Interval Element to the BLECharacteristicHumid and BLECharacteristicGas elements**.

&nbsp;

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/940/medium640/sensors_DigiKey_IoT.png?1574799629)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/944/medium640/sensors_DigiKey_IoT.png?1574799971)

You'll want to add labels to display the values read by the BLE Characteristic Elements.

- From the Element Toolbox, **click the Label button three times to add three Label elements**.
- **Rename the first label** element to **LabelTemp**
- **Rename the second label** element to **LabelHumid**
- **Rename the third label** element to **LabelGas**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/945/medium640/sensors_DigiKey_IoT.png?1574800155)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/946/medium640/sensors_DigiKey_IoT.png?1574800238)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/947/medium640/sensors_DigiKey_IoT.png?1574800332)

Let's add a connector between the BLE Characteristic Element and the Label Element. This will set the label's text to the value of data read by the BLE Characteristic.

- **Click the BLECharacteristicTemp element** to bring up its properties.
- **Click Add Event**
- **Add a connector** between **BLECharacteristicTemp&nbsp;** and&nbsp; **LabelTemp**.

Next, you'll format the temperature to display on the label with its value and respective unit. The label's text can be formatted using Javascript.

- **Click the connector between the BLECharacteristic Element and the Label element** to bring up its properties.
- Under abilities, **change the text** to readData+"°C"

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/948/medium640/sensors_DigiKey_IoT.png?1574800588)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/949/medium640/sensors_DigiKey_IoT.png?1574800774)

- **Add a connector between BLECharacteristicHumid** and **LabelHumid**
- **Click the connector between BLECharacteristicHumid and LabelHumid** to bring up the connector's properties.
- Under abilities, **change the text to readData+"%RH"**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/951/medium640/sensors_DigiKey_IoT.png?1574801125)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/952/medium640/sensors_DigiKey_IoT.png?1574801161)

Finally, you'll set up the connection between the gas sensor reading and its label on the mobile application.

- **Make a connection between BLECharacteristicGas and LabelGas**
- **Click the connector between BLECharacteristicGas and LabelGas** &nbsp;to bring up the connector's properties.
- Under abilities,&nbsp; **change the text to&nbsp;_readData/100+"Kohms"_**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/069/medium640/sensors_DigiKey_IoT.png?1574879427)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/953/medium640/sensors_DigiKey_IoT.png?1574801263)

Let's take a short break from configuring our application's logic and configure the application's design.

 **Click and drag LabelTemp** &nbsp;underneath the thermometer icon.

![sensors_Cursor_and_Adafruit_Learning_System.png](https://cdn-learn.adafruit.com/assets/assets/000/085/270/medium640/sensors_Cursor_and_Adafruit_Learning_System.png?1575397225)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/955/medium640/sensors_DigiKey_IoT.png?1574801410)

- **Bring the humidity label to the front** and **move it underneath the % symbol icon**
- **Bring the gas label to the front** and **move it underneath the gauge icon**

![sensors_label_interface.png](https://cdn-learn.adafruit.com/assets/assets/000/084/958/medium640/sensors_label_interface.png?1574801881)

Let's add some placeholder text to our interface and center the labels to format our text

- **Click LabelTemp** to bring up the element's properties
- Change the label's text to 25°C
- **Change the label's alignment** to _Center_

**Repeat this for the humidity and gas labels.**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/070/medium640/sensors_DigiKey_IoT.png?1574879472)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/959/medium640/sensors_DigiKey_IoT.png?1574802054)

While data is will display on the application, this data is not stored. To store this data, you'll need to add Cloud elements to our Application Workspace. These elements will create mirrored elements in the Cloud Workspace.

- From the Element Toolbox, **click Cloud Event**
- **Rename&nbsp;** the Cloud Event to&nbsp; **CloudEventTemp**
- **Click BLECharacteristicTemp&nbsp;** to bring up its properties.
- **Click Add Event.**
- **Add a connector** between BLECharacteristicTemp and CloudEvent
- **Create a new element named CloudEventHumid** and connect it to BLECharacteristicHumidity&nbsp;

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/104/medium640/sensors_DigiKey_IoT.png?1574888757)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/962/medium640/sensors_DigiKey_IoT.png?1574803648)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/963/medium640/sensors_DigiKey_IoT.png?1574803686)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/964/medium640/sensors_DigiKey_IoT.png?1574803757)

- **Create a new Cloud Event element**
- **Name the element CloudEventGas**
- **Add a connector** between BLECharacteristicGas and CloudEventGas
- **Click the gear element** on the connector.
- **Change the value** to **readData/1000**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/103/medium640/sensors_DigiKey_IoT.png?1574888722)

You've programmed your mobile application to read values from BLE Characteristics and designed and interface to display these formatted values. Make sure your interface looks similar to the following screenshot before moving on.

![](https://cdn-learn.adafruit.com/assets/assets/000/084/967/medium800/sensors_DigiKey_IoT.png?1574804019)

# Step-by-Step: Cloud Workspace

The Cloud tab is a workspace in DK IoT Studio for enabling an IoT project's connectivity over WiFi with cloud services (Digi-Key IoT Cloud or Amazon Web Services).

- **Click the Cloud Tab** underneath your project's name to be brought to the Cloud Workspace.
- Your cloud workspace should contain the three cloud events you created in the application workspace: _CloudEventTemp, CloudEventHumid, CloudEventGas._

You may want to organize the elements in the Cloud Workspace.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/968/medium640/sensors_DigiKey_IoT.png?1574804160)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/969/medium640/sensors_DigiKey_IoT.png?1574804298)

You'll need somewhere to send this data. Luckily, Digi-Key IoT offers up to 10 megabytes of cloud storage _per device_. To add data to this cloud storage, use the **Cloud Storage Element**.

- From the Cloud Element Toolbox, **click the cloud storage element&nbsp;** to add it to your Cloud Workspace.
- On the Cloud Workspace, **click CloudEventTemp**. Then, **click Add Event**.
- **Make a connector** between the CloudEventTemp and CloudStorage elements

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/970/medium640/sensors_DigiKey_IoT.png?1574804467)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/971/medium640/sensors_DigiKey_IoT.png?1574804630)

While you _could_ send raw data to the cloud storage element, it would be hard to discern which data is the temperature data and which is the gas data. To help identify which value is being sent to the cloud storage, you'll associate each value with some metadata (information about the data).&nbsp;

&nbsp;

 **Click the connector** between the cloud event and the cloud storage.

Under the Add Data ability, **change the value to {temperature:value}**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/972/medium640/sensors_DigiKey_IoT.png?1574804899)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/973/medium640/sensors_DigiKey_IoT.png?1574805053)

Repeat the steps above to add connectors and labels for the humidity and gas values.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/974/medium640/sensors_DigiKey_IoT.png?1574805167)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/975/medium640/sensors_DigiKey_IoT.png?1574805203)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/976/medium640/sensors_DigiKey_IoT.png?1574805257)

# Code Usage

**Compile** &nbsp;the project. Then,&nbsp; **upload the project to the Feather HUZZAH32**.

- **Open the DK IoT Studio Mobile App** on your device.
- **Tap the Devices tab** on the sidebar
- **Add a new device** to the devices page by tapping the + icon
- Your IoT Home should appear as a device in range. **Tap the IoT Home Project**.
- On the Configure WiFi Settings screen, **tap CANCEL**

![sensors_rsz_img_0595.png](https://cdn-learn.adafruit.com/assets/assets/000/084/977/medium640/sensors_rsz_img_0595.png?1574805701)

![sensors_IMG_0617.png](https://cdn-learn.adafruit.com/assets/assets/000/084/978/medium640/sensors_IMG_0617.png?1574805714)

![sensors_IMG_0619.png](https://cdn-learn.adafruit.com/assets/assets/000/084/980/medium640/sensors_IMG_0619.png?1574805747)

The Application's interface should load and populate with values from the sensors.

Try breathing directly on the Sensor FeatherWing's ADT7410 sensor to increase its temperature or humidity. You should observe the values on the application view change.

![sensors_ezgif.com-resize_(1).gif](https://cdn-learn.adafruit.com/assets/assets/000/085/072/medium640thumb/sensors_ezgif.com-resize_%281%29.jpg?1574880677)

# Digi-Key IoT Studio Mini Smart Home

## Keeping it Cool

Danger: 

While monitoring your home's temperature is useful, your home will not be able to respond to changes in temperature. While you could open a window (or remove the roof) to air it out, it'd be useful to control the fan inside your home to regulate temperature.

You'll be building code to self-regulate the temperature inside the home to your preferred temperature.&nbsp;

# Step-by-Step: Embedded Workspace

This section builds on the previous section, _Monitoring your Home_. You'll be adding a **comparison element** to evaluate the temperature and a **GPIO element** to control the relay's state.

The ADI FeatherWing reads the temperature as a floating point value. At the time of writing, Digi-Key IoT Studio is unable to use floating point values with comparison elements. To resolve this, convert the floating point value into an integer value.

- From the Embedded Workspace's Element Toolbox, **click the Type Conversion element**.
- **Click the DataTypeConvert Element&nbsp;** to open its properties.
- In the Type Conversion Element's properties, **change the output type to _Integer_**

&nbsp;

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/982/medium640/sensors_DigiKey_IoT.png?1574806839)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/983/medium640/sensors_DigiKey_IoT.png?1574806923)

 **Add a new connector** between the ADT7410FeatherWing Element and the DataTypeConvert element.&nbsp;

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/984/medium640/sensors_DigiKey_IoT.png?1574807084)

With the temperature reading converted to an integer, it's time to add some&nbsp;_logi__c&nbsp;_to our embedded firmware.

- From the Embedded Workspace's Element Toolbox,&nbsp; **click the Comparison element**.
- **Change the Comparison Element's condition** to **Greater Than**
- **Change the Target Value** to **the maximum temperature value**.
  - If the temperature sensor reads a value greater than the Target Value, the relay will switch and turn on the motor.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/985/medium640/sensors_DigiKey_IoT.png?1574807163)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/986/medium640/sensors_DigiKey_IoT.png?1574807330)

 **Add a new connector between** the **DataTypeConvert Element** and the **EmbeddedComparison**  **Element**.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/987/medium640/sensors_DigiKey_IoT.png?1574807396)

Next, you need to add a GPIO element to control the relay. The relay is connected to GPIO Pin 33 on the ESP32 Huzzah.

- From the Embedded Workspace's Element Toolbox,&nbsp; **click the GPIO Pin element**.
- From the GPIOPin Element's properties, **change the Name to GPIOPin33**
- **Change the GPIO Pin to IO33**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/988/medium640/sensors_DigiKey_IoT.png?1574807530)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/989/medium640/sensors_DigiKey_IoT.png?1574807623)

You'll turn on the relay when the Comparison Element evaluates that the expression is True.

- **Click the EmbeddedComparsion Element** to open its properties
- Under _Triggers_, ensure the trigger is set to **Condition True**.
- **Add a connector** between the EmbeddedComparison Element and GPIOPin33

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/990/medium640/sensors_DigiKey_IoT.png?1574808119)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/991/medium640/sensors_DigiKey_IoT.png?1574808278)

To turn on the relay if the Target Value is reached,

- **Click the connector** between the comparison element and the GPIO pin.
- **Change the GPIO Pin's Ability** to **Set Pin High**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/992/medium640/sensors_DigiKey_IoT.png?1574808348)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/993/medium640/sensors_DigiKey_IoT.png?1574808368)

Our IoT Home turns on the fan when the temperature increases past a target value, _but what if it the home cooled off?&nbsp;_You'll need to turn off the relay.

- **Click the EmbeddedComparsion element** to open its properties.
- **Switch**  **Condition True** to **Condition False**
- **Add a connector** between the EmbeddedComparison Element and the GPIO Pin Element.
- **Change the GPIO Pin's ability to Set Pin Low**

&nbsp;

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/994/medium640/sensors_DigiKey_IoT.png?1574808558)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/084/996/medium640/sensors_DigiKey_IoT.png?1574808714)

![sensors_fan_low.png](https://cdn-learn.adafruit.com/assets/assets/000/084/997/medium640/sensors_fan_low.png?1574808728)

Your "code" for the ADT7410 temperature sensor should look like the following...

![](https://cdn-learn.adafruit.com/assets/assets/000/084/998/medium800/sensors_DigiKey_IoT.png?1574808851)

# Code Usage

**Compile** &nbsp;the project. Then,&nbsp; **upload the project to the Feather HUZZAH32**.

- **Open the DK IoT Studio Mobile App** on your device.
- **Tap the Devices tab** on the sidebar
- **Add a new device** to the devices page by tapping the + icon
- Your IoT Home should appear as a device in range. **Tap the IoT Home Project**.
- On the Configure WiFi Settings screen, **tap CANCEL**

![sensors_rsz_img_0595.png](https://cdn-learn.adafruit.com/assets/assets/000/084/999/medium640/sensors_rsz_img_0595.png?1574808959)

![sensors_IMG_0617.png](https://cdn-learn.adafruit.com/assets/assets/000/085/000/medium640/sensors_IMG_0617.png?1574808968)

![sensors_IMG_0618.png](https://cdn-learn.adafruit.com/assets/assets/000/085/001/medium640/sensors_IMG_0618.png?1574808978)

![sensors_IMG_0619.png](https://cdn-learn.adafruit.com/assets/assets/000/085/002/medium640/sensors_IMG_0619.png?1574808994)

Once connected, the application view will display the temperature sensor's value. Try holding your finger over the ADT7410 (or use a hair-dryer outside to the IoT Home) turn on the fan.&nbsp;

The fan will turn off after the temperature decreases below its target value.

![](https://cdn-learn.adafruit.com/assets/assets/000/085/272/medium800thumb/sensors_ezgif.com-optimize_%282%29.jpg?1575405885)

# Digi-Key IoT Studio Mini Smart Home

## Door Alarm

Danger: 

_Intruder alert!_&nbsp;You'll be using the magnetic door sensor to detect when someone opens or closes the front door. You'll program your IoT Home to sound an alarm when someone opens the door.

_But what if someone enters our home while you're away?_&nbsp;You'll add the ability to monitor your home's status remotely to your mobile app.

![sensors_ezgif.com-optimize_(1).gif](https://cdn-learn.adafruit.com/assets/assets/000/085/279/medium640thumb/sensors_ezgif.com-optimize_%281%29.jpg?1575409937)

## Step-by-Step: Embedded Workspace
If someone enters your house, you would want the home security system to notify you as quickly as possible. You'll be adding an interval with a shorter timer to the embedded workspace to read the status of the door sensor.

- From the Embedded Workspace's Element Toolbox, **click the Interval element**.
- **Name the interval IntervalFast**
- In the Interval Element's properties, **set the time to 50 milliseconds**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/114/medium640/sensors_DigiKey_IoT.png?1574893497)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/116/medium640/sensors_DigiKey_IoT.png?1574893541)

You'll need to read the state of the GPIO Pin connected to the door sensor, GPIO Pin 15.

- **Add a new GPIO Element** to the Workspace
- **Change the name of the GPIO Pin Element** to **GPIOPin15**
- **Change the GPIO Pin** to **IO15**
- **Change the GPIO Mode** to **Input Pull Down**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/117/medium640/sensors_DigiKey_IoT.png?1574893771)

- **Add a connector** between IntervalFast and GPIOPin15
- **Change&nbsp;the connector's ability** to **Read**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/118/medium640/sensors_DigiKey_IoT.png?1574893835)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/119/medium640/sensors_DigiKey_IoT.png?1574893856)

Next, you will write the state of the door to a BLE Characteristic so that it can be read in the mobile application.

- **Create a new BLE GATT Characteristic element**
- **Name the element** BLECharacteristicDoor
- **Change the Read Data Type** to **Boolean**
- **Change the Write Data Type** to **Boolean**
- **Change the Notify Data Type** to **Boolean**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/120/medium640/sensors_DigiKey_IoT.png?1574894040)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/121/medium640/sensors_DigiKey_IoT.png?1574894076)

- In the GPIOPin15 Element's properties, **change its trigger to Read**
- **Add a new connector** between GPIOPin15 and BLECharacteristicDoor

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/122/medium640/sensors_DigiKey_IoT.png?1574894167)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/123/medium640/sensors_DigiKey_IoT.png?1574894987)

Next, let's add an element to evaluate if the door is open or closed.

- From the Element Toolbox, select the Comparison Element
- In the comparison element's properties, **change the element's name to EmbeddedComparisonDoor**
- **Change the target value** to **1**
- Then, **add a connector** between the GPIOPin15 element and the embedded comparison element.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/124/medium640/sensors_DigiKey_IoT.png?1574895074)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/125/medium640/sensors_DigiKey_IoT.png?1574895135)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/126/medium640/sensors_DigiKey_IoT.png?1574895253)

You need a way to notify our neighbors that an intruder has entered our home. Luckily, you installed a buzzer (conveniently connected to ESP32 Pin 12) in the smart home hub!

- **Add a GPIO Pin Element**
- **Name the element GPIOPin12**
- **Change the GPIO Pin** to **IO12**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/127/medium640/sensors_DigiKey_IoT.png?1574895468)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/128/medium640/sensors_DigiKey_IoT.png?1574895486)

Using the comparison element, your code will evaluate if the door is open or not. Based on the door's state, the buzzer will turn on or off.

- **Click the EmbeddedComparisonDoor element**
- Under triggers -\> Condition True, **click Add Event**
- **Add a new connector** between the embedded comparison element and GPIO Pin 12.
- **Change the connector's ability** to **Set Pin High**
- Next, **change the EmbeddedComparisonDoor Element's trigger to Condition False**
- **Change the connector's ability to Set Pin Low**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/132/medium640/sensors_DigiKey_IoT.png?1574895894)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/133/medium640/sensors_DigiKey_IoT.png?1574895913)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/134/medium640/sensors_DigiKey_IoT.png?1574895944)

## Step-by-Step: Application Workspace

Let's add an icon to the mobile application to let us know if the door is open, even if you're away from home.

- From the Application Workspace, **add a new interval element**
- **Name this interval** IntervalFast
- **Change the time** to 50 milliseconds
- **Add a new connector** between IntervalFast and BLECharacteristicDoor

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/135/medium640/sensors_DigiKey_IoT.png?1574896328)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/136/medium640/sensors_DigiKey_IoT.png?1574896360)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/137/medium640/sensors_DigiKey_IoT.png?1574896433)

To evaluate if the door is open or closed, a comparison element needs to be added.

- **Add a Condition Element to the Application Workspace**
- **Add a new connector&nbsp;** between the BLECharacteristicDoor and Condition elements

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/138/medium640/sensors_DigiKey_IoT.png?1574896619)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/139/medium640/sensors_DigiKey_IoT.png?1574896703)

 **Download** the two door images by clicking the buttons below. **Save them to your desktop**

[Download door-closed.png](https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/DigiKey_IoT_Home/door-closed.png)
[Download door-open.png](https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/DigiKey_IoT_Home/door-open.png)
Ok, here comes the _tricky part_. Two icons are used to display the door's status - one for if it is closed, and one for if it is open. This will look _great_ in our application, but is a bit tricky to implement as you will need to build some code to show one icon at a time.

- **Add two image elements** to the Application Workspace
- **Name the first image element ImageDoorOpen**
- Underneath Image, **click Browse**.
- From the files you downloaded earlier, **select Door-Open.png**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/140/medium640/sensors_DigiKey_IoT.png?1574897029)

In the Application Builder Workspace, **bring the door open image to the front of the application** and **move it to the bottom right of the application's interface**.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/141/medium640/sensors_DigiKey_IoT.png?1574897143)

- **Click the second image element** on the workspace.
- From the Image Element's properties, **name the element**  **ImageDoorClosed**
- **Click the Browse button**
- From the files you downloaded earlier, **select** &nbsp; **Door-Closed.png**

![sensors_DigiKey_IoT_(6).png](https://cdn-learn.adafruit.com/assets/assets/000/085/261/medium640/sensors_DigiKey_IoT_%286%29.png?1575386242)

In the Application Builder Workspace, **bring the door closed image to the front of the application** and **move it to the bottom right of the application's interface**. It should overlap the door open image.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/262/medium640/sensors_DigiKey_IoT.png?1575386336)

Let's set up the condition element to selectively show and hide images based on the state of the door.

- From the Workspace, **click the Condition Element.&nbsp;**
- Under triggers, **select Condition True**
- **Add a new connector** between the Condition Element and ImageDoorOpen
- **Change the ability of the connector** to **Show**
- **Add a new connector** between the Condition Element and ImageDoorClosed
- **Change the ability of the connector** to **Hide**

Now, let's set up the condition element for the opposite condition.

- Under triggers, **select Condition False**
- **Add a new connector** between the Condition Element and ImageDoorClosed
- **Change the ability of the connector** to **Show**
- **Add a new connector** between the Condition Element and ImageDoorOpen
- **Change the ability of the connector** to **Hide**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/263/medium640/sensors_DigiKey_IoT.png?1575386493)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/264/medium640/sensors_DigiKey_IoT.png?1575386883)

# Code Usage

**Compile** the project. Then, **upload the project to the Feather HUZZAH32**.

Open the door on your IoT Home. You should hear a loud _BEEEEEEP_ from the buzzer. The icon on the mobile application should show the door's state.&nbsp;

Closing the door on your IoT Home should turn off the buzzer. The icon on the mobile application should display the door's status.

![](https://cdn-learn.adafruit.com/assets/assets/000/085/278/medium800thumb/sensors_ezgif.com-video-to-gif_%283%29.jpg?1575409854)

# Digi-Key IoT Studio Mini Smart Home

## Dashboards

Danger: 

Now that data is streaming into both your device over Bluetooth and it's connected to Digi-Key IoT Cloud Storage, you can now visualize our home's data in _real-time_. While you _could_ use an API or framework to display this data, there's an even simpler way.

**Digi-Key IoT Studio** is an all-in-one solution and **includes a Dashboard front-end**. You're going to build a dashboard to help visualize the sensors in your home over time. Just like before, **there's no programming**. You'll **drag and drop widgets to create a dashboard**.

As mentioned before, IoT Studio provides 10.49MB of data per-device. You can verify how much data your device is using by navigating to the device panel.

Before jumping into building a dashboard, it's important to know where our data is located. IoT Studio provides 10.49MB of data per-device, for up to 5 devices.

To verify how much data your IoT Home is using,&nbsp;

- **Navigate** to the Device Manager
- From the Device Manager, **click the IoT Home device**.
- **Click Storage** from the device to navigate to the device storage page.

The storage page will display how much data your device uses and which database its stored on. Data is stored in the CloudStorage element you created in the _Monitoring your Home_ page.

You may also download or delete all your device's data at any point. Also, you may verify how much data your device is using by navigating to the device panel.

![sensors_Cursor_and_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/273/medium640/sensors_Cursor_and_DigiKey_IoT.png?1575405757)

![sensors_Cursor_and_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/274/medium640/sensors_Cursor_and_DigiKey_IoT.png?1575405802)

![sensors_Cursor_and_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/275/medium640/sensors_Cursor_and_DigiKey_IoT.png?1575405985)

# Step-by-Step: Building a Dashboard

Digi-Key IoT Studio's Dashboard "allows you to display your devices data through a variety of widgets". **Widgets** are visual components that allow you to display device data in different forms. There are widgets for displaying data as a gauge, a text block, a graph, or even as a pie chart.

Let's start by adding a gauge widget to display the temperature from the ADT7410 temperature sensor in the IoT Home.

- From Digi-Key IoT Studio, **navigate to the Dashboard page**.
- **Click the Gear button** on the right-hand side of the page to bring up the configuration menu.
- **Click the Data Gauge** widget.

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/081/medium640/sensors_DigiKey_IoT.png?1574881831)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/082/medium640/sensors_DigiKey_IoT.png?1574881937)

A new Data Gauge widget will appear on your dashboard.&nbsp;

- **Click the ... button** to bring up a dropdown for configuring its settings.
- **Click Settings** to bring up the widget's properties&nbsp;

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/083/medium640/sensors_DigiKey_IoT.png?1574882523)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/084/medium640/sensors_DigiKey_IoT.png?1574882586)

In the widget's properties window,

- **Change the title** to **Data Gauge - Temperature**
- **Change the unit** to **degrees C**
- **Change the number of decimal places** to **2**
- Under Data Source, **click Select**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/085/medium640/sensors_DigiKey_IoT.png?1574882787)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/086/medium640/sensors_DigiKey_IoT.png?1574882890)

- **Select IoT Home** as the device
- **Select CloudStorage** as the Cloud Storage Provider
- **Select Temperature** as the value&nbsp;
- **Click Confirm&nbsp;** to configure the data source.
- Then, **click Save**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/087/medium640/sensors_DigiKey_IoT.png?1574882944)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/088/medium640/sensors_DigiKey_IoT.png?1574882990)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/089/medium640/sensors_DigiKey_IoT.png?1574883008)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/090/medium640/sensors_DigiKey_IoT.png?1574883073)

The gauge will automatically appear and the needle will move, reflecting the value read by your temperature sensor.

![](https://cdn-learn.adafruit.com/assets/assets/000/085/091/medium800/sensors_DigiKey_IoT.png?1574883141)

Let's add another element type to display the resistance of the gas sensor.

- From the Configure Dashboard menu, **select the Data Glance widget**.
- **Click the ... button** &nbsp;to bring up a dropdown for configuring it settings.
- **Click Settings** &nbsp;

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/095/medium640/sensors_DigiKey_IoT.png?1574887548)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/097/medium640/sensors_DigiKey_IoT.png?1574887770)

- **Change the title** to Data Glance - Gas
- **Change the unit** to ohms
- **Change the icon** to reflect what is being measured measuring. In this case, it's the air quality.
- You may also optionally change the update interval, ranging from 1 to 30 seconds.
- Under data source, **click select**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/105/medium640/sensors_DigiKey_IoT.png?1574888924)

- Under Select Device, **click IoT Home**
- Under Select Cloud Storage, **click CloudStorage**
- Under Select Value, **click gas (string)**
- **Click Save**

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/099/medium640/sensors_DigiKey_IoT.png?1574888011)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/100/medium640/sensors_DigiKey_IoT.png?1574888028)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/101/medium640/sensors_DigiKey_IoT.png?1574888059)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/102/medium640/sensors_DigiKey_IoT.png?1574888083)

The data glance widget should populate with the IoT Home's gas reading.

![](https://cdn-learn.adafruit.com/assets/assets/000/085/106/medium800/sensors_DigiKey_IoT.png?1574888982)

Let's complete this dashboard by adding a second Data Glance widget to display the relative humidity in the IoT Home.

- **Add a Data Glance Widget&nbsp;** to your dashboard
- In the Data Glance configuration, **change the title to Data Glance - Humidity&nbsp;**
- **Change the unit** to **%RH**
- **Change the icon** to **Humidity&nbsp;**
- **Set the data source** to **humid**
- **Click Save**

![sensors_DigiKey_IoT_(5).png](https://cdn-learn.adafruit.com/assets/assets/000/085/107/medium640/sensors_DigiKey_IoT_%285%29.png?1574889373)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/108/medium640/sensors_DigiKey_IoT.png?1574889438)

![sensors_DigiKey_IoT.png](https://cdn-learn.adafruit.com/assets/assets/000/085/109/medium640/sensors_DigiKey_IoT.png?1574889447)

You've successfully created a dashboard to display data about your IoT Home's sensors! You can view this dashboard on any web browser or mobile device, from anywhere in the world.

![](https://cdn-learn.adafruit.com/assets/assets/000/085/111/medium800/sensors_dash.png?1574890804)

For more information about the DK IoT Studio Dashboard and its elements, [visit the developer documentation pages](https://developer.atmosphereiot.com/documents/viewingdevicedata/configuringthedashboard.html).

# Digi-Key IoT Studio Mini Smart Home

## Conclusion

Danger: 

We've created a complete home automation system with our IoT Studio Kit - but why stop there? You can take this project further by utilizing the kit's Feather Huzzah and sensors in the real world. [For example - we have a guide about using a Huzzah with the door sensor included in the kit to text you when a door in your home has been opened](https://learn.adafruit.com/using-ifttt-with-adafruit-io).

**It’s never been a better time to play with IoT** - there are so many protocols, boards and sensors available. What only a few decades ago was literally space-age technology is now only a few cents on [Digi-Key's website](http://digikey.com/).

Even though this series is over - _we’re not saying good-bye forever_. There’s a wealth of resources on Adafruit, [from the thousands of tutorials on the learning system](https://learn.adafruit.com/), to [our hundreds of Python and Arduino libraries, all free for you to use](https://github.com/adafruit). [Digi-Key has all the newest tools and parts](https://www.digikey.com/), with links to app notes, CAD files and engineering resources when you’re ready to go to production.

And if you’re still in the prototyping phase, [check out all the Adafruit breakout boards and Feathers that Digi-Key stocks, they’re a great match for IoT Studio](https://www.digikey.com/en/supplier-centers/a/adafruit) - **you could order this evening and get started by tomorrow!**


## Featured Products

### Smart Home Kit  for Digi-Key IoT Studio - Feather ESP32 + Parts

[Smart Home Kit  for Digi-Key IoT Studio - Feather ESP32 + Parts](https://www.adafruit.com/product/4450)
Discontinued - [**you can grab&nbsp;** Huzzah! Adafruit.io Internet of Things Feather ESP8266 - WiFi Starter Kit **instead!&nbsp;**](http://www.adafruit.com/product/2680)

&nbsp;

Automate your own adorable, IoT-enabled papier-mâché...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/4450)
[Related Guides to the Product](https://learn.adafruit.com/products/4450/guides)
### Assembled Adafruit HUZZAH32 – ESP32 Feather Board

[Assembled Adafruit HUZZAH32 – ESP32 Feather Board](https://www.adafruit.com/product/3619)
Aww yeah, it's the Feather you have been waiting for, and now with **stacking headers**! The **HUZZAH32** is our ESP32-based Feather, made with the official WROOM32 module. We packed everything you love about Feathers: built in USB-to-Serial converter, automatic...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3619)
[Related Guides to the Product](https://learn.adafruit.com/products/3619/guides)
### Adafruit Quad 2x2 FeatherWing Kit with Headers

[Adafruit Quad 2x2 FeatherWing Kit with Headers](https://www.adafruit.com/product/4253)
This is the **FeatherWing Quad 2x2** - a prototyping add-on and more for all Feather boards. This is similar to our [FeatherWing Proto](https://www.adafruit.com/products/2884) except there are four! The magic of the Quad comes when you want to connect your Feather to...

In Stock
[Buy Now](https://www.adafruit.com/product/4253)
[Related Guides to the Product](https://learn.adafruit.com/products/4253/guides)
### Adafruit ADXL343 + ADT7410 Sensor FeatherWing

[Adafruit ADXL343 + ADT7410 Sensor FeatherWing](https://www.adafruit.com/product/4147)
Upgrade any Feather board with motion and precision temperature sensing, with this all-in-one sensing FeatherWing. It sports two fantastic sensors from Analog Devices: an ADXL343 triple-axis accelerometer and an ADT7410 precision temperature sensor.

Both sensors are connected over the...

In Stock
[Buy Now](https://www.adafruit.com/product/4147)
[Related Guides to the Product](https://learn.adafruit.com/products/4147/guides)
### Adafruit Non-Latching Mini Relay FeatherWing

[Adafruit Non-Latching Mini Relay FeatherWing](https://www.adafruit.com/product/2895)
A Feather board without ambition is a Feather board without FeatherWings! This is&nbsp;the **Non-Latching Mini Relay FeatherWing**.&nbsp;It gives you power to control, and control over power. Put simply, you can now turn on and off lamps, fans, solenoids, and other small...

In Stock
[Buy Now](https://www.adafruit.com/product/2895)
[Related Guides to the Product](https://learn.adafruit.com/products/2895/guides)
### Adafruit BME680 - Temperature, Humidity, Pressure and Gas Sensor

[Adafruit BME680 - Temperature, Humidity, Pressure and Gas Sensor](https://www.adafruit.com/product/3660)
The long awaited BME680 from Bosch gives you&nbsp;_all the environmental sensing you want_&nbsp;in one small package. This little sensor contains&nbsp; **temperature** ,&nbsp; **humidity** ,&nbsp; **barometric pressure,** &nbsp;and&nbsp; **VOC...**

In Stock
[Buy Now](https://www.adafruit.com/product/3660)
[Related Guides to the Product](https://learn.adafruit.com/products/3660/guides)
### Magnetic contact switch (door sensor)

[Magnetic contact switch (door sensor)](https://www.adafruit.com/product/375)
This sensor is essentially a reed switch, encased in an ABS plastic shell. Normally the reed is 'open' (no connection between the two wires). The other half is a magnet. When the magnet is less than 13mm (0.5") away, the reed switch closes. They're often used to detect when a...

In Stock
[Buy Now](https://www.adafruit.com/product/375)
[Related Guides to the Product](https://learn.adafruit.com/products/375/guides)
### CD DVD Spindle Motor

[CD DVD Spindle Motor](https://www.adafruit.com/product/3882)
What's this? A record player for _ants_?? Not at all! This is a **DVD/CD Spindle Motor** , that thing that's inside a CD or DVD player, that turns the disc around really fast. These motors have some great benefits that make them <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/3882)
[Related Guides to the Product](https://learn.adafruit.com/products/3882/guides)

## Related Guides

- [Adafruit HUZZAH32 - ESP32 Feather](https://learn.adafruit.com/adafruit-huzzah32-esp32-feather.md)
- [Adafruit BME680](https://learn.adafruit.com/adafruit-bme680-humidity-temperature-barometic-pressure-voc-gas.md)
- [Adafruit ADXL343 + ADT7410 Sensor FeatherWing](https://learn.adafruit.com/adxl343-adt7410-sensor-featherwing.md)
- [USB MIDI Host Messenger](https://learn.adafruit.com/usb-midi-host-messenger.md)
- [Mini Relay FeatherWings](https://learn.adafruit.com/mini-relay-featherwings.md)
- [IoT Motion and Temperature Logger with the Analog Devices ADXL343 + ADT7410 Sensor FeatherWing and Adafruit IO](https://learn.adafruit.com/iot-motion-and-temperature-sensor-with-adxl343-adt7410-sensor-featherwing-and-adafruit-io.md)
- [Easy Alexa (Echo) Control of your ESP8266 Huzzah](https://learn.adafruit.com/easy-alexa-or-echo-control-of-your-esp8266-huzzah.md)
- [Air Quality Sensor 3D Printed Enclosure](https://learn.adafruit.com/air-quality-sensor-silo-house.md)
- [OpenClaw on Raspberry Pi](https://learn.adafruit.com/openclaw-on-raspberry-pi.md)
- [Pet Bowl Water Level Sensing](https://learn.adafruit.com/pet-bowl-water-level-sensing-with-the-funhouse-and-home-assistant.md)
- [Digital Egg Drop Experiment with CLUE](https://learn.adafruit.com/egg-drop-clue.md)
- [League of Legends Level Trophy for PyPortal](https://learn.adafruit.com/league-of-legends-level-trophy-for-pyportal.md)
- [How to Scan and Detect I2C Addresses](https://learn.adafruit.com/scanning-i2c-addresses.md)
- [Adafruit FunHouse](https://learn.adafruit.com/adafruit-funhouse.md)
- [Adafruit SensorLab - Magnetometer Calibration](https://learn.adafruit.com/adafruit-sensorlab-magnetometer-calibration.md)
- [Adafruit Simple Soil Moisture Sensor](https://learn.adafruit.com/adafruit-simple-soil-moisture-sensor.md)
