# Adafruit IO Basics: Temperature & Humidity

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/039/494/medium800/weather_io_temp.jpg?1487618718)

This guide is part of a series of guides that cover the basics of using Adafruit IO. It will show you how to send temperature and humidity values wirelessly to Adafruit IO from a DHT22 sensor.

If you haven't worked your way through the Adafruit IO feed and dashboard basics guides, you should do that before continuing with this guide so you have a basic understanding of Adafruit IO.

* [Adafruit IO Basics: Feeds](../../../adafruit-io-basics-feeds)
* [Adafruit IO Basics: Dashboards](../../../adafruit-io-basics-dashboards) 

You should go through the setup guides associated with your selected set of hardware, and make sure you have internet connectivity with the device before continuing. The following links will take you to the guides for your selected platform.

* [Adafruit Feather HUZZAH ESP8266 Setup Guide](../../../../adafruit-io-basics-esp8266-arduino)

If you have went through all of the prerequisites for your selected hardware, you are now ready to move on to the Adafruit IO setup steps that are common between all of the hardware choices for this project. Let's get started!

# Adafruit IO Basics: Temperature & Humidity

## Adafruit IO Setup

The first thing you will need to do is to login to [Adafruit IO](https://io.adafruit.com) and visit the **Settings** page.

Click the **VIEW AIO KEY** button to retrieve your key.



![](https://cdn-learn.adafruit.com/assets/assets/000/061/281/medium800/adafruit_io_sensors_io-active-key_%281%29.png?1536442200)

A window will pop up with your Adafruit IO. Keep a copy of this in a safe place. We'll need it later.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/480/medium800/weather_01_key.png?1487609654)

## Creating the Feeds

First, you will need to create a&nbsp;feed called **Temperature.** &nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/039/481/medium800/weather_Screen_Shot_2017-02-20_at_11.55.45_AM.png?1487610143)

You will also need to create a feed called **Humidity**.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/482/medium800/weather_Screen_Shot_2017-02-20_at_11.56.11_AM.png?1487610192)

If you need help getting started with creating feeds on Adafruit IO, check out the&nbsp;[Adafruit IO Feed Basics&nbsp;guide](../../../../adafruit-io-basics-feeds).

## Adding the Line Chart&nbsp;Block

Add a new Line Chart&nbsp;block to a new or existing dashboard. Make sure you have selected both the **_Temperature_** and **_Humidity_** &nbsp;feeds as the data sources for the block.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/483/medium800/weather_Screen_Shot_2017-02-20_at_12.00.54_PM.png?1487610350)

When you reach the block settings, set the Hours of History setting to 24 hours, and name the block whatever you would like.

When you are finished editing the form, click _Create Block_ to add the new block to the dashboard.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/484/medium800/weather_Screen_Shot_2017-02-20_at_12.01.31_PM.png?1487610536)

If you need help getting started with Dashboards on Adafruit IO, check out the&nbsp;[Adafruit IO Dashboard Basics guide](../../../../adafruit-io-basics-dashboards).

Next, we will look at wiring the circuit.

# Adafruit IO Basics: Temperature & Humidity

## Arduino Wiring

You will need the following parts for this tutorial:

* **1x** Adafruit IO compatible Feather
* **1x** DH22 temperature &amp; humidity sensor 
* **1x** 10k ohm resistor
* **4x** jumper wires

![](https://cdn-learn.adafruit.com/assets/assets/000/039/485/medium800/weather_dht22_fritzing.png?1487612855)

We will need to connect the following pins from the Feather to the resistor and DHT22:

\* **Feather**  **3V** to **Pin 1** of the DHT22  
\* **Feather 3V** to one leg of **a 10k ohm resistor** , and **the other leg of the resistor** to **Pin 2** of the DHT22  
\* **Feather Pin 2** to **Pin 2** of the DHT22   
\* **Feather GND** to **Pin 4** of the DHT22

# Adafruit IO Basics: Temperature & Humidity

## Arduino Setup

You should go through the setup guides associated with your selected set of hardware, and make sure you have internet connectivity with the device before continuing. The following links will take you to the guides for your selected platform.

* [Adafruit Feather HUZZAH ESP8266 Setup Guide](https://learn.adafruit.com/adafruit-io-basics-esp8266-arduino/arduino-io-library#install-the-required-libraries-4-1)

You will need to make sure you have at least **version 2.4.1** of the Adafruit IO Arduino library installed before continuing.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/486/medium800/weather_Screen_Shot_2017-02-20_at_12.58.26_PM.png?1487613533)

You will also need to install the **Adafruit Unified Sensor** library.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/491/medium800/weather_unified_lib.png?1487614421)

