Weather Shield Hookup Guide

Contributors: Nate
Favorited Favorite 2

Weather Shield Overview

The Weather Shield is an easy to use Arduino shield that grants you access to barometric pressure, relative humidity, luminosity, and temperature. There are also connections to optional sensors such as wind speed/direction, rain gauge, and GPS for location and super accurate timing.

Weather Shield

The bare Weather Shield

Things you should know about this shield:

Suggested Reading

Hooking It Up

To get up and running with the Weather Shield you’ll need the following parts:

Weather shield with wind and rain meter

Shield on a RedBoard with optional weather meter (‘W'ind and 'R'ain cables) and GPS attached


Solder the stackable headers onto the shield, and insert the shield into your Arduino. You are welcome to solder in the RJ11 connectors to the top of the board as well. If you have the GP-635T GPS module, don’t worry about attaching it at this time, we’ll get to GPS later.

Example Firmware - Basic

To get started immediately here is a Codebender example that uses the MPL3115A2 and HTU21D libraries.

Hit connect once you’ve uploaded the example code to see the output from the Weather Shield

You should see the following output:

Humidity = 28.12%, temp_h = 29.54C, Pressure = 84051.25Pa, temp_p = 82.85F, light_lvl = 0.96V, VinPin = 4.40V
Humidity = 28.36%, temp_h = 29.54C, Pressure = 84052.50Pa, temp_p = 82.96F, light_lvl = 0.96V, VinPin = 4.40V
Humidity = 28.46%, temp_h = 29.56C, Pressure = 84050.25Pa, temp_p = 82.96F, light_lvl = 0.96V, VinPin = 4.40V
Humidity = 28.24%, temp_h = 29.54C, Pressure = 84051.25Pa, temp_p = 82.96F, light_lvl = 0.96V, VinPin = 4.40V

Put your hand over the small clear device labeled ‘Light’ and watch the light level change to 0. Blow lightly on the humidity sensor and watch the humidity change.


If there is an error you will see:

I2C communication to sensors is not working. Check solder connections.

This message appears when the board is unable to get a response from the I2C sensors. This could be because of a faulty solder connection, or if there are other devices on the A5/A4 lines (which are also called SDA/SCL).

Using the Arduino IDE

If you are using the Arduino IDE the Weather Shield example relies on the HTU21D and MPL3115A2 libraries. As of Arduino v1.6.x you can download the libraries through the Arduino Library Manager. Search for and install “SparkFun MPL3115” and “SparkFun HTU21D”. For more information see our tutorial on using the Arduino library manager.

Example Firmware - Weather Station

For the more adventurous we have the Weather Station example. This code demonstrates all the bells and whistles of the shield. You will need a weather station hooked up to see the wind speed, wind direction and rain values change.

Hit connect and you should see an output string every second containing the current weather information:





The $ and # are start and stop characters. These types of bytes are used to make it easy to parse out the data. For example, you could have an Electric Imp listen for a $ and record the data until you see a #. Once you have the string then split on the commas (also known as comma delimited), and start recording the next string.

Arduino IDE

If you prefer the Arduino IDE you can get the latest Weather Shield sketches on the github repo here.

Example with GPS

Weather Shield with GPS

Shield on a RedBoard with optional weather meter connectors and GPS attached

Attach the GP-635T GPS module using the short cable. To secure the module, there is space on the shield to attach the module using double-stick tape.

Picture of serial switch

Serial pins are connected to digital pins 4 and 5 when Serial is set to soft and are attached to the internal UART when set to hard.

There is a switch labeled Serial on the shield. This is to select which pins on the Arduino to connect the GPS to. In almost all cases the switch should be set to ‘Soft’. This will attach the GPS serial pins to digital pins 5 (TX from the GPS) and 4 (RX into the GPS).

Grab the GPS example sketch that demonstrates using the GP-635T with all the other sensors. Load it onto your Arduino, and open the serial monitor at 9600. You should see output similar to the following:




Note: The batt_lvl is indicating 4.08V. This is correct and is the actual voltage read from the Arduino powered over USB. The GPS module will add 50-80mA to the overall power consumption. If you are using a long or thin USB cable you may see significant voltage drop similar to this example. There is absolutely no harm in this! The Weather Shield runs at 3.3V and the Arduino will continue to run just fine down to about 3V. The reading is very helpful for monitoring your power source (USB, battery, solar, etc).

This example demonstrates how you can get location, altitude, and time from the GPS module. This would be helpful with weather stations that are moving such as balloon satellites, AVL, package tracking, and even static stations where you need to know precise altitude or timestamps.

Resources and Going Further

The Weather Shield example firmware outputs regular barometric pressure. This is very different from the pressure that weather stations report. For more information, see the definition of “altimeter setting pressure”. For an example of how to calculate altimeter setting type barometric pressure see the MPL3115A2 hook-up guide. Also checkout the MPL3115A2 library, specifically the BarometricHgInch example.


There’s a lot of technology on this shield. Here’s the datasheets in case you need to reference them:

Additional resources and projects to checkout: