Apps and online services

About this project

Motivation

anduinoWiFi connected to DHT22(AM2302)

Have you heard? Adafruit offers this great free tool to visualize your Arduino's data in the cloud! Not only is it super easy to use, but it's free! Although Adafruit refers to it's current release as beta, we've had great success pairing it with anduino to create some interesting IoT devices. In this guide we'll walk you through getting your anduinoWiFi connected to Adafruit IO and displaying sensor readings! In this case we're going to use the DHT22 temperature sensor. Visualizing your apartment's temperature data in the cloud could be your first step in creating your own DIY Nest thermostat!

Getting Started

In order to upload to the cloud we're going to need to create an account on Adafruit IO! This way we'll have the necessary credentials for authenticating our anduino shield to speak to Adafruit's dashboard. Navigate to Adafruit IO and sign up to join the beta!

SIgn-up for Adafruit IO

Once you're profile is created you're going to want to jot down a couple important things about your profile. Navigate to settings and then click the button that says, 'View AIO Key'.

View AIO Key

A dialog will pop up revealing your AIO Key, copy, paste, keep this in a safe place, we're going to copy it over to our sketch in a moment. Also take note of your username, it should be displayed at the top of the screen adjacent to the /settings title.

yourUsername

Let's check out the sketch!

Anduino -> Adafruit IO

Clone, download the source, or copy and paste the Arduino sketch below into your IDE. There are a few required libraries we'll need to make sure you have downloaded and imported into your IDE before moving forward.

We also update anduino's LCD display with the latest reading each time around.

displayTemp(temp, tempPrev);

Note this sensor is also capable of reading humidity! Once you get this working it'll be fairly straight forward to uncomment some lines of code and create a new feed for your humidity readings as well!

Before you jump ahead and flash the sketch don't forget to fill in your specific WIFI_SSID, WIFI_PASS, your_IO_Username, and your_AIO_key.

The last part we'll need to edit is where we connect our DHT22 Temp sensor. There are two popular form factors, one which includes a pre-wired pull up resistor and one which requires you to wire in one yourself. Wire up ground, vcc, (3.3v on the Due and Zero) and the signal to a DIO pin.

Adafruit IO Dashboard

You're connected and streaming data, you should start to see data in your feed!

anduinoTemp Feed

Click Feeds, on the left hand side, and then select 'anduinoTemp'. Now that your feed is working, you can create a dashboard to display your temperature results.

Creating Dashboards in Adafruit IO

To create a new dashboard select 'Dashboards' on the left hand side toolbar, then click the 'Actions' drop down, and select 'Create a new Dashboard'. Give it a name and hit create! Choose which feed you'd like to access in this dashboard:

choose a feed

Select the anduinoTemp feed, next you should get to a blank dashboard. Now you can add in some display blocks. Click the blue '+' button on the top right to bring up this selector:

Choose a display block

I chose to create the data 'stream' and 'line chart'. Edit any details you'd like, and voilà!

Adafruit IO Dashbaord

What's next?

We mentioned the DHT22 can also give you humidity readings so a natural improvement could be updating the sketch/dashboards to include temperature and humidity. I'm planning on expanding on this write up in a new project to give some insight into another one of my favorite Adafruit IO features:

**For now barring a pull request I've just submitted to Adafruit you'll need to make this quick change in order for this to compile on the Due, otherwise with anduinoWiFi and the Zero things should work just fine "out of the box"**.