As well as the **DHT Sensor Library**.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/490/medium800/weather_Screen_Shot_2017-02-20_at_1.06.56_PM.png?1487614354)

For this example, you will need to open the **adafruitio\_15\_temp_humidity** example in the **Adafruit IO Arduino** library.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/488/medium800/weather_Screen_Shot_2017-02-20_at_12.56.59_PM.png?1487613611)

Next, we will look at the network configuration options in the sketch.

# Adafruit IO Basics: Temperature & Humidity

## Arduino Network Config

To configure the network settings, click on the **config.h** tab in the sketch. You will need to set your Adafruit IO username in the **IO_USERNAME** define, and your Adafruit IO key in the **IO_KEY** define.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/317/medium800/adafruit_io_03_config.png?1487185264)

## WiFi Config

WiFi is enabled by default in **config.h** so if you are using one of the supported WiFi boards, you will only need to modify the **WIFI_SSID** and **WIFI_PASS** options in the **config.h** tab.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/318/medium800/adafruit_io_04_wifi.png?1487185900)

## FONA Config

If you wish to use the FONA 32u4 Feather to connect to Adafruit IO, you will need to first comment out the WiFi support in **config.h**

![](https://cdn-learn.adafruit.com/assets/assets/000/039/319/medium800/adafruit_io_05_wifi_disable.png?1487186164)

Next, remove the comments from both of the FONA config lines in the FONA section of **config.h** to enable FONA support.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/320/medium800/adafruit_io_06_fona.png?1487186409)

## Ethernet Config

If you wish to use the Ethernet Wing to connect to Adafruit IO, you will need to first comment out the WiFi support in **config.h**

![](https://cdn-learn.adafruit.com/assets/assets/000/039/321/medium800/adafruit_io_05_wifi_disable.png?1487186577)

Next, remove the comments from both of the Ethernet config lines in the Ethernet section of **config.h** to enable Ethernet Wing support.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/322/medium800/adafruit_io_07_ethernet.png?1487186729)

Next, we will look at how the example sketch works.

# Adafruit IO Basics: Temperature & Humidity

## Arduino Code

The **adafruitio\_15\_temp_humidity** example uses digital pin **2** by default on all boards, and that can be modified if needed by changing the **DATA_PIN** define. 

```auto
// pin connected to DH22 data line
#define DATA_PIN 2
```

The next chunk of code creates an instance of the DHT class, and also sets up feed instances for the **temperature** and **humidity** feeds.

```auto
// create DHT22 instance
DHT_Unified dht(DATA_PIN, DHT22);

// set up the 'temperature' and 'humidity' feeds
AdafruitIO_Feed *temperature = io.feed("temperature");
AdafruitIO_Feed *humidity = io.feed("humidity");
```

The setup function initializes the **DHT22** sensor, and also connects your feather to Adafruit IO.  The code will wait until you have a valid connection to Adafruit IO before continuing with the sketch. If you have any issues connecting, check **config.h** for any typos in your username or key.

```auto
void setup() {

  // start the serial connection
  Serial.begin(115200);

  // wait for serial monitor to open
  while(! Serial);

  // initialize dht22
  dht.begin();

  // connect to io.adafruit.com
  Serial.print("Connecting to Adafruit IO");
  io.connect();

  // wait for a connection
  while(io.status() &lt; AIO_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

  // we are connected
  Serial.println();
  Serial.println(io.statusText());

}
```

Next, we have the main `loop()` function. The first line of the loop function calls `io.run();` this line will need to be present at the top of your loop in every sketch. It helps keep your device connected to Adafruit IO, and processes any incoming data.

```auto
void loop() {

  // io.run(); is required for all sketches.
  // it should always be present at the top of your loop
  // function. it keeps the client connected to
  // io.adafruit.com, and processes any incoming data.
  io.run();
```

The next chunk of code inside the **loop()** checks the current DHT22 temperature value, and saves the value in the **celsius** and **fahrenheit** variables.

