Weather Shield (DEV-13956) - Reading Errors

I recently purchased the SparkFun Weather Shield (DEV-13956) for use with the SparkFun RedBoard (DEV-13975).

I followed along verbatim the “Arduino Weather Shield Hookup Guide V12” and was excited to see I was getting readings. However, upon seeing the readings, I noticed the temperature and pressure sensors seem way off (See below).

tempf=-1766.2,

pressure=99087.50

Has anyone seen this before? Both the RedBoard and WeatheShield are brand new and never been outside.

Which example are you running? Was it this one: https://learn.sparkfun.com/tutorials/ar … re—basic

That sounds like the pressure IC isn’t communicating with your arduino.

Make sure your stack-able headers are soldered firmly to the shield and that you don’t have any shorts anywhere.

Hi Brandon,

Yes, that is the example I was running (I tire both examples without/with GPS).

Yellow-Dog,

As far as I can tell everything is all soldered up correctly.

I am still having issues with this shield. I checked all my solder connections and everything looks fine without any shorts.

It looks like I’m getting errors from both the embedded Si7021 and MPL3115A2 sensors because the temperature and pressure readings are way off.

Any ideas? Do we know what header pins these sensors connect so I can focus my search? Rain, wind, light, and battery pins are all labeled.

Both sensors connect to A4 and A5 on your RedBoard. Both also need the 5V, 3.3V and GND pins connected to the shield to function.

Those pins all look like they have a solid connection, is there another way to determine if the board is working?

Try the sketch [on this page with the shield installed on your RedBoard and copy paste what you’re seeing in your serial monitor for us to have a look at. :-)](Arduino Playground - I2cScanner)

TS-Chris:
Try the sketch [on this page with the shield installed on your RedBoard and copy paste what you’re seeing in your serial monitor for us to have a look at. :slight_smile:
[/quote]

Hi Chris,

Here are the results:

I2C Scanner

Scanning…

I2C device found at address 0x40 !

I2C device found at address 0x60 !

done](Arduino Playground - I2cScanner)

OK, so that’s good news. It means both sensors are alive and responding on the I2C bus.

Are you sure you’re using the correct code? We had a different version of this board that had different sensors on it and code for that version won’t work with the newer board.

See if this code returns temperature, pressure and humidity values:

/*
 Weather Shield Example
 By: Nathan Seidle
 SparkFun Electronics
 Date: June 10th, 2016
 License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).

 This example prints the current humidity, air pressure, temperature and light levels.

 The weather shield is capable of a lot. Be sure to checkout the other more advanced examples for creating
 your own weather station.

 Updated by Joel Bartlett
 03/02/2017
 Removed HTU21D code and replaced with Si7021
 */

#include <Wire.h> //I2C needed for sensors
#include "SparkFunMPL3115A2.h" //Pressure sensor - Search "SparkFun MPL3115" and install from Library Manager
#include "SparkFun_Si7021_Breakout_Library.h" //Humidity sensor - Search "SparkFun Si7021" and install from Library Manager

MPL3115A2 myPressure; //Create an instance of the pressure sensor
Weather myHumidity;//Create an instance of the humidity sensor

//Hardware pin definitions
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
const byte STAT_BLUE = 7;
const byte STAT_GREEN = 8;

const byte REFERENCE_3V3 = A3;
const byte LIGHT = A1;
const byte BATT = A2;

//Global Variables
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
long lastSecond; //The millis counter to see when a second rolls by

void setup()
{
  Serial.begin(9600);
  Serial.println("Weather Shield Example");

  pinMode(STAT_BLUE, OUTPUT); //Status LED Blue
  pinMode(STAT_GREEN, OUTPUT); //Status LED Green

  pinMode(REFERENCE_3V3, INPUT);
  pinMode(LIGHT, INPUT);

  //Configure the pressure sensor
  myPressure.begin(); // Get sensor online
  myPressure.setModeBarometer(); // Measure pressure in Pascals from 20 to 110 kPa
  myPressure.setOversampleRate(7); // Set Oversample to the recommended 128
  myPressure.enableEventFlags(); // Enable all three pressure and temp event flags

  //Configure the humidity sensor
  myHumidity.begin();

  lastSecond = millis();

  Serial.println("Weather Shield online!");
}

void loop()
{
  //Print readings every second
  if (millis() - lastSecond >= 1000)
  {
    digitalWrite(STAT_BLUE, HIGH); //Blink stat LED

    lastSecond += 1000;

    //Check Humidity Sensor
    float humidity = myHumidity.getRH();

    if (humidity == 998) //Humidty sensor failed to respond
    {
      Serial.println("I2C communication to sensors is not working. Check solder connections.");

      //Try re-initializing the I2C comm and the sensors
      myPressure.begin(); 
      myPressure.setModeBarometer();
      myPressure.setOversampleRate(7);
      myPressure.enableEventFlags();
      myHumidity.begin();
    }
    else
    {
      Serial.print("Humidity = ");
      Serial.print(humidity);
      Serial.print("%,");
      float temp_h = myHumidity.getTempF();
      Serial.print(" temp_h = ");
      Serial.print(temp_h, 2);
      Serial.print("F,");

      //Check Pressure Sensor
      float pressure = myPressure.readPressure();
      Serial.print(" Pressure = ");
      Serial.print(pressure);
      Serial.print("Pa,");

      //Check tempf from pressure sensor
      float tempf = myPressure.readTempF();
      Serial.print(" temp_p = ");
      Serial.print(tempf, 2);
      Serial.print("F,");

      //Check light sensor
      float light_lvl = get_light_level();
      Serial.print(" light_lvl = ");
      Serial.print(light_lvl);
      Serial.print("V,");

      //Check batt level
      float batt_lvl = get_battery_level();
      Serial.print(" VinPin = ");
      Serial.print(batt_lvl);
      Serial.print("V");

      Serial.println();
    }

    digitalWrite(STAT_BLUE, LOW); //Turn off stat LED
  }

  delay(100);
}

