Coder Social home page Coder Social logo

sparkfun / weather_shield Goto Github PK

View Code? Open in Web Editor NEW
67.0 61.0 67.0 579 KB

Barometric pressure, temperature, humidity and light sensing weather shield for Arduino.

Home Page: https://www.sparkfun.com/

License: Other

C++ 100.00%
sparkfun-products humidity temperature weather arduino-platform arduino

weather_shield's Introduction

SparkFun Weather Shield

SparkFun Weather Shield

SparkFun Weather Shield (DEV-13956)

Weather Shield is an Arduino shield that gathers relative humidity, barometric pressure, temperature, light intensity, as well as optional rain, wind direction, and wind speed (using optional external weather gauges).

Repository Contents

  • /Firmware - Example Arduino sketch to demostrate how to read from the various sensors.
  • /Fritzing - Fritzing Example wiring images
  • /Hardware - All the Eagle PCB design files (.brd, .sch).
  • /Production - Test bed files and production panel files

Documentation

Product Versions

Version History

  • v1.2 - Latest Version
  • v1.1 - Initial Release

License Information

This product is open source!

Please review the LICENSE.md file for license information.

If you have any questions or concerns on licensing, please contact [email protected].

Distributed as-is; no warranty is given.

  • Your friends at SparkFun.

weather_shield's People

Contributors

adamsilva avatar bboyho avatar elizabethsrobert avatar javacasm avatar nseidle avatar robert-hunke avatar santaimpersonator avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

weather_shield's Issues

Commented line #234 prevents working with GPS in Weather_Shield_with_GPS_V12.ino

The fact that line #234 is commented out at the end of loop() prevents firmwareWeather_Shield_with_GPS_V12.ino from reading GPS if attached. This problem is present in both the repo code and the code embedded in the tutorial page "Arduino Weather Shield Hookup Guide V12".

Uncommenting this line seems to fix things, at least with the specified GPS.

Feature Request: 3.3V compatibility

Just a future consideration for the shield. Utilize the IOREF/AREF pins to make the shield compatible with our 3.3V boards:

Currently, the windvane direction is pulled up to 5V. This causes issues when a 3.3V ADC tries to read that pin (reading is maxed out). (*I didn't look into the annemometer and rain gauge pins, but I assume that utilizing IOREF would be optimal for those pins as well.)

Memory optimizations

I've integrated the weathershield with an Uno and Xbee using SoftSerial to communicate. Including the Xbee and SoftSerial libraries was a challenge due to the SRAM memory useage of the example sketch. I cleaned up a number of the memory usage problems and have others to go, but thought I'd raise the issue here for discussion before I create a pull request:

  • Use flash memory whenever possible. Convert all print strings by putting them into the F() macro.
  • Reduce averaging array size. E.g. wind averaging arrays are 120 ints in size. They can be reduced in size, samples taken less frequently or "averages of averages" can be used.
  • Use constants and defines instead of values. "120", "199", "10" are used repeatedly throughout the code for array and iteration size. Constants defined at the top would allow more control.

BTW: Really impressed with how quickly this shield, hardware and example came up and ran. Good job.

Example includes don't match library file names

When compiling the Weather Shield example, I noticed that the includes:

include "MPL3115A2.h" //Pressure sensor

include "HTU21D.h" //Humidity sensor

needed to be changed to

include "SparkFunMPL3115A2.h" //Pressure sensor

include "SparkFunHTU21D.h" //Humidity sensor

Not sure which is correct (lib names or includes)

Error in Weather_Shield_Weather_Station.ino where "windspeedmph" reads "0.0"

There have been customers reporting that the variable "windspeedmph" is constantly reporting "0.0". This is an error in the code Weather_Shield_Weather_Station.ino [ https://github.com/sparkfun/Weather_Shield/blob/master/firmware/Weather_Shield_Weather_Station/Weather_Shield_Weather_Station.ino ].

Looking at the sequence of code, it appears that whoever originally wrote the code did not update the global variable windspeedmph for the printWeather() function. Line 226 was commented out in calcWeather() because the function get_wind_speed() was already called in the loop function. The value was saved in the local variable called currentSpeed on line 178:

//Calc the wind speed and direction every second for 120 second to get 2 minute average
float currentSpeed = get_wind_speed();
.
.
.

By saving the value from currentSpeed to the global variable, the global variable windspeedmph was able to update and display a value other than "0.0":

//Calc the wind speed and direction every second for 120 second to get 2 minute average
float currentSpeed = get_wind_speed();
windspeedmph = currentSpeed;//update global variable for windspeed when using the printWeather() function
.
.
.

Verifying windspeedmph

You can verify that the value is correct by uncommenting out lines 356-358 and removing "/" and "/":

/* Serial.println();
Serial.print("Windspeed:");
Serial.println(windSpeed);*/

Keep in mind that the the value printed in calcWeather() outputs to the nearest hundredth while printWeather() outputs to the nearest tenth. This is due to the way serial.print() is called [ https://www.arduino.cc/en/Serial/Print ] . The default has the Arduino print to two decimal places. In printWeather(), the code specifies printing to the one decimal place.

v12 checklist issues

(1) Per the standard, it would be nice if the "STAT1" and "STAT2" nets had a bend in them so that the flag could come straight out from the net while reading horizontally.

(2) Most parts have no PROD_ID

(3) The design loaded with an old DRC, and running the a new DRC results in errors

(4) There are air-wires in the design

(5) BRD contains Proportional text

Double Check v12

  1. Are any jumpers labeled clearly by their function and possible settings? [NO]
    comment: The Jumper for the Pressure Interrupt is labeled nicely on the board, but not on the schematic.

  2. Is the board dimension outline correct thickness? (0.008 inch) [NO]
    comment: The top edge dimension lines are .01

  3. Does it pass SparkFun DRC? [NO]
    comment: No but we're cool. Same restrict issues as the Photon Weather Shield.

  4. Does it pass DRC with top/bottom keepout layers on? [NO]
    comment: It's cool.

  5. Do all packages have NAME and VALUE? [NO]
    comment: Nope, it's fine.

  6. Is the polarity label outside of the package for visibility after part population? [NO]
    comment: No but it's cool.

  7. The labels on Diodes D8, D10, and D5 are missing.

Instantenous wind speed reported as 0 or NaN

I set up my Redboard and Weathershield, and attached my weather sensors via the RJ-11 jack.

I compiled and uploaded the code, and receive accurate temperature, humidity and pressure readings.
I also receive accurate wind direction readings.

But the wind speed (instantaneous) returns either 0 or NaN.

Here is the example serial monitor output when spinning the anemometer -

$,winddir=45,windspeedmph=nan,windgustmph=0.0,windgustdir=0,windspdmph_avg2m=0.0,winddir_avg2m=0,windgustmph_10m=0.0,windgustdir_10m=0,humidity=41.9,tempf=78.4,rainin=0.00,dailyrainin=0.00,pressure=100737.25,batt_lvl=4.42,light_lvl=0.30,#

$,winddir=45,windspeedmph=0.0,windgustmph=0.0,windgustdir=0,windspdmph_avg2m=0.0,winddir_avg2m=1,windgustmph_10m=0.0,windgustdir_10m=0,humidity=41.9,tempf=78.5,rainin=0.00,dailyrainin=0.00,pressure=100735.50,batt_lvl=4.42,light_lvl=0.28,#

I commented out lines 335 to 337 to try debugging a bit.
When I do this, the WindSpeed is printed twice, once as 0 and once as the correct speed.

$,winddir=225,windspeedmph=0.0,windgustmph=0.0,windgustdir=0,windspdmph_avg2m=0.9,winddir_avg2m=36,windgustmph_10m=12.1,windgustdir_10m=225,humidity=42.3,tempf=77.7,rainin=0.00,dailyrainin=0.00,pressure=100745.75,batt_lvl=4.42,light_lvl=0.33,#
Loop call:

Windspeed:5.48
Wind clicks:0
calcWeather call:

Windspeed:0.00
Wind clicks:0

$,winddir=225,windspeedmph=0.0,windgustmph=0.0,windgustdir=0,windspdmph_avg2m=1.0,winddir_avg2m=38,windgustmph_10m=12.1,windgustdir_10m=225,humidity=42.3,tempf=77.6,rainin=0.00,dailyrainin=0.00,pressure=100742.25,batt_lvl=4.42,light_lvl=0.30,#
Loop call:

Windspeed:4.53
Wind clicks:0
calcWeather call:

Windspeed:0.00
Wind clicks:0

Further research reveals that get_wind_speed() is called twice, once in the main loop and once within calcWeather().
I added a few debug readings, and I believe the correct WindSpeed is printed within the main loop.
For some reason, the get_wind_speed() called within calcWeather() returns 0.

Am I missing something obvious?

It seems like the problem is related to the averaging of wind speed values over time.

I used the code directly from here.

Please help, thanks.
Let me know if there are more questions.

Thanks!

New Si7021 library release

Hi everyone, I just bought recently a pair of weather shields to build weather stations and I wanted to try them today. I have installed the necessary libraries (Si7021, MPL3115A2 and Weather Meter Kit) but when I try to either simply verify or upload the Weather Shield firmware example, I get a compiling issue which says basically the following :

error: 'Weather' does not name a type
error: 'myHumidity' was not declared in this scope

It's depending of the line 26 of the .ino code, which is :

Weather myHumidity;//Create an instance of the humidity sensor

It seems pretty strange as all libraries are properly installed, and I did not change any single line of the code. I also didn't see any trace of that issue anywhere of the web, so I don't really know what to do. Can someone help me with that please ? Thanks and have a nice day !

Getting wrong data?

$,winddir=-1,windspeedmph=nan,windgustmph=0.0,windgustdir=0,windspdmph_avg2m=5.7,winddir_avg2m=-1,windgustmph_10m=6.2,windgustdir_10m=-1,humidity=998.0,tempf=-1766.2,rainin=7.78,dailyrainin=7.79,pressure=-999.00,batt_lvl=inf,light_lvl=nan,#

Error in GPS Example Code for Longitude

Customer brought up an error in the SFE Forums [ https://forum.sparkfun.com/viewtopic.php?f=14&t=39246#p176148 ]. GPS example code [ https://github.com/sparkfun/Weather_Shield/blob/master/firmware/Weather_Shield_with_GPS/Weather_Shield_with_GPS.ino ] has an error in the code when printing the variable name with the variable. Instead of saying longitude=, the code says that the latitude is equal to the longitude's value on line 445:

Serial.print(",lat=");
Serial.print(gps.location.lat(), 6);
Serial.print(",lat=");
Serial.print(gps.location.lng(), 6);

It should probably say:

Serial.print(",lat=");
Serial.print(gps.location.lat(), 6);
Serial.print(",lng=");
Serial.print(gps.location.lng(), 6);

Getting wrong readings

Hi,

I connected the weather shield to sparkfun redboard plus and ran the example program "Weather_Shield_Basic_V12". I am getting incorrect readings.

Is there something that I should do first before executing the program or something wrong with hardware? Anyhelp would be appreciated.

Humidity = -5.81%, temp_h = -51.85F, Pressure = -999.00Pa, temp_p = -1766.20F, light_lvl = 2.14V, VinPin = 12.08V
Humidity = -5.81%, temp_h = -51.85F, Pressure = -999.00Pa, temp_p = -1766.20F, light_lvl = 2.19V, VinPin = 11.91V
Humidity = -5.81%, temp_h = -51.85F, Pressure = -999.00Pa, temp_p = -1766.20F, light_lvl = 2.19V, VinPin = 12.08V
Humidity = -5.81%, temp_h = -51.85F, Pressure = -999.00Pa, temp_p = -1766.20F, light_lvl = 2.08V, VinPin = 12.90V

Thanks.

does not compile.

Didn't understand why.I have already installed the TinyGPSlus library, but still error.
Compile time error.

Weather_Shield_with_GPS:27: error: 'TinyGPSPlus' does not name a type
Weather_Shield_with_GPS.ino: In function 'void smartdelay(long unsigned int)':
Weather_Shield_with_GPS:240: error: 'gps' was not declared in this scope
Weather_Shield_with_GPS.ino: In function 'void printWeather()':
Weather_Shield_with_GPS:444: error: 'gps' was not declared in this cope

can someone help?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.