We then print both celsius and fahrenheit to the Arduino Serial Monitor, and save the fahrenheit value to the **temperature** feed on Adafruit IO. 

```auto
  sensors_event_t event;
  dht.temperature().getEvent(&amp;event);

  float celsius = event.temperature;
  float fahrenheit = (celsius * 1.8) + 32;

  Serial.print("celsius: ");
  Serial.print(celsius);
  Serial.println("C");

  Serial.print("fahrenheit: ");
  Serial.print(fahrenheit);
  Serial.println("F");

  // save fahrenheit (or celsius) to Adafruit IO
  temperature-&gt;save(fahrenheit);
```

If you prefer to log **celsius** values, you can modify the call to the **save()** function.

```auto
temperature-&gt;save(celsius);
```

The final chunk of the `loop()` function requests a humidity reading from the DHT22, and prints the value to the Arduino Serial Monitor. We also save the humidity value to the humidity feed on Adafruit IO.

```auto
  dht.humidity().getEvent(&amp;event);

  Serial.print("humidity: ");
  Serial.print(event.relative_humidity);
  Serial.println("%");

  // save humidity to Adafruit IO
  humidity-&gt;save(event.relative_humidity);

  // wait 5 seconds (5000 milliseconds == 5 seconds)
  delay(5000);

}
```

Upload the sketch to your board, and open the Arduino Serial Monitor. Your board should now connect to Adafruit IO.

```auto
Connecting to Adafruit IO....

Adafruit IO connected.
```

You should now see the temperature and humidity values being sent to Adafruit IO.

```auto
celsius: 18.30C
fahrenheit: 64.94F
humidity: 34.90%
  
celsius: 18.20C
fahrenheit: 64.76F
humidity: 35.40%
```

Check your dashboard on Adafruit IO, and you should see the line chart update with the changes in temperature and humidity.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/492/medium800/weather_Screen_Shot_2017-02-20_at_1.31.04_PM.png?1487615510)

# Adafruit IO Basics: Temperature & Humidity

## Add an OLED