//Returns the voltage of the light sensor based on the 3.3V rail
//This allows us to ignore what VCC might be (an Arduino plugged into USB has VCC of 4.5 to 5.2V)
float get_light_level()
{
  float operatingVoltage = analogRead(REFERENCE_3V3);

  float lightSensor = analogRead(LIGHT);

  operatingVoltage = 3.3 / operatingVoltage; //The reference voltage is 3.3V

  lightSensor = operatingVoltage * lightSensor;

  return (lightSensor);
}

//Returns the voltage of the raw pin based on the 3.3V rail
//This allows us to ignore what VCC might be (an Arduino plugged into USB has VCC of 4.5 to 5.2V)
//Battery level is connected to the RAW pin on Arduino and is fed through two 5% resistors:
//3.9K on the high side (R1), and 1K on the low side (R2)
float get_battery_level()
{
  float operatingVoltage = analogRead(REFERENCE_3V3);

  float rawVoltage = analogRead(BATT);

  operatingVoltage = 3.30 / operatingVoltage; //The reference voltage is 3.3V

  rawVoltage = operatingVoltage * rawVoltage; //Convert the 0 to 1023 int to actual voltage on BATT pin

  rawVoltage *= 4.90; //(3.9k+1k)/1k - multiple BATT voltage by the voltage divider to get actual system voltage

  return (rawVoltage);
}

Hi Chris,

I’ve pasted the results below. It looks like the humidity and temp_h values are okay. The Pressure and temp_p variables are still giving the showing the same erroneous values. Maybe it’s just the MPL3115A2 board that is having issues?

Weather Shield Example

Si7021 Found

Weather Shield online!

Humidity = 43.85%, temp_h = 78.56F, Pressure = 99606.25Pa, temp_p = -1766.20F, light_lvl = 0.16V, VinPin = 4.09V

Humidity = 43.75%, temp_h = 78.50F, Pressure = 99645.00Pa, temp_p = -1766.20F, light_lvl = 0.19V, VinPin = 4.09V

Humidity = 43.72%, temp_h = 78.54F, Pressure = 99594.00Pa, temp_p = -1766.20F, light_lvl = 0.15V, VinPin = 4.10V

Humidity = 43.67%, temp_h = 78.50F, Pressure = 99611.00Pa, temp_p = -1766.20F, light_lvl = 0.14V, VinPin = 4.10V

Humidity = 43.66%, temp_h = 78.54F, Pressure = 99638.50Pa, temp_p = -1766.20F, light_lvl = 0.19V, VinPin = 4.12V

Humidity = 43.64%, temp_h = 78.56F, Pressure = 99612.00Pa, temp_p = -1766.20F, light_lvl = 0.17V, VinPin = 4.16V

Humidity = 43.60%, temp_h = 78.58F, Pressure = 99617.25Pa, temp_p = -1766.20F, light_lvl = 0.14V, VinPin = 4.13V

Humidity = 43.55%, temp_h = 78.58F, Pressure = 99668.50Pa, temp_p = -1766.20F, light_lvl = 0.19V, VinPin = 4.17V

Humidity = 43.53%, temp_h = 78.60F, Pressure = 99648.75Pa, temp_p = -1766.20F, light_lvl = 0.18V, VinPin = 4.17V

Humidity = 43.49%, temp_h = 78.56F, Pressure = 99605.25Pa, temp_p = -1766.20F, light_lvl = 0.15V, VinPin = 4.11V

Thanks

OK, your pressure actually looks good, that tells me your testing location is somewhere between approximately 350 to 550 feet above sea level.

As for temp_p, I’m not absolutely sure but that sounds like an error somewhere in our code examples or library. I’ll see if we can get that tracked down, but since the humidity sensor is already providing temperature, (temp_h) you don’t really need a second reading from a sensor that’s 1/4" away. I’d just ignore that until we can track down the bug in the code/library. If you don’t want it printing, just comment out these lines in the code to suppress the -1766.20F, from showing up.

      Serial.print(" temp_p = ");
      Serial.print(tempf, 2);
      Serial.print("F,");

I just purchased The Weather Shield and am having the same issue. I have read through the forums and noticed several others have the same issue. I am curious if there is a solution.

I have used the “Weather Shield Example By: Nathan Seidle Date: November 16th, 2013” and the version provided in this thread “Updated by Joel Bartlett 03/02/2017 Removed HTU21D code and replaced with Si7021” - and both give me the -1766.20F for temperature.

When I load the “SparkFun Si7021 Breakout Example” it seems to report the correct temperature every time.

There are some differences in the code.

SparkFun Si7021 Breakout Example<<<<<<

int power = A3;

int GND = A2;

pinMode(power, OUTPUT);

pinMode(GND, OUTPUT);

tempf = sensor.getTempF();

and

Weather Shield Example<<<<<<<<<

const byte REFERENCE_3V3 = A3;

const byte BATT = A2;

pinMode(REFERENCE_3V3, INPUT);

tempf = myPressure.readTempF();

My 11 yr old is hoping to use this weather station for an Earth Day project (on April 15th), so any help with this is very much appreciated! Other than this we LOVE this board and weather station.

On line 293 of the code posted below, shouldn’t we be pulling the temperature from the humidity sensor instead of the pressure sensor? Switching the line to “tempf = myHumidity.readTempF();” returns much better results. I can’t compare the shield readings to actual temperature readings at the moment. The readings I get are about 10 degrees off, but that is likely due to how/where I have mounted my sensor.

https://github.com/sparkfun/Weather_Shi … on_V12.ino