Comments: RETIRED - Photon Weather Shield Hookup Guide

Pages

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • Member #692424 / about 10 years ago * / 1

    New issue with the Photon Weather Shield examples. Using the latest 0.4.4.rc3 Photon firmware the on board barometric and humidity sensor now seem to work on multiple readings. However there is a significant issue in the coded examples. Specifically the barometric sensor can provide both altitude and barometric pressure readings. In order to get altitude you must "setModeAltitude" and you get accurate Altitude readings but BOGUS Barometric readings. If you change the "setMode" to "setModeBarometric" you get accurate Barometric readings but BOGUS Altitude readings. The guide code needs to be rewritten to provide accurate samples of both Altitude and Barometric readings. It clearly does not do that at the present time and the guide doesn't explain this problem but implies that both readings are accurate.

    Update: Since I am putting the weather shield in a fixed location (presume most users will be this use case) I simply commented out "seModeAltitude" and uncommented out "SetModeBarometric", I also commented out reporting (printLn etc.) of altitude data. Now I get accurate readings for barometric pressure and no bogus altitude data. It would be nice if the guide example supported both valid readings in examples but this solution will work for me.

    • Joel_E_B / about 10 years ago / 1

      Hi, you are correct that the tutorial was misleading. It is being rewritten to update the examples and be more explicit about the altitude vs barometric modes. It will also have an updated version of the libraries so that only one library is needed to control both I2C sensors on the Weather Shield. Thank you for your feedback. The updated tutorial should be live by tomorrow (8/21).

  • If you are using the Particle Build online IDE and see this error:

    SparkFun_MPL3115A2/SparkFun_MPL3115A2.cpp:41:31: fatal error: SparkFunMPL3115A2.h: No such file or directory #include "SparkFunMPL3115A2.h"
    

    It's because you need to have an underscore "" on line 41 in the _SparkFun_MPL3115A2.cpp code:

    #include "SparkFunMPL3115A2.h"
    

    You just need change it to:

    #include "SparkFun_MPL3115A2.h"
    

    Note: GitHub repository requires a couple of pushes for some strange reason before the changes take affect online for the Particle Libraries.

  • Member #692424 / about 10 years ago / 1

    So another issue has cropped up. It is related to the " I2C_Address_ScannerDev.ino". I have a temperature probe hooked up to the Photon Weather Shield. The file compiles on the cloud fine. However, when I try to flash the file to the Photon on the Weather Shield I get the following error every time: "undefined reference to "Spark_Idle_Events" and "system_task.h:45:0"

    The guide indicates that you need to run the AdressScanner in order to enter the address into the main weather shield .ino file so it can find the temperature probe. Please advise on how to fix this?

    • Joel_E_B / about 10 years ago / 1

      Hi, I've found the cause of your error. On line 12, the call to Spark_WLAN_Loop() is now depreciated and must be replaced with Spark.process(). So the whole line should look like this: while(!Serial.available()) Spark.process(); I will be updating the github files soon. That line just pauses the serial port until any key is pressed. It is not necessary for the code to work.

    • It probably has to do with the I2C lines in the firmware. There was an firmware revision that broke the I2C lines.

      "The Particle team has a fix that will be released to the public soon, either later this week or early next week. This update will be distributed automatically through their cloud platform when it’s ready; thanks for your patience!"

      • Member #692424 / about 10 years ago * / 1

        Nope, I don't think so. I have the latest firmware 0.4.4.rc3(released yesterday) that fixes I2C functionality-yea! I can now get multiple readings from the onboard sensors. However the I2C_address_Scanner.ino still fails with the same error. Try it with the new firmware and you should be able to replicate the issue.

        • Joel_E_B / about 10 years ago / 1

          Hi, I've found the cause of your error. On line 12, the call to Spark_WLAN_Loop() is now depreciated and must be replaced with Spark.process(). So the whole line should look like this: while(!Serial.available()) Spark.process(); I will be updating the github files soon. That line just pauses the serial port until any key is pressed. It is not necessary for the code to work.

  • Member #699013 / about 10 years ago / 1

    I have this same issue; I do not have an I2C sensor.

    -3277.5591 -1766.2000 998 -999.0000 0.0000 1042 -196.6000 1828 2015-07-31T03:33:06.155Z -1 269.8491 70.4750 42 336.5000 0.0000 1155 -196.6000 68 2015-07-31T02:40:15.893Z -1

    • Yeah, there was a firmware revision that flipped the I2C lines around. This broke the library that was working before this update. Particle is currently working on a fix and there should be a a fix soon. They will be pushing the update through the Particle Build online IDE and will fix the issue when flashing new code. There is another fix but you would need to go through the command line interface. This is more difficult to do and I don't recommend using the command line interface. The best would be to wait until the push by Particle online within the next week or so.

    • Member #692424 / about 10 years ago / 1

      There are two I2C sensors built into the board, one humidity and temperature and one pressure/altitude and temperature. There is a bug in the Photon firmware related to the I2C bus. Particle is suppose to release a firmware upgrade next week and hopefully it will fix the I2C issue among other things. I also understand you should be able to update firmware through the Web IDE.

  • Member #692424 / about 10 years ago / 1

    First, let me say the board is a very cool design and the hookup guide is well written. However, I am having problems with this shield. Running the Basic program from the hookup guide I get the following bogus data: I get this on the serial monitor "Temp:31.10F, Humidity:998.00%, Pressure:-999.00Pa, Altitude:-3277.56ft." Clearly not accurate. What is going on? I have two weather shields and they both report the same bad information on the serial monitor.

    • Joel_E_B / about 10 years ago / 1

      Hi, sorry you're having trouble. I think I may know what the issue is. Can you post a copy of your Setup() function here?

      • Joel_E_B / about 10 years ago / 1

        Also, are you using Particle Dev or Particle Build?

        • Member #692424 / about 10 years ago / 1

          Also, running on Mac OS 10.10.4-I can connect to Particle Cloud, flash the Photon and connect to the serial output via a USB connection.

          void setup() { Serial.begin(9600); // open serial over USB at 9600 baud

          //Initialize both on-board sensors
          //Initialize both on-board sensors
          while(! htu.begin()){
              Serial.println("HTU21D not found");
              delay(1000);
          }
          Serial.println("HTU21D OK");
          
          while(! baro.begin()) {
                Serial.println("MPL3115A2 not found");
                delay(1000);
           }
           Serial.println("MPL3115A2 OK");
          
           //MPL3115A2 Settings
           //baro.setModeBarometer();//Set to Barometer Mode
           baro.setModeAltimeter();//Set to altimeter Mode
          
           baro.setOversampleRate(7); // Set Oversample to the recommended 128
           baro.enableEventFlags(); //Necessary register calls to enble temp, baro ansd alt
          

          } //--------------------------------------------------------------- void loop() { //Get readings from all sensors calcWeather(); //Rather than use a delay, keeping track of a counter allows the photon to //still take readings and do work in between printing out data. count++; //alter this number to change the amount of time between each reading if(count == 5)//prints roughly every 10 seconds for every 5 counts { printInfo(); count = 0; } } //--------------------------------------------------------------- void printInfo() { //This function prints the weather data out to the default Serial Port

          //Take the temp reading from each sensor and average them.
          Serial.print("Temp:");
          Serial.print((tempf+baroTemp)/2);
          Serial.print("F, ");
          
          //Or you can print each temp separately
          /*Serial.print("HTU21D Temp: ");
          Serial.print(tempf);
          Serial.print("F, ");
          Serial.print("Baro Temp: ");
          Serial.print(baroTemp);
          Serial.print("F, ");*/
          
          
          Serial.print("Humidity:");
          Serial.print(humidity);
          Serial.print("%, ");
          
          
          Serial.print("Pressure:");
          Serial.print(pascals);
          Serial.print("Pa, ");
          
          Serial.print("Altitude:");
          Serial.print(altf);
          Serial.println("ft.");
          

          } //--------------------------------------------------------------- void getTempHumidity() { float temp = 0;

          temp = htu.readTemperature();
          tempf = (temp * 9)/5 + 32;
          
          humidity = htu.readHumidity();
          

          } //--------------------------------------------------------------- void getBaro() { baroTemp = baro.readTempF();//get the temperature in F

          pascals = baro.readPressure();//get pressure in Pascals

          altf = baro.readAltitudeFt();//get altitude in feet } //--------------------------------------------------------------- void calcWeather() { getTempHumidity(); getBaro(); } //---------------------------------------------------------------

        • Member #692424 / about 10 years ago / 1

          I am using Particle Dev

          • Joel_E_B / about 10 years ago / 1

            Ok, that checks out. Are you using a Photon or a Core? If you're suing a Photon, how long have you had it? Did it update its own firmware when you powered it up out of the box? We think there may be some issues with the I2C communication. We're currently investigating.

            • Member #692424 / about 10 years ago / 1

              It is a brand new Photon that just arrived yesterday. I did follow the setup procedure with the Photon and did the led blink test. I2C problems make sense given the bad data. I will check to see if I can force an update. I believe it did do an update when I powered it up and registered it. Any suggestions are welcome. I also have another Photon arriving in the next day or two and several more coming in early August. Hopefully we can resolve this with an appropriate update. Thanks for your help Joel!

              • Joel_E_B / about 10 years ago / 1

                Thank you for your patience. We've tested our code with several Photons on different weather shields and can replicate your issue, which was non-existent during our initial tests before release. Using a different library for the MPL3115A2 gives the same results. However, testing it on a Core, it hasn't shown any errors. Thus, our conclusion is that there is an error on Particle's end regarding I2C for the Photon, which they've acknowledged and have addressed. I will reach out to them to see if there is a new issue or if the old problems have come back. We will let you know as soon as we have an answer.

                • Member #692424 / about 10 years ago / 1

                  So this is interesting. I tested the code below for the HTU21D on the Adafruit breakout board (F version) AND the SparkFun Weather Shield and they both WORK using the latest 0.4.3 Photon firmware. They both provide continuous accurate output of humidity and temperature via serial. I have also tested the Adafruit BMP180 library and code (available in Photon Build) and that does not work on the SparkFun Weather Shield-still need to test it with the Adafruit BMP 180 breakout board. Others had reported that updating the firmware to 0.4.3 fixed problems with the HTU21D which apparently it does. Is it possible that the problem lies with timing or multiple I2C devices on the bus? I will be testing with the Adafruit BMP 180 alone and in combination with the Adafruit HTU21D-F boards. This would replicate the basic humidity, temperature and pressure functionality of the SparkFun Photon Weather Shield-basic guide example.

                  // This #include statement was automatically added by the Spark IDE.

                  include "HTU21D/HTU21D.h"

                  HTU21D htu = HTU21D();

                  void setup() { Serial.begin(9600);

                  Serial.println("HTU21D test");
                  
                  while(! htu.begin()){
                      Serial.println("HTU21D not found");
                      delay(1000);
                  }
                  
                  Serial.println("HTU21D OK");
                  

                  }

                  void loop() { Serial.println("==================="); Serial.print("Hum:"); Serial.println(htu.readHumidity()); Serial.print("Temp:"); Serial.println(htu.readTemperature()); Serial.println();

                  delay(1000);
                  

                  }

                  • Member #692424 / about 10 years ago / 1

                    BTW, I realize that the BMP 180 code should not work with the weather shield since it uses the MPL3115A2. I have an MPL315A2 breakout on order from Adafruit which I will test also.

                    • Joel_E_B / about 10 years ago / 1

                      We have conformed that there are some I2C issues with the most recent version of the Photon's firmware. We are pushing out a work around for our libraries until the problem is fixed.

                      • Member #692424 / about 10 years ago / 1

                        Great, I will be happy to test it as soon as it is available. Thanks! Bill

                • Member #692424 / about 10 years ago / 1

                  Any update on the status of a fix for the I2C functionality? Wondering when it might be fixed as I can't proceed without it. Thanks. Bill

                  • Joel_E_B / about 10 years ago / 1

                    Hi Bill. We've made Particle aware of the issue. We've tested the breakout versions of the same sensors that are on the weather shield with several different Photons and have gotten the same results, so we are confident it is not a hardware issue on the shield and must lie in the I2C firmware on the Photons. The Particle engineers have seen the issue themselves and are working on a solution. We will post an update on all outlets once we know more. Sorry for the inconvenience.

                    • Joel_E_B / about 10 years ago / 1

                      The latest Photon Firmware has lots of fixes in it. You can find it here, along with instructions on how to push the update yourself. Or the Particle will be pushing out the new firmware in an auto update in the very near future.

                • Member #692424 / about 10 years ago / 1

                  Thanks Joel. I also have several I2C sensors (humidity, UV, Lux, temperature, pressure all as small breakouts). I could hang any of these off the I2C on the weather board but I suspect that Particle has a problem with the I2C on the Photon (since you replicated my issue). Hopefully they can fix it with a firmware update. Basically I am stuck until they do. Best, Bill


If you've found an issue with this tutorial content, please send us your feedback!