![](https://cdn-learn.adafruit.com/assets/assets/000/040/489/medium800/adafruit_io_OLED_video_demo_screenshot_01_ORIG.jpg?1490803522)

Now that you've got a graphing weather device using IO, you can add an OLED feather so you can see network status, IP address, and the latest measurements!

Plug the OLED FeatherWing on top of your Feather, and [check out our guide to get set up and test it](../../../../adafruit-oled-featherwing)! Once you've verified that the OLED works, you can use this new code. Use the same `config.h` file from the previous section, just replace the 'main' tab of code:

Warning: 

```auto
// Adafruit IO Temperature &amp; Humidity Example
// Tutorial Link: https://learn.adafruit.com/adafruit-io-basics-temperature-and-humidity
//
// Adafruit invests time and resources providing this open source code.
// Please support Adafruit and open source hardware by purchasing
// products from Adafruit!
//
// Written by Todd Treece for Adafruit Industries
// Copyright (c) 2016-2017 Adafruit Industries
// Licensed under the MIT license.
//
// All text above must be included in any redistribution.

/************************** Configuration ***********************************/

// edit the config.h tab and enter your Adafruit IO credentials
// and any additional configuration needed for WiFi, cellular,
// or ethernet clients.
#include "config.h"

/************************ Example Starts Here *******************************/
#include &lt;Adafruit_Sensor.h&gt;
#include &lt;DHT.h&gt;
#include &lt;DHT_U.h&gt;
#include &lt;Adafruit_SSD1306.h&gt;

// oled display
Adafruit_SSD1306 oled = Adafruit_SSD1306(128, 32, &amp;Wire);

// pin connected to DH22 data line
#define DATA_PIN 2

// create DHT22 instance
DHT_Unified dht(DATA_PIN, DHT22);

// set up the 'temperature' and 'humidity' feeds
AdafruitIO_Feed *temperature = io.feed("temperature");
AdafruitIO_Feed *humidity = io.feed("humidity");

void setup() {
  oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)
  oled.display();

  // start the serial connection
  Serial.begin(115200);

  // wait for serial monitor to open
  while(! Serial);

  // initialize dht22
  dht.begin();

  // connect to io.adafruit.com
  Serial.print("Connecting to Adafruit IO");
  io.connect();

  // wait for a connection
  while(io.status() &lt; AIO_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

  // we are connected
  Serial.println();
  Serial.println(io.statusText());

  // text display tests
  oled.setTextSize(1);
  oled.setTextColor(WHITE);
}

void loop() {

  // io.run(); is required for all sketches.
  // it should always be present at the top of your loop
  // function. it keeps the client connected to
  // io.adafruit.com, and processes any incoming data.
  io.run();

  sensors_event_t event;
  dht.temperature().getEvent(&amp;event);

  float celsius = event.temperature;
  float fahrenheit = (celsius * 1.8) + 32;

  Serial.print("celsius: ");
  Serial.print(celsius);
  Serial.println("C");

  Serial.print("fahrenheit: ");
  Serial.print(fahrenheit);
  Serial.println("F");

  // save fahrenheit (or celsius) to Adafruit IO
  temperature-&gt;save(fahrenheit);

  dht.humidity().getEvent(&amp;event);
   
  Serial.print("humidity: ");
  Serial.print(event.relative_humidity);
  Serial.println("%");

  // save humidity to Adafruit IO
  humidity-&gt;save(event.relative_humidity);

  // print it to the OLED
  oled.clearDisplay();
  oled.setCursor(0,0);
  oled.print("SSID: "); oled.println(WIFI_SSID);
  oled.print("IP: "); oled.println(WiFi.localIP());
  oled.print("Temp: "); oled.print(fahrenheit,0); oled.print(" *F ");
  oled.print("Hum: "); oled.print(event.relative_humidity,0); oled.println(" %");
  oled.print("IO Status: ");
  aio_status_t aio_status = io.status();
  Serial.print("Status: "); Serial.println(aio_status);
  switch (aio_status) {
     case AIO_IDLE:  oled.println("IDLE"); break;
     case AIO_DISCONNECTED:
     case AIO_NET_DISCONNECTED:  oled.println("DISCONNECT"); break;
     case AIO_NET_CONNECTED:
     case AIO_CONNECTED_INSECURE:
     case AIO_CONNECTED: oled.println("CONNECTED"); break;
  }
  oled.display();

  // wait 5 seconds (5000 milliseconds == 5 seconds)
  delay(2000);
}
```

# Adafruit IO Basics: Temperature & Humidity

## Python Wiring

We're going to use a combination of the Adafruit IO Client Library and Adafruit's CircuitPython to control a Raspberry Pi over Adafruit IO.&nbsp;

## Parts
### Part: Raspberry Pi 3 - Model B+
quantity: 1
The Raspberry Pi is a small linux board compatible with Adafruit IO projects. 
[Raspberry Pi 3 - Model B+](https://www.adafruit.com/product/3775)

If you're following along with a&nbsp;[Raspberry Pi](https://www.adafruit.com/category/105), we're going to use a T-Cobbler Plus for the IO Basics Projects. This add-on prototyping board lets you easily connect a Raspberry Pi (Raspberry Pi Model Zero, A+, B+, Pi 2, Pi 3) to a solderless breadboard:

### Assembled Pi T-Cobbler Plus - GPIO Breakout

[Assembled Pi T-Cobbler Plus - GPIO Breakout](https://www.adafruit.com/product/2028)
 **This is the assembled version of the Pi T-Cobbler Plus. &nbsp;It only works with the Raspberry Pi Model Zero, A+, B+, Pi 2, Pi 3, Pi 4, and Pi 5!** (Any Pi with 2x20 connector)  
  
The Raspberry Pi has landed on the Maker World like a 40-GPIO pinned, quad-USB ported,...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2028)
[Related Guides to the Product](https://learn.adafruit.com/products/2028/guides)
![Angled shot of Assembled Pi T-Cobbler Plus next to GPIO ribbon cable](https://cdn-shop.adafruit.com/640x480/2028-07.jpg)

We'll also need a temperature and humidity sensor. The DHT22 is a low-cost temperature and humidity sensor which is easy to wire up. You'll also need a 10k ohm resistor.&nbsp;

## Wiring
![](https://cdn-learn.adafruit.com/assets/assets/000/058/802/medium800/adafruit_io_temp-humid-resized.png?1533843271)

Make the following connections between the Pi and the DHT22:

- **Pi 3.3V** to **DHT Pin 1**
- **Pi Digital Pin 26&nbsp;** to&nbsp; **DHT Pin 2**
- **Pi GND&nbsp;** to&nbsp; **DHT Pin 4**
- **10k ohm resistor** (_left pin)_&nbsp;to **DHT Pin 2**
- **10k ohm resistor&nbsp;** (_right pin)_&nbsp;to **GND**

# Adafruit IO Basics: Temperature & Humidity

## Python Setup

If you've been following along with the **IO Basics: Python&nbsp;** guides, we are not using Adafruit Blinka for this specific tutorial. Blinka doesn't have a special timing module called&nbsp;_pulseio_ ( **yet!** ).&nbsp;

Instead, we are going to use the Adafruit Python DHT Sensor Library and the Adafruit IO Python Client Library.

Warning: 

## Update your Pi and Python

We'll assume you've already gotten your Raspberry Pi up and running and can log into the command line.

Go ahead and **ssh** into your Raspberry Pi via terminal or a ssh client:

`ssh pi@raspberrypi.local`

Run the standard updates:

`sudo apt-get update`

`sudo apt-get upgrade`

and

`sudo pip3 install --upgrade setuptools`

## Make sure you're using Python 3!

The default python on your computer may not be python 3. Python 2 is officially discontinued and all our libraries are Python 3 only.

We'll be using&nbsp;`python3`&nbsp;and&nbsp;`pip3`&nbsp;in our commands, use those versions of python and pip to make sure you're using 3 and not 2

## Installing Adafruit Python DHT Library

We're ready to install the [Adafruit Python DHT Library](https://github.com/adafruit/Adafruit_Python_DHT). This library will allow our Raspberry Pi to read the temperature and humidity values from the DHT22.&nbsp;We'll use `pip`&nbsp;to install the library from PyPi.&nbsp;

Enter the following in your terminal to install the Adafruit Python DHT Library:

`sudo pip3 install Adafruit_DHT`

## Installing Adafruit IO Python Library
![](https://cdn-learn.adafruit.com/assets/assets/000/058/800/medium800/adafruit_io_iopython_%281%29.png?1533838826)

We'll also need to install the [Adafruit IO Python Client Library](https://github.com/adafruit/io-client-python)&nbsp;to communicate with Adafruit IO.

Run the following command to install the **Adafruit IO Client for Python**** :**

`pip3 install adafruit-io`

Warning: 

## Downloading Example Code

The example code is contained within the Adafruit IO Python Client's&nbsp;_examples/basics_ subdirectory.

Navigate to the root directory of the Pi by entering the following in the terminal:

`cd ~`

Download the latest version of&nbsp;the Adafruit IO Python Client's GitHub repository by running

`git clone https://github.com/adafruit/io-client-python.git`

Navigate to the folder's example code for the examples

`cd io-client-python/examples/basics/`

# Adafruit IO Basics: Temperature & Humidity

## Python Code

The _temp\_humidity.py_ code uses Raspberry Pi GPIO Pin 26 by default. If you'd like to use a different pin, change the **DHT\_DATA\_PIN** variable.

`DHT_DATA_PIN = 26`

Before running, we'll need to set our Adafruit IO Key and Adafruit IO Username. You can find both of these on your [Adafruit IO profile page](https://io.adafruit.com/profile)

```auto
# Set to your Adafruit IO key.
# Remember, your key is a secret,
# so make sure not to publish it when you publish this code!
ADAFRUIT_IO_KEY = 'YOUR_AIO_KEY'

# Set to your Adafruit IO username.
# (go to https://accounts.adafruit.com to find your username).
ADAFRUIT_IO_USERNAME = 'YOUR_AIO_USERNAME'
```

The next chunk of code creates an instance of the Adafruit IO REST client, sets up the&nbsp; **temperature&nbsp;** and&nbsp; **humidity&nbsp;** feeds, and sets up the DHT22 sensor.&nbsp;&nbsp;

```auto
# Create an instance of the REST client.
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)

# Set up Adafruit IO Feeds.
temperature_feed = aio.feeds('temperature')
humidity_feed = aio.feeds('humidity')

# Set up DHT22 Sensor.
dht22_sensor = Adafruit_DHT.DHT22
```

in the `while True`&nbsp;loop, we first try to grab the humidity and sensor readings using `Adafruit_DHT.read_retry`&nbsp;which retries (up to 15 times) to get a sensor reading.

```auto
humidity, temperature = Adafruit_DHT.read_retry(sensor, DHT_DATA_PIN)
```

If the DHT sensor receives a reading, it'll print out both of the values and send them to the Adafruit IO temperature and humidity feeds.

```auto
print('Temp={0:0.1f}*C Humidity={1:0.1f}%'.format(temperature, humidity))
aio.send(temperature.key, temperature)
aio.send(humidity.key, humidity)
```

Sometimes you won't get a sensor reading and the results will be null (because Linux can't guarantee the timing of calls to read to the sensor). If that occurs, we'll print to the terminal. Then, we sleep for&nbsp; **DHT\_READ\_TIMEOUT&nbsp;** until the next read.

In your terminal, enter the following command to run the code:

`python3 temp_humidity.py`

You should now see the temperature and humidity values being sent to Adafruit IO.

```auto
Temp=25.5*C Humidity=59.1%
Temp=25.5*C Humidity=59.1%
Temp=25.5*C Humidity=59.1%
Temp=25.4*C Humidity=59.0%
```

Check your dashboard on Adafruit IO, and you should see the line chart update with the changes in temperature and humidity.

![](https://cdn-learn.adafruit.com/assets/assets/000/058/804/medium800/adafruit_io_weather_Screen_Shot_2017-02-20_at_1.31.04_PM.png?1533845600)

## Code
https://github.com/adafruit/io-client-python/blob/master/examples/basics/temp_humidity.py

# Adafruit IO Basics: Temperature & Humidity

## Adafruit IO FAQ

## Encountering an issue with your Adafruit IO Arduino Project?

If you're having an issue compiling, connecting, or troubleshooting your project, check this page first.

_Don't see your issue?_&nbsp;&nbsp;[Post up on the Adafruit IO Forum with your issue](https://forums.adafruit.com/viewforum.php?f=56).

### **I encounter the following error when compiling my sketch:**

**`  fatal error: Adafruit_MQTT.h: No such file or directory, `** `#include "Adafruit_MQTT.h"`

The Adafruit IO Arduino library is dependent on our Adafruit IO MQTT Library.

To resolve this error, from the Arduino IDE, navigate to the **Manage Libraries...** option in the **Sketch -\> Include Library** menu.

![adafruit_io_library_menu.png](https://cdn-learn.adafruit.com/assets/assets/000/065/260/medium640/adafruit_io_library_menu.png?1541529617)

To resolve this error, from the Arduino IDE, navigate to the **Manage Libraries...** option in the **Sketch -\> Include Library** menu.

![adafruit_io_mqtt_install.png](https://cdn-learn.adafruit.com/assets/assets/000/065/259/medium640/adafruit_io_mqtt_install.png?1541529632)

### 

Your board is not connecting to Adafruit IO, but why? Let's find out:

**First** , check in&nbsp;`config.h`&nbsp;that you have the correct&nbsp;`IO_USERNAME`,&nbsp;`IO_KEY`,&nbsp;`WIFI_SSID`, and&nbsp;`WIFI_PASS`&nbsp;are set correctly.&nbsp;

**Next** , we're going to modify the while loop which waits for an IO connection in your sketch. Change the line in the status check loop from&nbsp;`Serial.println(.);`to&nbsp;`Serial.println(io.statusText());`

`// wait for a connection`  
`while(io.status() < AIO_CONNECTED) {`  
`Serial.println(io.statusText());`  
`delay(500);`  
`}`

Verify and re-upload the sketch. If you're receiving a&nbsp; **Network disconnected&nbsp;** error message, the board is not able to talk to the internet. Re-check your hardware, connections, and router settings.&nbsp;

If it's still not showing&nbsp; **Adafruit IO connected** ,&nbsp;check the&nbsp;[IO status on the Adafruit Status page](https://status.adafruit.com/)&nbsp;to make sure the service is online.

### 

Possibly - you can check&nbsp;[IO status on the Adafruit Status page](https://status.adafruit.com/).&nbsp;

### 

There's a&nbsp;[monitor page built-into Adafruit IO](https://io.adafruit.com/monitor)&nbsp;which provides a live view of incoming data and error messages. Keep this page open while you send data to your Adafruit IO devices to monitor data and errors.&nbsp;


## Featured Products

### Huzzah! Adafruit.io Internet of Things Feather ESP8266

[Huzzah! Adafruit.io Internet of Things Feather ESP8266](https://www.adafruit.com/product/2680)
OK you've signed up for [Adafruit.io](http://adafruit.io/) and you're ready to build something cool and Internet-connected. All you need is this starter kit which will get you going with lots of parts that go very well with our service and are the most common sensors and...

In Stock
[Buy Now](https://www.adafruit.com/product/2680)
[Related Guides to the Product](https://learn.adafruit.com/products/2680/guides)
### AdaBox003 – The World of IoT – Curated by Digi-Key

[AdaBox003 – The World of IoT – Curated by Digi-Key](https://www.adafruit.com/product/3268)
**AdaBox003 –&nbsp;The World of IoT (Curated by Digi-Key)** is the perfect gift for folks who are just getting started in the world of DIY electronics. It's an excellent&nbsp;introduction to our wide world of the [Internet...](https://www.adafruit.com/category/342)

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/3268)
[Related Guides to the Product](https://learn.adafruit.com/products/3268/guides)
### Adafruit Feather HUZZAH with ESP8266 - Loose Headers

[Adafruit Feather HUZZAH with ESP8266 - Loose Headers](https://www.adafruit.com/product/2821)
Feather is the new development board from Adafruit, and like its namesake, it is thin, light, and lets you fly! We designed Feather to be a new standard for portable microcontroller cores.

This is the&nbsp; **Adafruit Feather HUZZAH ESP8266** &nbsp;- our take on an...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2821)
[Related Guides to the Product](https://learn.adafruit.com/products/2821/guides)
### DHT22  temperature-humidity sensor + extras

[DHT22  temperature-humidity sensor + extras](https://www.adafruit.com/product/385)
The DHT22 is a basic, low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air and spits out a digital signal on the data pin (no analog input pins needed). It's fairly simple to use but requires careful timing...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/385)
[Related Guides to the Product](https://learn.adafruit.com/products/385/guides)

## Related Guides

- [Adafruit Feather HUZZAH ESP8266](https://learn.adafruit.com/adafruit-feather-huzzah-esp8266.md)
- [MicroPython Basics: How to Load MicroPython on a Board](https://learn.adafruit.com/micropython-basics-how-to-load-micropython-on-a-board.md)
- [Adafruit IO Basics: Servo](https://learn.adafruit.com/adafruit-io-basics-servo.md)
- [Build a Cloud-Connected ESP8266 Power Meter](https://learn.adafruit.com/build-a-cloud-connected-esp8266-power-meter.md)
- [MQTT, Adafruit IO & You!](https://learn.adafruit.com/mqtt-adafruit-io-and-you.md)
- [Personalized NextBus ESP8266 Transit Clock](https://learn.adafruit.com/personalized-esp8266-transit-clock.md)
- [Mini Smart Home with Huzzah, HASSio and Crickit](https://learn.adafruit.com/mini-smart-home-with-esp8266-huzzah-feather-raspberry-pi-hassio-crickit.md)
- [Feather Weather Lamp](https://learn.adafruit.com/feather-weather-lamp.md)
- [CheerLights](https://learn.adafruit.com/cheerlights.md)
- [Automatic Twitch On-Air Sign](https://learn.adafruit.com/automatic-twitch-on-air-sign.md)
- [MicroPython Smart Holiday Lights](https://learn.adafruit.com/micropython-smart-holiday-lights.md)
- [Mystery Box: Haunted Radio](https://learn.adafruit.com/mystery-box-haunted-radio.md)
- [WiFi OLED Display Badge](https://learn.adafruit.com/digital-display-badge.md)
- [Adafruit IO Environmental Monitor for Feather or Raspberry Pi](https://learn.adafruit.com/adafruit-io-air-quality-monitor.md)
- [Desktop MQTT Client for Adafruit.io](https://learn.adafruit.com/desktop-mqtt-client-for-adafruit-io.md)
- [Hang out your washing reminder - Adafruit IO + Vibration switch](https://learn.adafruit.com/hang-out-your-washing-reminder-adafruit-io-vibration-switch.md)
