# IoT Motion and Temperature Logger with the Analog Devices ADXL343 + ADT7410 Sensor FeatherWing and Adafruit IO

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/073/529/medium800thumb/sensors_ezgif.com-gif-maker_%288%29.jpg?1553184508)

Upgrade any Feather board with motion and precision temperature sensing, with the Adafruit Sensor Featherwing. It sports two fantastic sensors from **[Analog Devices](https://www.analog.com/en/index.html): an [ADXL343 triple-axis accelerometer](https://www.adafruit.com/product/4097) and an [ADT7410 precision temperature sensor](https://www.adafruit.com/product/4089).**

**This FeatherWing can easily be brought&nbsp;_online_ using a Feather ESP8266 Huzzah and [Adafruit](http://io.adafruit.com)**[IO](http://io.adafruit.com)&nbsp;- you'll be up and running _in under 15 minutes!_

**If you're looking to for a way to monitor and send precise motion and temperature data to the cloud, follow along!**

![](https://cdn-learn.adafruit.com/assets/assets/000/073/525/medium800thumb/sensors_ezgif.com-gif-maker_%285%29.jpg?1553181639)

[Thanks to Digi-Key](https://www.digikey.com/)&nbsp;and&nbsp;[Analog Devices](https://www.analog.com/en/index.html)&nbsp;for sponsoring the development of this breakout board - we've made the PCB "[Digi-Key red](https://www.digikey.com/)" in their honor!

You'll be using the **Analog Devices ADT7410** built into the Temperature + Motion Wing to measure the ambient temperature over I2C.&nbsp;

![sensors_Pasted_Image_3_21_19__10_41_AM.png](https://cdn-learn.adafruit.com/assets/assets/000/073/521/medium640/sensors_Pasted_Image_3_21_19__10_41_AM.png?1553179411)

You'll also be using the **Analog Devices ADXL343** triple-axis accelerometer to monitor motion over I2C.&nbsp;The&nbsp;Analog Devices ADXL343&nbsp;has three axes of measurements: X, Y, and Z. You can set the sensitivity level to either +-2g, +-4g, +-8g or +-16g. The lower range gives more resolution for slow movements, the higher range is good for high speed tracking.&nbsp;

![sensors_Pasted_Image_3_21_19__10_41_AM.png](https://cdn-learn.adafruit.com/assets/assets/000/073/520/medium640/sensors_Pasted_Image_3_21_19__10_41_AM.png?1553179378)

## Adafruit IO

&nbsp;

**Adafruit IO is the easiest way to stream, log, and interact with your data.** &nbsp;It's built from the ground up to be easy to use - we do the hard stuff so you can focus on the fun stuff.

Data such as temperature and motion can be hard to visualize and quantify - Adafruit IO makes it simple. Send IO your data and it can store and display it using charts, graphs, gauges, and more!

![sensors_line_chart.png](https://cdn-learn.adafruit.com/assets/assets/000/073/532/medium640/sensors_line_chart.png?1553184710)

## Arduino Code and Libraries&nbsp;

&nbsp;

Bring the Adafruit Sensor FeatherWing to life using Arduino libraries for both sensors on the FeatherWing - the&nbsp;[ADXL343](https://github.com/adafruit/Adafruit_ADXL343)&nbsp;and the&nbsp;[ADT7410](https://github.com/adafruit/Adafruit_ADT7410).

To rapidly connect the Feather Huzzah to the internet, you'll be using use the&nbsp;[Adafruit IO Arduino library](https://github.com/adafruit/Adafruit_IO_Arduino).

![sensors_ardidess.png](https://cdn-learn.adafruit.com/assets/assets/000/072/240/medium640/sensors_ardidess.png?1551733771)

## Prerequisite Guides

If you're new to Adafruit IO, take a moment to walk through the following guides to get you started and up-to-speed:

- [Welcome to Adafruit IO](https://learn.adafruit.com/welcome-to-adafruit-io/)

## Parts

You're going to be working with the Adafruit ADXL343 + ADT7410 Sensor FeatherWing. _There's no wiring required_ - connect the FeatherWing to your HUZZAH and you can start working with the FeatherWing _immediately!&nbsp;_

### Adafruit ADXL343 + ADT7410 Sensor FeatherWing

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

Both sensors are connected over the...

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

The HUZZAH ESP8266 is the most popular board used for Adafruit IO projects. We suggest getting one which already has&nbsp;[stacking headers](https://www.adafruit.com/product/2830)&nbsp;attached to easily connect to the FeatherWing.

### Assembled Feather HUZZAH w/ ESP8266 WiFi With Stacking Headers

[Assembled Feather HUZZAH w/ ESP8266 WiFi With Stacking Headers](https://www.adafruit.com/product/3213)
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...

In Stock
[Buy Now](https://www.adafruit.com/product/3213)
[Related Guides to the Product](https://learn.adafruit.com/products/3213/guides)
![Angled shot of black, rectangular microcontroller with stacking headers.](https://cdn-shop.adafruit.com/640x480/3213-09.jpg)

## Materials

You'll need some extra supplies to finish this project. If you do not have them already, pick some up from Adafruit:

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

### Part: Feather Stacking Headers
quantity: 1
Stacking Headers for Feather - 12-pin and 16-pin female headers
[Feather Stacking Headers](https://www.adafruit.com/product/2830)

If you would like to power your IoT project wirelessly, you may want to pick up a LiPo battery, This one comes with a pre-attached 2-pin JST-PH connect so you can easily connect it to the JST on the Feather HUZZAH.&nbsp;

### Part: Lithium Ion Battery
quantity: 1
Lithium Ion Polymer Battery Ideal For Feathers - 3.7V 400mAh
[Lithium Ion Battery](https://www.adafruit.com/product/3898)

### Part: Micro LiPo Charger
quantity: 1
Adafruit Micro Lipo - USB LiIon/LiPoly charger - v1
[Micro LiPo Charger](https://www.adafruit.com/product/1304)

# IoT Motion and Temperature Logger with the Analog Devices ADXL343 + ADT7410 Sensor FeatherWing and Adafruit IO

## Adafruit IO Setup

## Feed Setup

If you do not already have an Adafruit IO account set up, head over to&nbsp;[io.adafruit.com](http://io.adafruit.com/)&nbsp;to link your Adafruit.com account to Adafruit IO.

The first step is to create a new Adafruit IO feed to hold the AD7410's temperature. Navigate to the&nbsp;[feeds page](https://io.adafruit.com/feeds)&nbsp;on Adafruit IO. Then click&nbsp; **Actions&nbsp;-\> Create New Feed** , and name this feed&nbsp; **temperature**.&nbsp;

- If you do not already know how to create a feed, head over to&nbsp;[Adafruit IO Basics: Feeds](https://learn.adafruit.com/adafruit-io-basics-feeds).

![](https://cdn-learn.adafruit.com/assets/assets/000/072/228/medium800/sensors_weather_tmp_Feed.png?1551723343)

You'll also need to **create three more feeds to hold the data for the ADXL343 accelerometer** - **_accelX_** , **_accelY_** , **_accelZ_** _.&nbsp;_

_Once you have four feeds created_, move to setting up a beautiful dashboard.&nbsp;

## Dashboard Setup&nbsp;

The next step is to create a dashboard to display the values read by the Motion + Temperature FeatherWing.&nbsp;&nbsp;

- If you do not know how to create or use Dashboards in Adafruit IO, head over to the&nbsp;[Adafruit IO Basics: Dashboards](https://learn.adafruit.com/adafruit-io-basics-dashboards)&nbsp;guide.

## Add a Gauge Block

The gauge block allows you to quickly view the current value of a numeric feed. You can set a minimum and maximum value for the gauge, and it will automatically scale the value to a percentage and display it graphically. The gauge will update automatically whenever a new value is pushed to the feed.

 **Select** the Gauge Block

![sensors_weather_IO_-_Feather_Huzzah___ADT7410_Gauge.png](https://cdn-learn.adafruit.com/assets/assets/000/072/230/medium640/sensors_weather_IO_-_Feather_Huzzah___ADT7410_Gauge.png?1551725247)

 **Select the temperature feed** you created earlier.

![sensors_weather_temperature.png](https://cdn-learn.adafruit.com/assets/assets/000/072/231/medium640/sensors_weather_temperature.png?1551725290)

In the Block Settings step,&nbsp; **set the Block Title to Temperature** ,&nbsp; **set the Gauge Min/Max Values to the upper and lower temperature thresholds** &nbsp;you want to measure.

You can label the gauge by setting the Gauge Label - this example assumes temperature is to be measured in Degrees C.

_Uncomfortably hot/cold?&nbsp;_You can optionally set the gauge change color to warn you if the temperature goes above (or below) a certain value.

![sensors_weather_IO_-_Feather_Huzzah___ADT7410.png](https://cdn-learn.adafruit.com/assets/assets/000/072/232/medium640/sensors_weather_IO_-_Feather_Huzzah___ADT7410.png?1551725324)

## Add a Number Slider Block

The number slider allows you to quickly change the numeric value of a feed. You can set the minimum and maximum values for the slider, as well as change the amount&nbsp;the slider will increment&nbsp;when you drag the handle.

 **Create a new number slider block&nbsp;** and **select the accelX feed** you created earlier.

![sensors_io_slider_config_1.png](https://cdn-learn.adafruit.com/assets/assets/000/072/227/medium640/sensors_io_slider_config_1.png?1551725924)

 **Name the block Accelerometer X**. From here, you can configure the minimum and the maximum values displayed by the slider.

![sensors_accelX.png](https://cdn-learn.adafruit.com/assets/assets/000/072/226/medium640/sensors_accelX.png?1551725961)

Next, **add two more_&nbsp;_sliders&nbsp;** to the dashboard. These sliders will be linked to&nbsp;the _AccelY_ and _AccelZ_ feeds you created earlier.

Once you're finished adding the sliders, your dashboard should look like the following screenshot:

![](https://cdn-learn.adafruit.com/assets/assets/000/073/533/medium800thumb/sensors_Kapture_2019-03-21_at_11.11.01.jpg?1553184802)

## Obtain your Adafruit IO Key

You are also going to need your **Adafruit IO username** and **secret API key**.

**Navigate to your profile and click the View AIO Key button** &nbsp; **to retrieve them**. Write them down in a safe place, you'll need them for the next step.

![](https://cdn-learn.adafruit.com/assets/assets/000/072/233/medium800thumb/sensors_weather_3d_printing_adafruit_io_username_and_password.jpg?1551726365)

Next, we'll move on to programming the Feather and using it with Adafruit IO.

# IoT Motion and Temperature Logger with the Analog Devices ADXL343 + ADT7410 Sensor FeatherWing and Adafruit IO

## Arduino Code

## Installation

To read data from the Motion and Temperature FeatherWing, you'll need to **install libraries for both of the ADXL343 and the ADT7410 sensors**.

**[To install the library for the ADXL343, visit this page](https://learn.adafruit.com/adxl343-breakout-learning-guide/arduino#installation-5-6)** and come back here when you have the library installed and tested.

Next,**&nbsp;[to install the library for the ADT7410, visit this page](https://learn.adafruit.com/adt7410-breakout/arduino#install-adafruit-adt7410-library-4-3)** and come back here when you have the library installed and tested.

This guide assumes you've completed the setup required to get your Adafruit Feather HUZZAH ESP8266 up and running with Arduino IDE and Adafruit IO.&nbsp;

- **If you haven't yet set up your&nbsp;Adafruit Feather HUZZAH ESP8266 for use with Adafruit IO and the Arduino IDE,&nbsp;[follow along with this guide](https://learn.adafruit.com/adafruit-io-basics-esp8266-arduino/arduino-io-library)**. The setup only needs to be performed once.

## Code
The code for this project is below. Copy and paste it into the Arduino IDE editor.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/adafruitio-temp-motion-wing/adafruitio-temp-motion-wing.ino

## Code Setup
Before you upload the sketch to the Huzzah, you'll need to configure the code for your network and Adafruit IO.

**Change&nbsp;`IO_USERNAME`** to **your Adafruit IO username.**

**Then, change&nbsp;`IO_KEY`** to **your Adafruit IO Key.**

![](https://cdn-learn.adafruit.com/assets/assets/000/072/234/medium800/sensors_weather_adafruitio_25_adt7410___Arduino_1_8_8.png?1551727720)

Next, we'll configure the code for your router. Change&nbsp;`WIFI_SSID`&nbsp;to your router's SSID and&nbsp;`WIFI_PASS`&nbsp;to your router's password.

![](https://cdn-learn.adafruit.com/assets/assets/000/072/239/medium800/sensors_adafruit-io-adt7410-adxl343_ino___Arduino_1_8_8.png?1551733416)

 **Save the code** (_CTRL/CMD + S_). Then, **verify** that the sketch compiles (_Tools -\> Verify_).&nbsp;

**Upload the sketch to your board** (_CTRL/CMD + U_) **.**

**Open the Arduino Serial Monitor**. The serial monitor should output that the sensors have been initialized and that the Feather Huzzah has connected to Adafruit IO:

```auto
Adafruit IO - ADT7410 + ADXL343
ADXL343 Initialized
ADT7410 Initialized!
Connecting to Adafruit IO: AdafruitIO::connect()
.
Adafruit IO connected.
```

The Huzzah reads temperature values from the ADT7410 and the accelerometer values from the ADXL343:

```auto
X: -0.55  Y: 0.12  Z: 9.85  m/s^2 
Temperature: 28.69C
```

And sends these values to Adafruit IO...

```auto
Sending to Adafruit IO...
Data sent!
Waiting 15 seconds.. 

```

The delay between sending this data is configurable (modify the `DELAY_SECONDS` definition at the top of the code to change it). If it's sending data too frequently (above 30 data points a minute for Adafruit IO Free users), you can increase the delay between sends.

![](https://cdn-learn.adafruit.com/assets/assets/000/073/528/medium800thumb/sensors_ezgif.com-gif-maker_%287%29.jpg?1553184229)

## Code Usage

Let's check that the data has been received by Adafruit IO. You can do this&nbsp;[by visiting the Adafruit IO Monitor page](https://io.adafruit.com/monitor). Every time the Huzzah sends data to Adafruit IO, this page shows the&nbsp;`temperature`, `accelX`, `accelY` or `accelZ`&nbsp;values.

![](https://cdn-learn.adafruit.com/assets/assets/000/073/527/medium800/sensors_monitor_page.png?1553184185)

Navigate to the dashboard you created earlier. You'll notice the Gauge block change values whenever the ADT7410 reports a new temperature to the Huzzah. As you tilt the Huzzah, you'll notice the sliders for X, Y, and Z changing their positions to reflect the ADXL343's values in m/s^2.

![](https://cdn-learn.adafruit.com/assets/assets/000/073/523/medium800thumb/sensors_ezgif.com-gif-maker_%285%29.jpg?1553181548)

## Taking it Further
### Data Visualization
While the sliders can provide immediate information about the ADXL343 or the ADT7410 on the FeatherWing at a glance - you may want to chart your data over a longer period of time or see a list of data with previous values on the dashboard.&nbsp;

**Connect&nbsp;[a Line Graph Block](https://learn.adafruit.com/adafruit-io-basics-dashboards/adding-blocks#line-graph-3-15)&nbsp;to the the four feeds**&nbsp;to view data from the sensors over any period of time - from real-time to 30 days.&nbsp;&nbsp;

![sensors_line_chart.png](https://cdn-learn.adafruit.com/assets/assets/000/073/522/medium640/sensors_line_chart.png?1553185238)

**Then,&nbsp;[add a Stream Block](https://learn.adafruit.com/adafruit-io-basics-dashboards/adding-blocks#stream-3-21)**&nbsp;and connect to any feed which you'd like to monitor. This block is a miniature version of the monitor page, but only displays feeds which you specify.&nbsp;

![sensors_line_chart.png](https://cdn-learn.adafruit.com/assets/assets/000/073/535/medium640/sensors_line_chart.png?1553185268)

## Adding a Battery
_Want to run your Feather without an attached USB Cable?_&nbsp;

For 100% wireless motion and temperature logging, pick up a Lithium Ion Polymer battery ([we recommend this one](https://www.adafruit.com/product/3898) - it's _ideal&nbsp;_for the Feather family) and connect it to the JST-PH port on the Feather ESP8266.

![sensors_feather_with_Batt.png](https://cdn-learn.adafruit.com/assets/assets/000/073/534/medium640/sensors_feather_with_Batt.png?1553185682)

# IoT Motion and Temperature Logger with the Analog Devices ADXL343 + ADT7410 Sensor FeatherWing and Adafruit IO

## Downloads

## Files:

- [EagleCad files on GitHub](https://github.com/adafruit/Adafruit-ADXL343-ADT7410-Featherwing-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20ADXL343%20%2B%20ADT7410%20Sensor%20FeatherWing.fzpz)

# Schematic
![](https://cdn-learn.adafruit.com/assets/assets/000/084/769/medium800/sensors_schem.png?1574443590)

# Fab Print
![](https://cdn-learn.adafruit.com/assets/assets/000/085/067/medium800/sensors_ADI_FeatherWing_Fab_Print.png?1574879192)


## Featured Products

### Adafruit ADXL343 + ADT7410 Sensor FeatherWing

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

Both sensors are connected over the...

In Stock
[Buy Now](https://www.adafruit.com/product/4147)
[Related Guides to the Product](https://learn.adafruit.com/products/4147/guides)
### Assembled Feather HUZZAH w/ ESP8266 WiFi With Stacking Headers

[Assembled Feather HUZZAH w/ ESP8266 WiFi With Stacking Headers](https://www.adafruit.com/product/3213)
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...

In Stock
[Buy Now](https://www.adafruit.com/product/3213)
[Related Guides to the Product](https://learn.adafruit.com/products/3213/guides)
### USB cable - USB A to Micro-B

[USB cable - USB A to Micro-B](https://www.adafruit.com/product/592)
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or microcontroller

Approximately 3 feet / 1 meter long

In Stock
[Buy Now](https://www.adafruit.com/product/592)
[Related Guides to the Product](https://learn.adafruit.com/products/592/guides)
### Lithium Ion Polymer Battery Ideal For Feathers - 3.7V 400mAh

[Lithium Ion Polymer Battery Ideal For Feathers - 3.7V 400mAh](https://www.adafruit.com/product/3898)
Lithium-ion polymer (also known as 'lipo' or 'lipoly') batteries are thin, light, and powerful. The output ranges from 4.2V when completely charged to 3.7V. This battery has a capacity of **400mAh** for a total of about 1.9 Wh. If you need a larger (or smaller!)...

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

## Related Guides

- [Adafruit ADXL343 + ADT7410 Sensor FeatherWing](https://learn.adafruit.com/adxl343-adt7410-sensor-featherwing.md)
- [3D Printed Case for Adafruit Feather](https://learn.adafruit.com/3d-printed-case-for-adafruit-feather.md)
- [CircuitPython 2FA TOTP Authentication Friend](https://learn.adafruit.com/circuitpython-totp-otp-2fa-authy-authenticator-friend.md)
- [Introducing Adafruit Feather](https://learn.adafruit.com/adafruit-feather.md)
- [Digi-Key IoT Studio Mini Smart Home](https://learn.adafruit.com/digikey-iot-studio-smart-home.md)
- [No-Code Offline Data Logger with WipperSnapper](https://learn.adafruit.com/no-code-offline-data-logging-with-wippersnapper.md)
- [NeoPixel Remote: IR Control with WLED](https://learn.adafruit.com/neopixel-remote-ir-control-with-wled.md)
- [Adafruit LSM9DS1 Accelerometer + Gyro + Magnetometer 9-DOF Breakout](https://learn.adafruit.com/adafruit-lsm9ds1-accelerometer-plus-gyro-plus-magnetometer-9-dof-breakout.md)
- [How to Add a New Sensor or Component to Adafruit IO WipperSnapper](https://learn.adafruit.com/how-to-add-a-new-component-to-adafruit-io-wippersnapper.md)
- [Motion Sensor Bat](https://learn.adafruit.com/motion-sensor-bat.md)
- [Wind Blowing Emoji Prop](https://learn.adafruit.com/wind-face-emoji.md)
- [Halloween Scream Box](https://learn.adafruit.com/halloween-scream-box.md)
- [No-Code DS18B20 Temperature Sensor with WipperSnapper](https://learn.adafruit.com/using-ds18b20-temperature-sensor-with-wippersnapper.md)
- [PyLeap CLUE Sensor Plotter](https://learn.adafruit.com/pyleap-clue-sensor-plotter.md)
- [Toy Car Speed Timer](https://learn.adafruit.com/toy-car-speed-timer.md)
