# Adafruit IO Basics: Analog Input

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/125/694/medium800thumb/adafruit_io_light_analog.jpg?1698761366)

_Send real-time analog sensor data from your project to Adafruit IO!_

This guide is part of a series of guides that cover the basics of using Adafruit IO. It will show you how to send analog values to Adafruit IO from a photocell.

Adafruit IO allows you to connect and interact with this project either by:

1. Programming a microcontroller, microcomputer, or desktop computer (configurable, and powerful, but requires coding skills)  
  
or  
  
2. Using our no-code "WipperSnapper" firmware (super fast! no coding! but only for some microcontroller boards)

## Option 1. Build and Program this project with Arduino or CPython

This guide contains instructions and code for building this project using&nbsp;Arduino, the Adafruit IO Arduino client library, and an Arduino-compatible board. We also include instructions for building this project using a Raspberry Pi and code for CPython (a.k.a desktop-computer Python).

## Option 2. No Code? No Problem! Build this guide using Adafruit IO and WipperSnapper!

With Adafruit IO, you can connect your devices without writing a single line of code using our custom WipperSnapper firmware. Load the WipperSnapper firmware onto your board, add credentials, and plug it into power. Your board will automatically register itself with your Adafruit IO account.

From there, you can add&nbsp;_components_&nbsp;to your board such as buttons, switches, potentiometers, sensors, and more! Components are&nbsp;_dynamically&nbsp;_added to hardware, so you can immediately start interacting, logging, and streaming the data your projects produce without writing code.

## Pre-Requisite Reading: Adafruit IO Basics

This guide is part of a series of guides that cover the basics of using Adafruit IO.&nbsp;If you haven't read 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 the core functionality of Adafruit IO.

### Adafruit IO Basics: Feeds

[Adafruit IO Basics: Feeds](https://learn.adafruit.com/adafruit-io-basics-feeds)
### Adafruit IO Basics: Dashboards

[Adafruit IO Basics: Dashboards](https://learn.adafruit.com/adafruit-io-basics-dashboards)
# Adafruit IO Basics: Analog Input

## 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/039/341/medium800/light_00_keyclick.png?1487254900)

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/342/medium800/light_01_key.png?1487254908)

## Creating the Analog&nbsp;Feed

Next, you will need to create a feed called **Analog**. 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).

