sparkfun / photon_weather_shield Goto Github PK
View Code? Open in Web Editor NEWA weather shield for the Particle Photon.
A weather shield for the Particle Photon.
Note that "winddir" in the sample code is parsed by the value of the ADC ranges into eight integers 0-7 representing N,NE,E,SE,S,SW,W,NW. The sample code then uses these 0-7 integers to select the correct direction text to output to the serial line. However Weather Underground is expecting "winddir" to be an integer between 0-360 representing a direction in degrees. A simple solution is to replace the integers 0-7 in the get_wind_direction with the direction in degrees, 0, 45, 90,135,180,225,270,315. The same directional integer values can be substituted for the 0-7 values in the serial print routine. Note also that the get_wind_direction routine returns a "-1" if it fails to return one of the defined adc range values. This is a problem for Weather Underground as a -1 is considered an inappropriate value for wind direction and the site will be flagged for reporting inaccurate data. You should avoid uploading any wind directional data values outside the 0-360 range to Weather Underground.
-JP1
-JP2
-JP3
Hi,
On an ARM processor the temperature is not converted from the two byte registers into a float correctly and the sign is not extended resulting in a large positive number when the temperature goes below zero.
The issue occurs in the rawToCelisius method, where it a sixteen bit integer into a four byte float. I'm guessing the casting of the 16-bit integer raw to a float must first cast to a 4 byte integer without sign-extending the upper two bytes, which then results in a larger positive integer (versus a small negative integer) before it is converted to a float.
// convert from raw to Celsius
float DallasTemperature::rawToCelsius(int16_t raw)
{
if (raw <= DEVICE_DISCONNECTED_RAW)
return DEVICE_DISCONNECTED_C;
// C = RAW/128
return (float)raw * 0.0078125;
}
I was able to get negative results by doing the following:
int temp4 = RAW; // on ARM this is a 4byte integer, upper two bytes zero
if (RAW&0x8000) { // check high bit of RAW to see if negative
temp4 = temp4 | 0xFFFF0000; // sign extend to upper 2 bytes for negative
} else {
temp4 = temp4 & 0x0000FFFF; // sign extend to upper 2 bytes for positive
}
return (float) temp4* 0.0078125; // convert to floating
I'm not a a great programmer, but I figure someone who is can update the library so that it will work properly on 32-bit, 16-bit and 8-bit processors.
thanks,
Jim Kardach
Anyone else seeing the rain IRQ trigger incorrectly? I see the code has some basic debounce code to it, so I doubt that's the issue. Is the sensor that sensitive to vibration/high wind gusts?
Are you somehow able to hook up the sparkfun photon weather shield to an arduino genuino uno?
Thanks in advance
hi
sensors.begin();
does not compile.
all sensorS should be sensor. S is wrong. Error introduced with soil temperature code
this error is in all ino files made 11 months ago. Took me a while to find it.
switch all if spacing allows
I'm new to GitHub so I'm sorry if I'm not following protocol ;-)
In the file 'SparkFun_Photon_Weather_Basic_Soil_Meters.ino' I've noticed that the value 'dailyrainin' (rain inches so far today in local time) never gets reset. I've made this small addition to my code towards the bottom of 'loop()':
currentTime = Time.now();
if ((Time.hour(currentTime) == 0) && (Time.minute(currentTime) == 0) && (Time.second(currentTime) == 0)){
DailyRainIn = 0;
}
@danfein Hi, just so you're aware, I combined the HTU21D, Si7021 and MPL3115A2 libraries into one library, found here: https://github.com/sparkfun/SparkFun_Photon_Weather_Shield_Particle_Library. This was mostly to eliminate the need to import two libraries while using the Particle Build IDE. It was also created to support both the HTU21D and Si7021 temp/humidity sensors. We had to switch to the SI7021 on some of our batches due to shortages of the HTU and to meet our deadline with Microsoft. We will be switching the Si chip in a future revision of the shield, so this allows the end user to use both version so the shield seamlessly. If you want to incorporate that new library into your example, fell free. Thanks again.
I modified the X to post several variables up to Weather Underground. I'm noticing the windspeedmph variable has very few values: 0, 7.2, 14.5, etc. Is anyone else noticing the same thing?
-U2
-U3
-U2
-U3
(1) The "SDA" trace is exposed by the tSTOP of R5. The trace could be moved down to eliminate excessive tSTOP related trace exposure.
(2) The "3.3V" trace is exposed by pin 4 of the MPL. The trace could be moved down to eliminate excessive tSTOP related trace exposure.
(3) It looks like the Si7021 package is missing tSTOP for the center pad, but does have a tCREAM polygon. As it stands, it looks like we will be pasting onto mask where the center pad will should be. This is also present in the Weather Shield which uses the same package.
No Sparkfun logo in the schematic
Needs version number in the schematic
Trace sizing ranges: board contains traces that are 16mil, 12mil, 10mil, and 8mil. Looks like the 16mil is used for power lines, but there doesn't seem to be much reasoning for the variation on the other trace sizes. It should be mentioned that I don't think any of the sizing stuff will affect the boards function.
You don't have your name in the schematic as the designer, just thought it worth mentioning
Need standoffs added to "Measures"
that's it
When (As a Noob), I follow the instruction on the SparkFun website, there is a mismatch in what I expect to see.
SparkFun's Tutorial indicates I should find code like this:
/////////////////////////PHANT STUFF///////////////
const char server[] = "data.sparkfun.com";
const char publicKey[] = "yourPublicKey";
const char privateKey[] = "yourPrivateKey";
Phant phant(server, publicKey, privateKey);
//////////////////////////////////////
I am aware that the placeholder text is to be replaced.
I made the replacements in the section starting on line 25 (26, 27,28). This is the result I get when I run a compile in the online IDE:
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp: In member function 'float Weather::readPressure()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:320:22: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
if(IIC_Read(STATUS) & (1<<2) == 0) toggleOneShot(); //Toggle the OST bit causing the sensor to immediately take another reading
^
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:324:25: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
while(IIC_Read(STATUS) & (1<<2) == 0)
^
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp: In member function 'float Weather::readBaroTemp()':
SparkFun_Photon_Weather_Shield_Library/SparkFun_Photon_Weather_Shield_Library.cpp:360:22: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
if(IIC_Read(STATUS) & (1<<1) == 0) toggleOneShot(); //Toggle the OST bit causing the sensor to immediately take another reading
^
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::Phant(String, String, String)': SparkFunPhant/SparkFunPhant.cpp:25: multiple definition of
Phant::Phant(String, String, String)'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:30: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::Phant(String, String, String)': SparkFunPhant/SparkFunPhant.cpp:25: multiple definition of
Phant::Phant(String, String, String)'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:30: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::add(String, String)': SparkFunPhant/SparkFunPhant.cpp:32: multiple definition of
Phant::add(String, String)'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:37: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::add(String, char)': SparkFunPhant/SparkFunPhant.cpp:39: multiple definition of
Phant::add(String, char)'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:44: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::add(String, int)': SparkFunPhant/SparkFunPhant.cpp:46: multiple definition of
Phant::add(String, int)'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:51: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::add(String, unsigned char)': SparkFunPhant/SparkFunPhant.cpp:53: multiple definition of
Phant::add(String, unsigned char)'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:58: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::add(String, long)': SparkFunPhant/SparkFunPhant.cpp:60: multiple definition of
Phant::add(String, long)'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:65: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::add(String, unsigned int)': SparkFunPhant/SparkFunPhant.cpp:66: multiple definition of
Phant::add(String, unsigned int)'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:71: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::add(String, unsigned long)': SparkFunPhant/SparkFunPhant.cpp:72: multiple definition of
Phant::add(String, unsigned long)'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:77: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::add(String, double, unsigned int)': SparkFunPhant/SparkFunPhant.cpp:78: multiple definition of
Phant::add(String, double, unsigned int)'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:83: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::add(String, float, unsigned int)': SparkFunPhant/SparkFunPhant.cpp:85: multiple definition of
Phant::add(String, float, unsigned int)'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:90: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::queryString()': SparkFunPhant/SparkFunPhant.cpp:92: multiple definition of
Phant::queryString()'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:97: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::url()': SparkFunPhant/SparkFunPhant.cpp:96: multiple definition of
Phant::url()'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:101: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::get()': SparkFunPhant/SparkFunPhant.cpp:107: multiple definition of
Phant::get()'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:112: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::post()': SparkFunPhant/SparkFunPhant.cpp:117: multiple definition of
Phant::post()'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:122: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::clear()': SparkFunPhant/SparkFunPhant.cpp:133: multiple definition of
Phant::clear()'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:138: first defined here
../../../build/target/user/platform-6/libuser.a(SparkFunPhant.o): In function Phant::particlePost()': SparkFunPhant/SparkFunPhant.cpp:144: multiple definition of
Phant::particlePost()'
../../../build/target/user/platform-6/libuser.a(weatheronlinesimple1.o):weatheronlinesimple1.cpp:149: first defined here
collect2: error: ld returned 1 exit status
make: *** [69df6f089b6a2ca2c5f74458a1bca8b479eef178bb9fdd69c4e20aa2cca0.elf] Error 1
Error: Could not compile. Please review your code.
Are any jumpers labeled clearly by their function and possible settings? [YES]
comment: SJ3 Jumper has a spelling error "dissconnect" instead of "disconnect".
Have you verified that the BOM in Sparkle is accurate (also checking for PROD_ID, NAME, VALUE, PREFIX)? [YES]
comment: Missing CONN-09696 on the BOM and CONN-13002 is on the Sparkle Page but not on the BOM
Does it pass SparkFun DRC? [NO]
comment: No but we cruised through all 250+ errors and it's cool Joel.
Do all footprints have 0.008 inch silk footprint? [NO]
comment: Nope but its cool.
Is the polarity label outside of the package for visibility after part population? [NO]
comment: NO but it's cool.
The values for Diodes D8, D10, and D6 overlap nearby nets!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.