![](https://cdn-learn.adafruit.com/assets/assets/000/039/344/medium800/light_Screen_Shot_2017-02-16_at_9.24.39_AM.png?1487255105)

## Adding the Gauge&nbsp;Block

Next, add a new Gauge&nbsp;block to a new or existing dashboard. Name the block whatever you would like, and _give it a **max&nbsp;value** of 1024 and a **min&nbsp;value** of 0_. Make sure you have selected the **Analog** &nbsp;feed as the data source for the gauge.

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

![](https://cdn-learn.adafruit.com/assets/assets/000/039/345/medium800/light_Screen_Shot_2017-02-16_at_9.23.05_AM.png?1487255128)

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/343/medium800/light_Screen_Shot_2017-02-16_at_9.23.38_AM.png?1487255044)

Next, we will look at&nbsp;wiring the circuit.

# Adafruit IO Basics: Analog Input

## Arduino

## Arduino IDE Setup

The following setup guide page will take you through configuring Arduino IDE for the Adafruit ESP32-S2 TFT Feather. Before continuing with this guide, ensure that you have tested connecting this board to your local WiFi network.

- If you are using a _different_ Arduino (or Arduino-compatible) board with this project, please follow the hardware-specific instructions to set up your hardware before continuing with this guide.

### Adafruit ESP32-S2 TFT Feather - Arduino IDE Setup

[Adafruit ESP32-S2 TFT Feather](https://learn.adafruit.com/adafruit-esp32-s2-tft-feather)
[Arduino IDE Setup](https://learn.adafruit.com/adafruit-esp32-s2-tft-feather/arduino-ide-setup)
The Adafruit IO Arduino library allows you to write Arduino code to interface with Adafruit IO.

To install the Adafruit IO Arduino library, open the Arduino IDE and navigate to the&nbsp; **Manage Libraries...** &nbsp;option in the&nbsp; **Sketch -\> Include Library** &nbsp;menu.

In the Library Manager, search for _Adafruit IO Arduino_

![](https://cdn-learn.adafruit.com/assets/assets/000/125/496/medium800/adafruit_io_Cursor_and_Library_Manager.png?1697807648)

The Library Manager will prompt you, asking you to install missing dependencies. **Click "Install All"**.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/497/medium800/adafruit_io_Cursor_and_Dependencies_for_library_Adafruit_IO_Arduino_4_2_9.png?1697807658)

## Get your Adafruit IO Username and Active Key

To connect your device to Adafruit IO, you will need your Adafruit IO credentials. To obtain these, navigate to [io.adafruit.com](https://io.adafruit.com/) and click the key icon on the header.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/498/medium800/adafruit_io_io_key_click.png?1697808685)

A pop-up should appear displaying your Adafruit IO username and active key. Keep these two credentials handy for the next step.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/499/medium800/adafruit_io_key.png?1697808763)

## Create Feed(s) for Project

Feeds are the core of the Adafruit IO system. A feed holds&nbsp; **data&nbsp;** and&nbsp; **meta-data** &nbsp;that you have sent to Adafruit IO.&nbsp;

For more information about feeds, visit the _Adafruit IO Basics: Feeds_ guide:

### Adafruit IO Basics: Feeds - Overview

[Adafruit IO Basics: Feeds](https://learn.adafruit.com/adafruit-io-basics-feeds)
[Overview](https://learn.adafruit.com/adafruit-io-basics-feeds/overview)
Creating a Feed on Adafruit IO is a very simple process. From any page on Adafruit IO, click on the&nbsp; **Feeds&nbsp;** link on the header.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/704/medium800/arduino_adafruit_io_IO_-_Overview_2.png?1698770389)

On the Feeds page, click the&nbsp; **New Feed&nbsp;** button.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/705/medium800/arduino_adafruit_io_IO_-_Feeds_new.png?1698770413)

A pop-up will appear, fill out the following name and description for this feed:

Name the feed&nbsp;_analog_ and optionally set its description. Click _Create_.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/730/medium800/adafruit_io_new-feed-analog.png?1698775011)

You'll see your new feed appear on the feed page, underneath the "Default" group.

# Adafruit IO Basics: Analog Input

## Wiring

## Parts

This example uses an Adafruit ESP32-S2 TFT Feather. This board is **perfect** for IoT projects!

This board has&nbsp;all the features of a Feather main board: the comforting warmth of an ESP32-S2 WiFi microcontroller, and the crispness of a 240x135 pixel color TFT display. This feather comes with native USB and&nbsp; **4 MB flash + 2 MB of PSRAM** , so it is perfect for use with CircuitPython, WipperSnapper, or Arduino with low-cost WiFi. Native USB means it can act like a keyboard or a disk drive. WiFi means it's awesome for IoT projects. And Feather means it works with the large community of Feather Wings for expandability.

### Adafruit ESP32-S2 TFT Feather - 4MB Flash, 2MB PSRAM, STEMMA QT

[Adafruit ESP32-S2 TFT Feather - 4MB Flash, 2MB PSRAM, STEMMA QT](https://www.adafruit.com/product/5300)
We've got a new machine here at Adafruit, it can uncover your deepest desires. Don't believe me? I'll turn it on right now to prove it to you! What, you want unlimited mozzarella sticks? OK well, that's not something we can provide. But we can provide your...

In Stock
[Buy Now](https://www.adafruit.com/product/5300)
[Related Guides to the Product](https://learn.adafruit.com/products/5300/guides)
![Adafruit ESP32-S2 TFT Feather powered on by a USB- C power source displaying the product tittle in a red, yellow, green, white and blue. ](https://cdn-shop.adafruit.com/640x480/5300-06.jpg)

However, you can use any Arduino-compatible hardware the Adafruit IO Arduino library. Platforms supported are: ESP8266, ESP32, ESP32-S2, ESP32-S3, ESP32-C3, RP2040 and SAMD51 + Airlift.

You will also need the following parts:

### Part: Photo Cell
quantity: 1
Photo cell (CdS photoresistor)
[Photo Cell](https://www.adafruit.com/product/161)

### Part: 10k Ohm Resistor (You'll need only one)
quantity: 1
Through-Hole Resistors - 10K ohm 5% 1/4W - Pack of 25
[10k Ohm Resistor (You'll need only one)](https://www.adafruit.com/product/2784)

### Part: Jumper Wire
quantity: 1
Breadboarding wire bundle
[Jumper Wire](https://www.adafruit.com/product/153)

### Part: Breadboard
quantity: 1
Half Sized Premium Breadboard - 400 Tie Points
[Breadboard](https://www.adafruit.com/product/64)

## Wiring
You will need to connect the following pins to the photocell and 10k resistor:

- **Feather GND** to **one leg of the 10k ohm resistor**
- **The second leg of the 10k ohm resistor** to **one leg of the photocell**
- **Feather A0** to **the same leg of the photocell as the 10k ohm resistor**.
- **Feather 3V** to **the second leg of the photocell**

![raspberry_pi_aio-basics-analog-input-arduino_bb-s2.png](https://cdn-learn.adafruit.com/assets/assets/000/125/926/medium640/raspberry_pi_aio-basics-analog-input-arduino_bb-s2.png?1699395572)

# Adafruit IO Basics: Analog Input

## Code

## Open Sketch

After installing all of the dependencies, navigate to the example sketch for this project:&nbsp;

Navigate to the&nbsp; **adafruitio\_08\_analog\_in** &nbsp;sketch by opening the&nbsp; **File -\> Examples -\> Adafruit IO Arduino** &nbsp;menu.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/699/medium800/adafruit_io_light_Screen_Shot_2017-02-16_at_9.35.09_AM.png?1698768864)

## Configure Sketch

Within Arduino IDE, click the&nbsp; **config.h** &nbsp;tab. Set the&nbsp;`IO_USERNAME`&nbsp;field to your Adafruit IO username. Then, set the&nbsp;`IO_KEY`&nbsp;field to the value of your Active Key.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/598/medium800/adafruit_io_Cursor_and_adafruitio_06_digital_in_-_config_h___Arduino_1_8_19.png?1698419044)

By default, WiFi is enabled in example sketches. Within the **config.h** file, set&nbsp;`WIFI_SSID`&nbsp;to the name of your wireless network. Then, set&nbsp;`WIFI_PASS`&nbsp;to the password for your WiFi network.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/599/medium800/adafruit_io_04_wifi_%281%29.png?1698419066)

## Upload Sketch

In the Arduino IDE, select the board you are using&nbsp;from the&nbsp; **Tools -\> Board** menu.&nbsp;

Then, using the **Tools-\>Port** menu, select the proper COM port on Windows, or USB device on macOS or Linux.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/600/medium800/adafruit_io_port_menu.png?1698420730)

Click the arrow icon to upload the example sketch to your board.

It might take a while, but you should see an&nbsp; **Upload Complete** &nbsp;message at the bottom of the window when the process has finished.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/602/medium800/adafruit_io_upload_btn.png?1698420798)

You can now click the serial monitor icon (magnifying glass) to view the output of the sketch.&nbsp;

Your board should connect to Adafruit IO.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/935/medium800/raspberry_pi_connect.png?1699403731)

You can now cover the photocell with your hand, and you should see the changing values being sent to Adafruit IO.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/936/medium800/raspberry_pi_aio_output.png?1699404407)

If not, check your WiFi and Adafruit IO credentials in&nbsp; **config.h** &nbsp;and try uploading your sketch again using the process above.

## Code Walkthrough
The&nbsp; **adafruitio\_08\_analog\_in** &nbsp;example uses pin&nbsp;`A0`&nbsp;by default on all boards, and that can be modified if needed by changing the&nbsp;`PHOTOCELL_PIN`&nbsp;define.

```auto
/************************ Example Starts Here *******************************/
// analog pin 0
#define PHOTOCELL_PIN A0
```

The next chunk of code sets up two integer variables to track the state of the photocell and an Adafruit IO Feed instance for a feed named&nbsp;_analog_.

```auto
// photocell state
int current = 0;
int last = -1;

// set up the 'analog' feed
AdafruitIO_Feed *analog = io.feed("analog");
```

The setup function 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&nbsp; **config.h** &nbsp;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);

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

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

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

}
```

Next, we have the main&nbsp;`loop()`&nbsp;function. The first line of the loop function calls&nbsp;`io.run();`&nbsp;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&nbsp;`loop()`&nbsp;checks the current value of the photocell, and saves the value of the photocell in the&nbsp;`current`&nbsp;variable.

We then check if the&nbsp;`current`&nbsp;photocell value is equal to the&nbsp; **last** &nbsp;photocell value. If it is equal, we will return early and not continue with the rest of the loop.

```auto
// grab the current state of the photocell
current = analogRead(PHOTOCELL_PIN);

// return if the value hasn't changed
if(current == last)
  return;
```

The final chunk of the&nbsp;`loop()`&nbsp;function prints the current value to the Arduino Serial Monitor, and sends the current value to the&nbsp; **analog** &nbsp;feed on Adafruit IO. We also set&nbsp;`last = current;`&nbsp;so we can tell if the value of the photocell has changed in the next run of the loop.

```auto
// save the current state to the analog feed
  Serial.print("sending -> ");
  Serial.println(current);
  analog->save(current);

  // store last photocell state
  last = current;

  // wait one second (1000 milliseconds == 1 second)
  delay(1000);

}
```

# Adafruit IO Basics: Analog Input

## Usage

## Build Adafruit IO Dashboard

While the Adafruit IO Feed will display the value of the push button's state, it is nice to have a visual indicator so others can understand and interpret this project. To do this, we'll create an Adafruit IO Dashboard to display the push-button state.

### What is an Adafruit IO Dashboard

You can create a quick and simple UI for your electronics project using Dashboards in Adafruit IO.&nbsp;Dashboard blocks such as charts, sliders, and buttons are available to help you quickly create an interactive dashboard for your IoT Project without needing any custom code.

For more information about Adafruit IO Dashboards, visit the following guide:

### Adafruit IO Basics: Dashboards

[Adafruit IO Basics: Dashboards](https://learn.adafruit.com/adafruit-io-basics-dashboards)
Click the **New Dashboard** button on the Dashboards page to create a new dashboard.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/125/589/medium800/adafruit_io_oQunx0ZnDX.png?1698418531)

In the **Create a new Dashboard** dialog give the new dashboard an appropriate name, plus a description if you wish, then click the **Create** button.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/731/medium800/adafruit_io_Cursor_and_IO_-_Dashboards_%F0%9F%94%8A.png?1698775124)

You will be returned to the list of dashboards, with a new entry for the one you created.

**Click** the dashboard name in the list to be taken to the new dashboard.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/732/medium800/adafruit_io_click-analog.png?1698775150)

You'll be presented with an empty dashboard. Click the cog in the upper-right-hand side to open the settings dropdown.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/592/medium800/adafruit_io_2sDDbDwGPL.png?1698418563)

Click the **Create New Block** option.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/593/medium800/adafruit_io_UehFg43TYQ.png?1698418575)

Next, add a new Gauge&nbsp;block to a new or existing dashboard. Name the block whatever you would like, and&nbsp;_give it a&nbsp; **max&nbsp;value** &nbsp;of 1024 and a&nbsp; **min&nbsp;value** &nbsp;of 0_. Make sure you have selected the&nbsp; **Analog** &nbsp;feed as the data source for the gauge.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/701/medium800/adafruit_io_light_Screen_Shot_2017-02-16_at_9.23.05_AM.png?1698769256)

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

## Usage
You can now cover the photocell with your hand, and you should see the changing values being sent to Adafruit IO:

```auto
sending -> 1024
sending -> 953
sending -> 259
sending -> 476
sending -> 248
sending -> 173
sending -> 224
sending -> 291
sending -> 1024
```

Check your dashboard on Adafruit IO, and you should see the gauge respond to the changes in photocell values.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/754/medium800thumb/adafruit_io_light_analog_%282%29.jpg?1698784749)

# Adafruit IO Basics: Analog Input

## Python

If you're following along with a Raspberry Pi, Beaglebone or any other supported small linux computer, we'll use a special library called&nbsp;[**adafruit\_blinka**](https://pypi.org/project/Adafruit-Blinka/)&nbsp;([named after Blinka, the CircuitPython mascot](https://www.adafruit.com/?q=blinka)) to provide the layer that translates the CircuitPython hardware API to whatever library the Linux board provides. It's CircuitPython, on Pi!

Warning: 

Danger: 

## Install Adafruit Blinka on Raspberry Pi

Click the guide below and follow the "Installing Blinka on Raspberry Pi" page to set up your Raspberry Pi for CircuitPython libraries and the adafruit-blinka package.

### CircuitPython Libraries on Linux and Raspberry Pi - Installing Blinka on Raspberry Pi

[CircuitPython Libraries on Linux and Raspberry Pi](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux)
[Installing Blinka on Raspberry Pi](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi)
## Install Adafruit IO Python Client Library

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.

If you are installing the Bookworm version of Raspberry Pi OS, you will need to install the Adafruit IO Python module (and its supported dependencies) in a virtual environment. (You can find more information in the [Python Virtual Environment Usage on Raspberry Pi](https://learn.adafruit.com/python-virtual-environment-usage-on-raspberry-pi) guide).

To Install and activate the virtual environment, use the following commands:

```auto
sudo apt install python3.11-venv
python -m venv env --system-site-packages
```

Then, activate the virtual environment by running:

```auto
source env/bin/activate
```

Once your virtual environment is activated, run the following command to install the **Adafruit IO Client for Python**** :**

```auto
pip3 install adafruit-io
```

That's it, we're all set up!

# Adafruit IO Basics: Analog Input

## Wiring

## Parts

CircuitPython libraries and `adafruit-blinka` will work on any Raspberry Pi board! That means the original 1, the Pi 2, Pi 3, Pi 4, Pi 5, Pi Zero, Pi Zero 2 W, or even the compute module.&nbsp;

### Raspberry Pi 5 - 4 GB RAM

[Raspberry Pi 5 - 4 GB RAM](https://www.adafruit.com/product/5812)
The Raspberry Pi 5&nbsp;is the newest Raspberry Pi computer, and the Pi Foundation knows you can always make a good thing _better_! And what could make the Pi 5 better than the 4? How about a&nbsp;_faster_ processor, USB 3.0 ports, and an updated Gigabit Ethernet chip with PoE...

In Stock
[Buy Now](https://www.adafruit.com/product/5812)
[Related Guides to the Product](https://learn.adafruit.com/products/5812/guides)
![Angled shot of green Raspberry Pi 5 microcontroller.](https://cdn-shop.adafruit.com/640x480/5812-01.jpg)

If you're following along with a [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, Zero 2 W, A+, B+, Pi 2, Pi 3, Pi 4, Pi 5) to a solderless breadboard.

You will also need the following parts:

The Raspberry Pi lacks analog pins, which are required for this guide. We can use an Analog-To-Digital converter to add this capability to the Pi. We suggest using the [MCP3008](https://www.adafruit.com/product/856) - it costs a few bucks, provides eight, 10-bit channels of analog conversion, and works with Adafruit Blinka.&nbsp;

### MCP3008 - 8-Channel 10-Bit ADC With SPI Interface

[MCP3008 - 8-Channel 10-Bit ADC With SPI Interface](https://www.adafruit.com/product/856)
Need to add analog inputs? This chip will add 8 channels of 10-bit analog input to your microcontroller or microcomputer project. It's super easy to use and uses SPI so only 4 pins are required. We chose this chip as a great accompaniment to the Raspberry Pi computer because it's fun...

Out of Stock
[Buy Now](https://www.adafruit.com/product/856)
[Related Guides to the Product](https://learn.adafruit.com/products/856/guides)
![Angled shot of a MCP3008 - 8-Channel 10-Bit ADC With SPI Interface.](https://cdn-shop.adafruit.com/640x480/856-01.jpg)

### Part: Photo cell
quantity: 1
Analog sensor which detects light.
[Photo cell](https://www.adafruit.com/product/161)

### Part: Jumper Wires
quantity: 1
Breadboarding wire bundle.
[Jumper Wires](https://www.adafruit.com/product/153)

### Part: 10k Ohm Resistor
quantity: 1
We'll need one of these to assemble this circuit. 
[10k Ohm Resistor](https://www.adafruit.com/product/2784)

## Wiring
You'll need to place the MCP3008 chip into the breadboard. If you haven't done this before, line up the legs of the chip such that the legs sit on opposite sides of the empty channel in the middle of the breadboard.

**The**  **orientation of the MCP3008 _matters_ - be sure to place it on the breadboard with the half-circle and dot towards the Adafruit logo on the Pi T-Cobbler:**

![adafruit_io_dothalfcircle.png](https://cdn-learn.adafruit.com/assets/assets/000/125/760/medium640/adafruit_io_dothalfcircle.png?1698857616)

Then, _slowly_ press it into the breadboard, taking care not to bend any pins.

![adafruit_io_ezgif-2-d53c435ae1.gif](https://cdn-learn.adafruit.com/assets/assets/000/125/762/medium640thumb/adafruit_io_ezgif-2-d53c435ae1.jpg?1698857656)

Once the MCP3008 is pushed into the breadboard, we're ready to start wiring the circuit according to the diagram below. Each of the legs of the MCP3008 is named according to the pinout on the left.

![adafruit_io_sensors_raspberry_pi_mcp3008pin.gif](https://cdn-learn.adafruit.com/assets/assets/000/125/763/medium640/adafruit_io_sensors_raspberry_pi_mcp3008pin.gif?1698857680)

![](https://cdn-learn.adafruit.com/assets/assets/000/125/765/medium800/adafruit_io_analog_input_fritz.png?1698857713)

Make the following connections between the Raspberry Pi and the MCP3008:

- **MCP3008 Pin 16** &nbsp;to&nbsp; **3.3V**.
- **MCP3008 Pin 15** &nbsp;to&nbsp; **3.3V**.
- **MCP3008 Pin 14** &nbsp;to&nbsp; **Ground**.
- **MCP3008 Pin 13&nbsp;** to&nbsp; **Pi SCK**.
- **MCP3008 Pin 12** &nbsp;to&nbsp; **Pi MISO**.
- **MCP3008 Pin 11** &nbsp;to&nbsp; **Pi MOSI**.
- **MCP3008 Pin 10** &nbsp;to&nbsp; **Pi Pin 21**.

There are also a few connections to make between the individual components on the board:

- **MCP3008** &nbsp; **Pin** &nbsp; **1** &nbsp;to the left leg of the&nbsp; **10k ohm resistor**.
- The left leg of the&nbsp; **photocell** &nbsp;to&nbsp; **3.3V**.
- The right leg of the&nbsp; **photocell** &nbsp;to the left leg of the&nbsp; **10k ohm resistor**.
- The right leg of the&nbsp; **10k ohm resistor** &nbsp;to&nbsp; **Ground**.

# Adafruit IO Basics: Analog Input

## Code

## Download Project Code

Click "Download Project Bundle" to download a .zip file containing all the code examples for the Adafruit IO Basics series of project guides.

After downloading, unzip the file and save it somewhere safe on your computer. We suggest saving it to the desktop!

https://github.com/adafruit/Adafruit_IO_Python/blob/master/examples/basics/analog_in.py

## Get Adafruit IO Key

To connect your device to Adafruit IO, you will need your Adafruit IO credentials. To obtain these, navigate to&nbsp;[io.adafruit.com](https://io.adafruit.com/)&nbsp;and click the key icon on the header:

![](https://cdn-learn.adafruit.com/assets/assets/000/125/912/medium800/code_adafruit_io_io_key_click.png?1699387535)

## Modify Project Code

Before we run the example, you will need to change `ADAFRUIT_IO_USERNAME`&nbsp;and&nbsp;`ADAFRUIT_IO_KEY`&nbsp;to the username and key for your Adafruit IO account.

```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'
```

## Run Project Code

In a terminal, navigate to the folder containing the Adafruit IO Basics project examples.

Next, run the&nbsp;script by running the following in your terminal:

```auto
python3 analog_in.py
```

Cover the photocell with your hand and you should see the changing values being sent to Adafruit IO:

```auto
sending -> 1024
sending -> 953
sending -> 259
sending -> 476
sending -> 248
sending -> 173
sending -> 224
sending -> 291
sending -> 1024
```

# Adafruit IO Basics: Analog Input

## Usage

## Build Adafruit IO Dashboard

While the Adafruit IO Feed will display the value of the push button's state, it is nice to have a visual indicator so others can understand and interpret this project. To do this, we'll create an Adafruit IO Dashboard to display the push-button state.

### What is an Adafruit IO Dashboard

You can create a quick and simple UI for your electronics project using Dashboards in Adafruit IO.&nbsp;Dashboard blocks such as charts, sliders, and buttons are available to help you quickly create an interactive dashboard for your IoT Project without needing any custom code.

For more information about Adafruit IO Dashboards, visit the following guide:

### Adafruit IO Basics: Dashboards

[Adafruit IO Basics: Dashboards](https://learn.adafruit.com/adafruit-io-basics-dashboards)
Click the **New Dashboard** button on the Dashboards page to create a new dashboard.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/125/589/medium800/adafruit_io_oQunx0ZnDX.png?1698418531)

In the **Create a new Dashboard** dialog give the new dashboard an appropriate name, plus a description if you wish, then click the **Create** button.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/731/medium800/adafruit_io_Cursor_and_IO_-_Dashboards_%F0%9F%94%8A.png?1698775124)

You will be returned to the list of dashboards, with a new entry for the one you created.

**Click** the dashboard name in the list to be taken to the new dashboard.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/732/medium800/adafruit_io_click-analog.png?1698775150)

You'll be presented with an empty dashboard. Click the cog in the upper-right-hand side to open the settings dropdown.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/592/medium800/adafruit_io_2sDDbDwGPL.png?1698418563)

Click the **Create New Block** option.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/593/medium800/adafruit_io_UehFg43TYQ.png?1698418575)

Next, add a new Gauge&nbsp;block to a new or existing dashboard. Name the block whatever you would like, and&nbsp;_give it a&nbsp; **max&nbsp;value** &nbsp;of 1024 and a&nbsp; **min&nbsp;value** &nbsp;of 0_. Make sure you have selected the&nbsp; **Analog** &nbsp;feed as the data source for the gauge.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/701/medium800/adafruit_io_light_Screen_Shot_2017-02-16_at_9.23.05_AM.png?1698769256)

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

## Usage
With the Python script running, cover the photocell with your hand. You should see the changing values being sent to Adafruit IO:

```auto
sending -> 1024
sending -> 953
sending -> 259
sending -> 476
sending -> 248
sending -> 173
sending -> 224
sending -> 291
sending -> 1024
```

Check your dashboard on Adafruit IO, and you should see the gauge respond to the changes in photocell values.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/754/medium800thumb/adafruit_io_light_analog_%282%29.jpg?1698784749)

# Adafruit IO Basics: Analog Input

## WipperSnapper

Warning: 

## What is WipperSnapper

WipperSnapper is a firmware designed to turn any WiFi-capable board into an Internet-of-Things device without programming a single line of code. WipperSnapper connects to [Adafruit IO](https://io.adafruit.com/), a web&nbsp;platform designed ([by Adafruit!](https://www.adafruit.com/about)) to&nbsp;_display_,&nbsp;_respond_, and&nbsp;_interact_&nbsp;with your project's data.

Simply load the WipperSnapper firmware onto your board, add credentials, and plug it into power. Your board will automatically register itself with your Adafruit IO account.

From there, you can add&nbsp;_components_&nbsp;to your board such as buttons, switches, potentiometers, sensors, and more! Components are&nbsp;_dynamically&nbsp;_added to hardware, so you can&nbsp;immediately start interacting, logging, and streaming the data your projects produce without writing code.

## Sign up for Adafruit.io

You will need an Adafruit IO account to use WipperSnapper on your board. If you do not already have one, head over to [io.adafruit.com](https://io.adafruit.com/) to create a&nbsp;_free_ account.

## Install WipperSnapper

Log into your [Adafruit IO](https://io.adafruit.com/) account. Click the _New Device_ button at the top of the page.

![](https://cdn-learn.adafruit.com/assets/assets/000/112/548/medium800/wippersnapper_setup__board_selector__web__new_device_1.png?1655919766)

After clicking New Device, you should be on the _board selector_ page. This page displays every board that is compatible with the WipperSnapper firmware.

![](https://cdn-learn.adafruit.com/assets/assets/000/112/550/medium800/wippersnapper_setup__board_selector__web__selector_maion.png?1655920178)

In the board selector page's search bar, search for the ESP32-S2 TFT Feather&nbsp;(or your board of choice).&nbsp;Once you've located the board you'd like to install WipperSnapper on,_&nbsp;_click the&nbsp;_Choose Board_&nbsp;button to bring you to the self-guided installation wizard.

![](https://cdn-learn.adafruit.com/assets/assets/000/126/023/medium800/wippersnapper_chrome_MlFWX7xoCQ.png?1699542895)

Follow the step-by-step instructions on the page to install Wippersnapper on your device and connect it to Adafruit IO. You may need to revisit this New Device page if you're Wireless Network details change in the future.

![](https://cdn-learn.adafruit.com/assets/assets/000/126/024/medium800/wippersnapper_chrome_7L8p15Fiiy.png?1699543039)

If the installation was successful, a popover should appear displaying that your board has successfully been detected by Adafruit IO.

Give your board a name and click "Continue to Device Page".

![](https://cdn-learn.adafruit.com/assets/assets/000/126/025/medium800/wippersnapper_adafruit_products_tft_s2_detected.png?1699543464)

You should be brought to your board's device page.

Next, Visit this guide's **WipperSnapper Essentials** pages to learn how to interact with your board using Adafruit IO.

![](https://cdn-learn.adafruit.com/assets/assets/000/126/026/medium800/wippersnapper_adafruit_products_s2_tft_device_page.png?1699543484)

## Feedback

Adafruit.io WipperSnapper is in **beta** and you can help improve it!

If you have&nbsp; suggestions or general feedback about the installation process - visit [https://io.adafruit.com/support](https://io.adafruit.com/support), click _"Contact Adafruit IO Support"_ and select _"I have feedback or suggestions for the WipperSnapper Beta"._

## Troubleshooting

If you encountered an issue during installation, please try the steps below first.

If you're still unable to resolve the issue, or if your issue is not listed below, get in touch with us directly at [https://io.adafruit.com/support](https://io.adafruit.com/support "https://io.adafruit.com/support"). Make sure to click&nbsp; _"Contact Adafruit IO Support"_ and select "_There is an issue with WipperSnapper. Something is broken!"_

### 

A lot of people end up using a charge-only USB cable and it is very frustrating! Make sure you have a USB cable you know is good for data sync.&nbsp;USB Hubs can also interfere so make sure the device is directly connected to your computer.

If you're computer isn't up to date with the latest driver updates, then you may not have the software driver necessary for the USB Serial controller that speaks to the Microcontroller. Find the latest drivers on your boards learn guide page, or [here](https://learn.adafruit.com/adafruit-esp32-s2-tft-feather/arduino-ide-setup) for the ESP32-S2 TFT Feather.

If you've already installed the firmware, but can't set your secrets then try resetting the board and it should show up (if it supports USB Mass Storage), otherwise it might be easiest to go back to the new device page and set up the board's software again by following the steps for your board.

### 

First, make sure that you selected the correct board on the board selector.

Next, please make sure that you entered your WiFi credentials properly, there are no spaces/special characters in either your network name (SSID) or password, and that you are connected to a 2.4GHz wireless network.

If you're still unable to connect your board to WiFi, please [make a new post on the WipperSnapper technical support forum with the error you're experiencing, the LED colors which are blinking, and the board you're using.](https://forums.adafruit.com/viewforum.php?f=66)

### 

Try hard-resetting your board by unplugging it from USB power and plugging it back in.

If the error is still occurring, please&nbsp;[make a new post on the WipperSnapper technical support forum with information about what you're experiencing, the LED colors which are blinking (if applicable), and the board you're using.](https://forums.adafruit.com/viewforum.php?f=66)

## "Uninstalling" WipperSnapper&nbsp;

WipperSnapper firmware is an application that is loaded onto your board. There is nothing to "uninstall". However, you may want to "move" your board from running WipperSnapper to running Arduino or CircuitPython. You also may need to restore your board to the state it was shipped to you from the Adafruit factory.&nbsp;

### Moving from WipperSnapper to CircuitPython

Follow the steps on the [Installing CircuitPython page](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython) to install CircuitPython on your board running WipperSnapper.

- If you are unable to double-tap the RST button to enter the UF2 bootloader, follow the _"Factory Resetting a WipperSnapper Board"_ instructions below.

Uploading this sketch will overwrite WipperSnapper. If you want to re-install WipperSnapper, follow the instructions at the top of this page.

### Moving from WipperSnapper to Arduino

If you want to use your board with Arduino, you will use the Arduino IDE to load&nbsp;_any_ sketch onto your board.

First, follow the page below to set up your Arduino IDE environment for use with your board.

[Setup Arduino IDE](https://learn.adafruit.com/adafruit-esp32-s2-tft-feather/arduino-ide-setup)
Then, follow the page below to upload the "Arduino Blink" sketch to your board.

[Upload Arduino Blink Sketch](https://learn.adafruit.com/adafruit-esp32-s2-tft-feather/arduino-blink)
Uploading this sketch will overwrite WipperSnapper. If you want to re-install WipperSnapper, follow the instructions at the top of this page.

### Factory Resetting a WipperSnapper Board

Sometimes, hardware gets into a state that requires it to be "restored" to the original state it shipped in. If you'd like to get your board back to its original factory state, follow the guide below.

[Factory Reset Guide](https://learn.adafruit.com/adafruit-esp32-s2-tft-feather/factory-reset)
# Adafruit IO Basics: Analog Input

## Wiring

Before you get this wired up, you'll need a few components!

Mainly you'll want a Light Dependent Resistor (almost any LDR should be fine, but here we use a [Cadmium Sulphur [CDs] LDR](https://electronics.stackexchange.com/a/441225/98487)), a resistor (to provide the other half of a voltage divider circuit), and a couple of wires (or Jumper Cables).

Have a look at the shopping list below, then check your existing components for any matching resistors / LDRs, or pickup a few from the store.

## Parts

For this example, we are using an Adafruit ESP32-S2 TFT Feather.

This board is **perfect** for IoT projects as it includes all the&nbsp;features of a Feather main board: the comforting warmth of an ESP32-S2 WiFi microcontroller, and the crispness of a 240x135 pixel color TFT display. This feather comes with native USB and&nbsp; **4 MB flash + 2 MB of PSRAM** , so it is perfect for use with CircuitPython, WipperSnapper, or Arduino with low-cost WiFi. Native USB means it can act like a keyboard or a disk drive. WiFi means it's awesome for IoT projects. And Feather means it works with the large community of Feather Wings for expandability.

### Adafruit ESP32-S2 TFT Feather - 4MB Flash, 2MB PSRAM, STEMMA QT

[Adafruit ESP32-S2 TFT Feather - 4MB Flash, 2MB PSRAM, STEMMA QT](https://www.adafruit.com/product/5300)
We've got a new machine here at Adafruit, it can uncover your deepest desires. Don't believe me? I'll turn it on right now to prove it to you! What, you want unlimited mozzarella sticks? OK well, that's not something we can provide. But we can provide your...

In Stock
[Buy Now](https://www.adafruit.com/product/5300)
[Related Guides to the Product](https://learn.adafruit.com/products/5300/guides)
![Adafruit ESP32-S2 TFT Feather powered on by a USB- C power source displaying the product tittle in a red, yellow, green, white and blue. ](https://cdn-shop.adafruit.com/640x480/5300-06.jpg)

However, you can use any WipperSnapper-compatible hardware with this tutorial. You will need to modify the pin location as a result since it won't match the Adafruit ESP32-S2 TFT Feather.

* * *
You will also need the following additional parts:

**1 x Light Dependent Resistor**

### Photo cell (CdS photoresistor)

[Photo cell (CdS photoresistor)](https://www.adafruit.com/product/161)
CdS cells are little light sensors. As the squiggly face is exposed to more light, the resistance goes down. When it's light, the resistance is about ~1KΩ, when dark it goes up to ~10KΩ.

To use, connect one side of the photocell (either one, it's symmetric) to power...

In Stock
[Buy Now](https://www.adafruit.com/product/161)
[Related Guides to the Product](https://learn.adafruit.com/products/161/guides)
![Close up head of CdS light sensor showing sensor element](https://cdn-shop.adafruit.com/640x480/161-00.jpg)

 **1 x 10K Ohm Resistor**

You'll only want one resistor, but if you need them then here's a whole pack of 25:

### Through-Hole Resistors - 10K ohm 5% 1/4W - Pack of 25

[Through-Hole Resistors - 10K ohm 5% 1/4W - Pack of 25](https://www.adafruit.com/product/2784)
ΩMG! You're not going to be able to resist these handy resistor packs!&nbsp;Well, axially, they&nbsp;do all of the resisting for you!

This is a **25 Pack of 10K Ω Resistors.** More specifically, they are **carbon film** , through-hole...

In Stock
[Buy Now](https://www.adafruit.com/product/2784)
[Related Guides to the Product](https://learn.adafruit.com/products/2784/guides)
![Angled shot of 25 Through-Hole Resistors - 10K ohm 5% 1/4W.](https://cdn-shop.adafruit.com/640x480/2784-00.jpg)

 **3 x Male to Male Jumper Wires**

Here's a nice bundle of 75 Male to Male jumper wires if you need some for your supplies...

### Breadboarding wire bundle

[Breadboarding wire bundle](https://www.adafruit.com/product/153)
75 flexible stranded core wires with stiff ends molded on in red, orange, yellow, green, blue, brown, black and white. These are a major improvement over the "box of bent wires" that are sometimes sold with breadboards, and faster than stripping your own solid core wires. Makes...

In Stock
[Buy Now](https://www.adafruit.com/product/153)
[Related Guides to the Product](https://learn.adafruit.com/products/153/guides)
![Bundle of multi-colored multi-length wire jumpers](https://cdn-shop.adafruit.com/640x480/153-04.jpg)

 **1 x Prototyping Breadboard**

Half size or above for the Feather footprint to still leave some prototyping space, maybe you want one with mounting holes, otherwise we have [lots to choose from](https://www.adafruit.com/category/124).

### Half-Size Breadboard with Mounting Holes

[Half-Size Breadboard with Mounting Holes](https://www.adafruit.com/product/4539)
This cute 3.2″ × 2.1″ (82 × 53mm) solderless half-size breadboard has four bus lines&nbsp;and 30 rows of pins, our favorite size of solderless breadboard for projects. You get a whoppin' **400 tie points**! [Plug in...](http://adafruit.com/feather)

Out of Stock
[Buy Now](https://www.adafruit.com/product/4539)
[Related Guides to the Product](https://learn.adafruit.com/products/4539/guides)
![Angled shot of Half-Size Breadboard with Mounting Holes.](https://cdn-shop.adafruit.com/640x480/4539-03.jpg)

## Wiring
You will need to connect the following pins to the LDR and resistor:

- Feather **GND** to one leg of the **10k ohm resistor**
- The second leg of the **10k ohm resistor** to one leg of the **photocell (LDR)**
- Feather **A5** to the _same leg_ of the **photocell** as the 10k ohm resistor.
- Feather **3V** to the second leg of the **photocell**

![raspberry_pi_featherV2_LDR_D5_bb.png](https://cdn-learn.adafruit.com/assets/assets/000/125/793/medium640/raspberry_pi_featherV2_LDR_D5_bb.png?1698932612)

 **Note:** &nbsp;Resistors are&nbsp;_not_&nbsp;polarized, so the 10K ohm resistor can be connected to the circuit in either direction.

# Adafruit IO Basics: Analog Input

## Configuring WipperSnapper

Info: 

In the real (physical) world we have electrical components, so to represent that on our WipperSnapper device page in Adafruit IO we also have components! They are like digital twins with the real world electrical components, but before you can use them you have to tell your device which ones to use and how!

So now that you have the physical hardware setup, including the electrical components and wiring, it's time to setup your LDR Photocell component on the WipperSnapper Device page...

## Add a Component to Your Device
Connect your board to Adafruit IO Wippersnapper and&nbsp;**[navigate to the WipperSnapper board list](https://io.adafruit.com/wippersnapper).**

On this page,&nbsp; **select the WipperSnapper board you're using** &nbsp;to be brought to the board's interface page.

![](https://cdn-learn.adafruit.com/assets/assets/000/126/103/medium800/configuring_wippersnapper_chrome_MpFpPSw6eJ.png?1700243188)

Use the New Component button to bring up the Component Picker window.

![](https://cdn-learn.adafruit.com/assets/assets/000/126/104/medium800/configuring_wippersnapper_a772ixvxt6f.png?1700243219)

Select the&nbsp; **Light Sensor** component from the New Component window to represent the&nbsp; **LDR** / **Photocell**. You can search for elements of the name, category or description.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/796/medium800/raspberry_pi_oY0TjrNW1f.png?1698933285)

The&nbsp; **Create Light Sensor Component** &nbsp;window will be shown.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/797/medium800/raspberry_pi_Screenshot_2023-11-02_135845.png?1698933541)

Change the&nbsp; **Light Sensor Pin** &nbsp;to match your wiring, if you followed the Wiring guidance&nbsp;above then the pin is **A5**.

Change the measurement **Period** to **30 seconds** , then click the Create Component button.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/798/medium800/raspberry_pi_0TqbHEUWz6.png?1698933702)

You should now be presented with the Light Sensor component on your device page.

After a short period (the measurement period) the sensor data will be displayed, until then the Value will show a dash / hyphen / minus ( - ), or [null](https://en.wikipedia.org/wiki/Null#Computing).

![](https://cdn-learn.adafruit.com/assets/assets/000/139/237/medium800/raspberry_pi_yT4cPF1930.png?1756407043)

Test the circuit by waiting for the Light Sensor component to display a value, and then cover up the LDR / Photocell and wait for another reading (or two). It's super sensitive to light so cover it well or hide it in a box.

Finally uncover the LDR and wait for the next data reading which should return to near the first value.

It's worth noting that behind the scenes WipperSnapper + Adafruit IO creates a new data&nbsp;[feed](https://learn.adafruit.com/adafruit-io-basics-feeds/overview)&nbsp;for each component. A&nbsp;[feed](https://learn.adafruit.com/adafruit-io-basics-feeds/overview)&nbsp;is where new data values are published or subscribed to, you can see all your feeds on your&nbsp;[Feeds page](https://io.adafruit.com/feeds).

To easily see the feed for one of your WipperSnapper components just click the graph symbol to be taken to a chart and table of previous readings.

![](https://cdn-learn.adafruit.com/assets/assets/000/139/236/medium800/raspberry_pi_dOqiE3qo7Z.png?1756404642)

The feed page presents an interactive graph with filtering options, a data download button, the manual Add Data button, and the main table of data beneath.

The side bar allows you to adjust your feeds' settings, sharing options, notifications, webhooks, and license.

It's also possible to disable a feed here, which removes it from counting against your limits, but it can then no longer be updated.

![](https://cdn-learn.adafruit.com/assets/assets/000/139/235/medium640/raspberry_pi_Screenshot_2025-08-28_185332.png?1756404091)

Okay, so now that you have the Photocell working as expected, it's on to creating the Adafruit IO Dashboard...

# Adafruit IO Basics: Analog Input

## Usage

Here you'll create and test an Adafruit IO Dashboard, which allow interactive visualisation and control of your WipperSnapper components (or any other Adafruit IO feed). If you've not setup WipperSnapper then&nbsp;[start here](https://learn.adafruit.com/adafruit-io-basics-analog-input/wippersnapper).

To get started head on over to the&nbsp;[Dashboards](https://io.adafruit.com/dashboards "https://io.adafruit.com/dashboards")&nbsp;page.

## Build Adafruit IO Dashboard
Click the **New Dashboard** button on the Dashboards page to create a new dashboard.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/125/533/medium800/adafruit_io_oQunx0ZnDX.png?1698074924)

In the **Create a new Dashboard** dialog give the new dashboard an appropriate name, plus a description if you wish, then click the **Create** button.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/697/medium800/adafruit_io_Screenshot_2023-10-31_161157.png?1698768744)

You will be returned to the list of dashboards, with a new entry for the one you created.

Click the dashboard name in the list to be taken to the new dashboard.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/698/medium800/adafruit_io_7IxY9oA1jo.png?1698768828)

You'll be presented with an empty dashboard. At the top right is a Cog that triggers a drop-down menu for Dashboard Settings, and then to the left is the full screen button, followed by&nbsp; **Edit Layout** button, and finally the create **New Block** option.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/139/244/medium800/raspberry_pi_wFagBDNF5x.png?1756411568)

If you click the cog then there are also options for dark/light mode, block borders, and dashboard privacy (as well as&nbsp;_deleting the dashboard_) as shown below.  
You can get a more in-depth learn guide for dashboards [here](https://learn.adafruit.com/adafruit-io-basics-dashboards).

For now, click the create **New Block** button.

![](https://cdn-learn.adafruit.com/assets/assets/000/139/243/medium800/raspberry_pi_tDMPhsMk9w.png?1756411333)

On the Create a new block dialog you'll see a list of available block types.

Click on the Gauge block type to start the process of adding the block

![](https://cdn-learn.adafruit.com/assets/assets/000/139/245/medium800/raspberry_pi_VB6DQe6Os0.png?1756411784)

Next, you'll be taken to the&nbsp; **Connect a Feed** &nbsp;page, where you need to select which feed to connect to the Toggle block. Select the new button feed we created then use the&nbsp; **Next Step&nbsp;** button.

Note that the groups/devices in the list can be collapsed/expanded to hide or show their feeds. You may need to expand a group to find your button feed.

![](https://cdn-learn.adafruit.com/assets/assets/000/139/246/medium800/raspberry_pi_AGVbJQhEOb.png?1756412192)

On the next page, for the **Block Settings,** &nbsp;change the&nbsp; **Gauge Max Value** to something appropriate for your board setup (65000 for raw values or 3.3 if voltage).

Later you can adjust these block settings and also configure the low/high warning values which change the gauge color to reflect the status.

After adjusting anything else that feels right like the gauge label, block title, or maybe even an&nbsp;_icon,_&nbsp;press the&nbsp; **Create Block** button.

![](https://cdn-learn.adafruit.com/assets/assets/000/139/255/medium800/raspberry_pi_RZUFVNXxSX.png?1756413365)

The dashboard will update, displaying the gauge you added.

![](https://cdn-learn.adafruit.com/assets/assets/000/139/256/medium800/raspberry_pi_CN6w3uLbJT.png?1756413456)

Now add a new block, choosing the **Line Chart** &nbsp;in the blocks dialog, and select the same feed again before proceeding to the block settings page. There choose the time period you want to display, and potentially you may wish to adjust the graphs maximum and minimum values, along with the scale to logarithmic instead of linear.

By default the graph shows aggregated data once there are over 640 datapoints in the chosen time period, so if you never want that to happen, instead only showing actual data values, then choose the Raw Data Only option.

Once happy with the setup choose **Create Block**.

![](https://cdn-learn.adafruit.com/assets/assets/000/139/262/medium640/raspberry_pi_nil5Z8TzFN.png?1756414175)

The graph block appears beneath the existing block, refresh the page to see the chart data.

![](https://cdn-learn.adafruit.com/assets/assets/000/139/263/medium800/raspberry_pi_Screenshot_2025-08-28_220153.png?1756414927)

Here I've added a duplicate graph in linear rather than logarithmic range to illustrate the difference.   
The dashboard is in edit layout mode so you can see the settings cogs and resize markers for each block.  
Clicking the cog opens a small menu (with time period for charts), including Edit Block and related items.

![](https://cdn-learn.adafruit.com/assets/assets/000/139/266/medium800/raspberry_pi_bPvJMbiM9y.png?1756417349)

You may wish to use the **Edit Layout** button and move things around, taking note that there is a new layout for each screen size (XS/S/M/L/XL), or just continue onto usage so you can test this thing!

## Usage
Info: For testing it can be easier to adjust the Light Sensors polling period to something much faster like a few seconds, but don't forget to set it back to a more reasonable time period one the testing is complete!

While looking at the WipperSnapper Device page, or the Dashboard, cover the sensor / project to produce a few "low light" readings. Follow this up with some "strong light" readings by uncovering the sensor and exposing it to a light source (daylit window / torch / light).

On the dashboard you'll see the Gauge block value change and the Line Chart update with the new readings. The WipperSnapper Device page will show the Light Sensor value constantly updated with each new reading.

![](https://cdn-learn.adafruit.com/assets/assets/000/139/267/medium800thumb/raspberry_pi_20250829_124333_1-ezgif.com-optimize.jpg?1756476899)

Congratulations! You have a working light sensor transmitting data to the internet, hopefully that wasn't too stressful and you want a bit more... Check out our [other learn guides](https://learn.adafruit.com/category/adafruit-io) for some project ideas if your stuck.

A pretty common thing to try next is to create an automated [Action](https://io.adafruit.com/actions) to notify or trigger something else (by writing to another feed), like a display, motor or NeoPixel that run when the light sensor value is high or low enough.

# Adafruit IO Basics: Analog Input

## 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

### Raspberry Pi 5 - 4 GB RAM

[Raspberry Pi 5 - 4 GB RAM](https://www.adafruit.com/product/5812)
The Raspberry Pi 5&nbsp;is the newest Raspberry Pi computer, and the Pi Foundation knows you can always make a good thing _better_! And what could make the Pi 5 better than the 4? How about a&nbsp;_faster_ processor, USB 3.0 ports, and an updated Gigabit Ethernet chip with PoE...

In Stock
[Buy Now](https://www.adafruit.com/product/5812)
[Related Guides to the Product](https://learn.adafruit.com/products/5812/guides)
### Adafruit ESP32-S2 TFT Feather - 4MB Flash, 2MB PSRAM, STEMMA QT

[Adafruit ESP32-S2 TFT Feather - 4MB Flash, 2MB PSRAM, STEMMA QT](https://www.adafruit.com/product/5300)
We've got a new machine here at Adafruit, it can uncover your deepest desires. Don't believe me? I'll turn it on right now to prove it to you! What, you want unlimited mozzarella sticks? OK well, that's not something we can provide. But we can provide your...

In Stock
[Buy Now](https://www.adafruit.com/product/5300)
[Related Guides to the Product](https://learn.adafruit.com/products/5300/guides)
### Photo cell (CdS photoresistor)

[Photo cell (CdS photoresistor)](https://www.adafruit.com/product/161)
CdS cells are little light sensors. As the squiggly face is exposed to more light, the resistance goes down. When it's light, the resistance is about ~1KΩ, when dark it goes up to ~10KΩ.

To use, connect one side of the photocell (either one, it's symmetric) to power...

In Stock
[Buy Now](https://www.adafruit.com/product/161)
[Related Guides to the Product](https://learn.adafruit.com/products/161/guides)
### Through-Hole Resistors - 10K ohm 5% 1/4W - Pack of 25

[Through-Hole Resistors - 10K ohm 5% 1/4W - Pack of 25](https://www.adafruit.com/product/2784)
ΩMG! You're not going to be able to resist these handy resistor packs!&nbsp;Well, axially, they&nbsp;do all of the resisting for you!

This is a **25 Pack of 10K Ω Resistors.** More specifically, they are **carbon film** , through-hole...

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

[Breadboarding wire bundle](https://www.adafruit.com/product/153)
75 flexible stranded core wires with stiff ends molded on in red, orange, yellow, green, blue, brown, black and white. These are a major improvement over the "box of bent wires" that are sometimes sold with breadboards, and faster than stripping your own solid core wires. Makes...

In Stock
[Buy Now](https://www.adafruit.com/product/153)
[Related Guides to the Product](https://learn.adafruit.com/products/153/guides)
### Half Sized Premium Breadboard - 400 Tie Points

[Half Sized Premium Breadboard - 400 Tie Points](https://www.adafruit.com/product/64)
This is a cute, half-size breadboard with&nbsp;400 tie points, good for small projects. It's 3.25" x 2.2" / 8.3cm&nbsp;x 5.5cm&nbsp;with a standard double-strip in the middle and two power rails on both sides.&nbsp;You can pull the power rails off easily to make the breadboard as...

In Stock
[Buy Now](https://www.adafruit.com/product/64)
[Related Guides to the Product](https://learn.adafruit.com/products/64/guides)
### Adafruit Pi T-Cobbler Plus Kit Breakout for 2x20 Raspberry Pi

[Adafruit Pi T-Cobbler Plus Kit Breakout for 2x20 Raspberry Pi](https://www.adafruit.com/product/1989)
The Raspberry Pi A+/B+/Pi 2/Pi 3/Zero has landed on the Maker World like a 40-GPIO pinned, quad-USB ported, credit card sized bomb of DIY joy. And while you can use most of our great Model B accessories by hooking up our [downgrade cable,](https://www.adafruit.com/product/1986)...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1989)
[Related Guides to the Product](https://learn.adafruit.com/products/1989/guides)
### MCP3008 - 8-Channel 10-Bit ADC With SPI Interface

[MCP3008 - 8-Channel 10-Bit ADC With SPI Interface](https://www.adafruit.com/product/856)
Need to add analog inputs? This chip will add 8 channels of 10-bit analog input to your microcontroller or microcomputer project. It's super easy to use and uses SPI so only 4 pins are required. We chose this chip as a great accompaniment to the Raspberry Pi computer because it's fun...

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

## Related Guides

- [MCP3008 - 8-Channel 10-Bit ADC With SPI Interface](https://learn.adafruit.com/mcp3008-spi-adc.md)
- [Adafruit ESP32-S2 TFT Feather](https://learn.adafruit.com/adafruit-esp32-s2-tft-feather.md)
- [Quickstart: Adafruit IO WipperSnapper ](https://learn.adafruit.com/quickstart-adafruit-io-wippersnapper.md)
- [Quick Start: Pico W / 2W with WipperSnapper](https://learn.adafruit.com/quick-start-the-pico-w-with-wippersnapper.md)
- [itsaSNAP Apple Health Status Board](https://learn.adafruit.com/itssnap-apple-fitness-status-board.md)
- [PyLeap ESP32-S3 TFT Boxing Glove Tracker w/ Adafruit IO](https://learn.adafruit.com/esp32-s2-tft-boxing-glove-tracker-w-adafruit-io.md)
- [Adafruit IO Basics: Analog Output](https://learn.adafruit.com/adafruit-io-basics-analog-output.md)
- [itsaSNAP Daily Weather Forecast Board](https://learn.adafruit.com/itsasnap-daily-weather-forecast-board.md)
- [All the Internet of Things - Episode Four: Adafruit IO](https://learn.adafruit.com/all-the-internet-of-things-episode-four-adafruit-io.md)
- [Adafruit IO Basics: Color](https://learn.adafruit.com/adafruit-io-basics-color.md)
- [Feather TFT STEMMA Case](https://learn.adafruit.com/feather-tft-stemma-case.md)
- [No-Code Pool Party Notifier](https://learn.adafruit.com/pool-party-notification-device.md)
- [Where's My Friend? A Location-Aware Display with PyPortal and ItsASnap](https://learn.adafruit.com/where-s-my-friend-a-location-display-frame-with-pyportal.md)
- [Introducing Adafruit Feather](https://learn.adafruit.com/adafruit-feather.md)
- [No-Code Counters and Email Reports with Adafruit IO Actions](https://learn.adafruit.com/no-code-counters-and-email-reports-with-adafruit-io-actions.md)
- [How to use Blockly for Actions on Adafruit IO](https://learn.adafruit.com/how-to-use-blockly-for-actions-on-adafruit-io.md)
- [itsaSNAP by Adafruit](https://learn.adafruit.com/it-s-a-snap-by-adafruit.md)
