WeatherPiArduino Weather BoardWeatherPiArduinoLogoShaded

NEW!!!!  Version 2 product page is here.
Comments are now closed.   Please go to the Product Support Forum at the top of the page.

[include-page id=”buy-include-file”]

The WeatherPiArduino Weather board is now available and in stock!

WeatherRack Weather Sensors now available.

Outdoor Temperature and Humidity Sensors now available.

Weather
WeatherPiArduino

WeatherPiArduino is a weather station controller board designed to interface to Arduino and Raspberry Pi computers.  It is an interface board developed by SwitchDoc Labs to allow the user to easily build a fully functioned Weather Station while allowing customization of functions.

WeatherPiArduino is derived from Project Curacao.  Generation 1 of this board was deployed and tested in Curacao before Generation 2 was released to production.  The full WeatherPiArduino article was published in Raspberry Pi Geek magazine in September, 2014 and a follow up article will be published in April, 2015 (including the new lightning detector).  The WeatherPiArduino comes with a SwitchDoc Labs DS3231/EEPROM board.

WeatherPiArduino with Included DS3231/EEPROM
WeatherPiArduino with Included DS3231/EEPROM

Combine the WeatherPiArduino with a SunAir or SunAirPlus board to create a solar powered weather station.

Software for WeatherPiArduino Board

Arduino Software is here.

Arduino Software for the WeatherRack and WeatherPiArduino is here.

Raspberry Pi Software is here.

WeatherRack Software is here.

Specification

WeatherPiArduino in Solar Powered WeatherPi
WeatherPiArduino in Solar Powered WeatherPi

You can download the Full WeatherPiArduino Product Specification here  (Note:   The Arduino Mega Fritzing diagram in the specification has a mistake.  The line from the WeatherPiArduino should plug into GPIO 18 on the Arduino Mega board and NOT GPIO 5 as shown!).

WeatherPiArduino

WeatherPiArduino Fully Populated
WeatherPiArduino Fully Populated

Fritzing Diagrams

(Note:   The Arduino Mega Fritzing diagram has a mistake.  The line from the WeatherPiArduino should plug into GPIO 18 on the Arduino Mega board and NOT GPIO 5 as shown!  On the Pi connection diagram, the pink line is NOT needed.   GPIO17 is for connecting to the external Dual WatchDog timer.   Why we have it connected to A2 of the ADS1015 ADC is beyond us in that diagram. )

 

WPA-ArduinoUNO_bbLogo WPA-RaspberryPiB+_bbLogo WPA-ArduinoMega_bbLogo

 

Block Diagram

 

Weather
WeatherPiArduino Block Diagram

It was specifically designed to interface with the SwitchDoc WeatherRack, ArgentData Weather Sensors,  SparkFun Weather Meters SEN-08942 along with auxiliary I2C units.

Interfaces on WeatherPiArduino Board

  • I2C for Raspberry Pi
  • I2C for Arduino
  • RJ11 Plugs installed for SwitchDoc Labs WeatherRack, etc.
  • Wind Vane, Rain Bucket, Anemometer computer connections for Raspberry Pi and Arduino

I2C devices Included with the WeatherPiArduino Board

Plug in I2C Interfaces provided

  • Embedded Adventures I2C Lightning Detector MOD-1016 board
  • Adafruit HTU21D-F Temperature/Humidity breakout board
  • Adafruit 32KB FRAM I2C breakout board
  • Adafruit ADS1015 4 Channel A/D I2C board

I2C Device Specifications

BMP180 (Barometer / Temperature)

DS3231 (Real Time Clock)

AT24C32 (EEPROM)

ADS1015 (12 bit ADC)

AS3935 (MOD-1016 – Lightning Detector)

HTU21D-F (Humidity)

FRAM (32KB Fast Non-Volatile Storage)

Software

SwitchDoc Labs has now released the first version of the Arduino C++ Class software for the WeatherPiArduino board.   You can find it here on the switchdoclabs github.  The Raspberry Pi Pure Python Software is here.

Version 1.0 contains support for the WeatherRack Sensors.

This board will interface with both the Raspberry Pi and the Arduino.  The Arduino software library has now been released.  The Raspberry Pi software is now released.

The SDL_Weather_80422 class library for Arduino is located on github at https://github.com/switchdoclabs/SDL_Weather_80422

Want to build a control panel for the WeatherPiArduino?  Look at this post and the picture below:

WeatherPiArduino RasPiConnect
WeatherPiArduino RasPiConnect Control Panel
SparkFun
SwitchDoc Labs WeatherRack Sensors

The SDL_Weather_80422 class library is designed to provide all the functions of the SwitchDoc WeatherRack, ArgentData Weather Sensors,  SparkFun Weather Meters SEN-08942 in one C++ class.

The library is easy to use and hides the complexity of the interface to the sensors.  The C++ class has two Interrupt Service Routines (ISR), one each for the anemometer and the rain bucket.  The wind vane is connected to an Analog to Digital Converter (ADC) input pin on the Arduino.  Note that the C++ class is designed to be a singleton, in other words, you only can interface one sensor package without some additional work (mostly involving Interrupts).  The article in Raspberry Pi Geek magazine discusses this in detail.

There are two main modes for the class.

SDL_MODE_SAMPLE

SDL_MODE_SAMPLE mode means return immediately after asking for the wind speed. The wind speed is averaged at sampleTime or since you last asked, whichever is longer. If the sample time has not passed since the last call, the class returns the last calculated wind speed. That means that you will never see changes faster than the specified sample time. This allows you to not wait for the wind speed, you can just grab the last valid reading.

SDL_MODE_DELAY

SDL_MODE_DELAY mode means to wait for the set sample time to expire and return the average wind speed at the expiration. You would use this if you want to make sure you have the latest value and your program architecture allows you to pause for the sample time before continuing. Which mode you use depends on the specific software architecture of your Arduino application.

Typically, I use SDL_MODE_SAMPLE because I can tolerate not having a current value of wind speed.

The example code for the SDL_Weather_80422 library is shown below:

/*
SDL_Weather_80422_Library.ino - Example for using SDL_Weather_80422 Library
For SwitchDoc Labs WeatherRack 
Weather Sensor Assembly 80422 Argent Data Systems
SparkFun
Created by SwitchDoc Labs July 27, 2014.
Released into the public domain.
*/
#include 
#include

#include "SDL_Weather_80422.h"

#define pinLED 13 // LED connected to digital pin 13
#define pinAnem 18 // Anenometer connected to pin 18 - Int 5
#define pinRain 2 
#define intAnem 5
#define intRain 0

// for mega, have to use Port B - only Port B works.
/*
Arduino Pins PORT
------------ ----
Digital 0-7 D
Digital 8-13 B
Analog 0-5 C
*/


// initialize SDL_Weather_80422 library
SDL_Weather_80422 weatherStation(pinAnem, pinRain, intAnem, intRain, A0, SDL_MODE_INTERNAL_AD);


uint8_t i;


float currentWindSpeed;
float currentWindGust;
float totalRain;
void setup()
{ 
Serial.begin(57600); 

Serial.println("-----------");
Serial.println("WeatherPiArduino SDL_Weather_80422 Class Test");
Serial.println("Version 1.0");
Serial.println("-----------");


weatherStation.setWindMode(SDL_MODE_SAMPLE, 5.0);
//weatherStation.setWindMode(SDL_MODE_DELAY, 5.0);
totalRain = 0.0;
}


void loop()
{
Serial.println("----------------");

currentWindSpeed = weatherStation.current_wind_speed()/1.6;
currentWindGust = weatherStation.get_wind_gust()/1.6;
totalRain = totalRain + weatherStation.get_current_rain_total()/25.4;
Serial.print("rain_total=");
Serial.print(totalRain);
Serial.print(""" wind_speed=");
Serial.print(currentWindSpeed);
Serial.print("MPH wind_gust=");
Serial.print(currentWindGust);
Serial.print("MPH wind_direction=");
Serial.println(weatherStation.current_wind_direction());


delay(1000);


}

When you run this, you should get a result similar to this:

-----------

WeatherArduino SDL_Weather_80422 Class Test
Version 1.0

-----------
----------------
rain_total=0.00 wind_speed=13.20MPH wind_gust=12.40MPH wind_direction=90.00
----------------
rain_total=0.00 wind_speed=9.60MPH wind_gust=9.48MPH wind_direction=90.00
----------------
rain_total=0.00 wind_speed=10.20MPH wind_gust=9.23MPH wind_direction=90.00
----------------
rain_total=0.00 wind_speed=11.10MPH wind_gust=9.84MPH wind_direction=90.00

176 Comments

  1. Hello again! Being even more eager to start my Pi-based weather station project, but being concerned about the complexity involved, I am very curious if you have considered the following modification/enhancement to your WeatherPiArduino weather board: replace the (included) BMP180 and (optional) HTU21D-F modules with the brand-new ‘3-in-1’ BME280 module?

  2. In the pictures on your site, I see a final wired set up, but in the docs I haven’t been able to see the actual configuration you used
    (esp. with the code examples). Is there a doc, or good description of how exactly this is wired up? Trying to leverage what you’ve done and not get caught with stupid wiring mistakes.

    Thanks!

  3. Any ETA on when it will be out?
    I’ve just ordered the “other” boards to fully flush out the shield…

    • Earl,

      Maybe I’m confused. You are talking bout the wirelist for connection for which configuration?

      1) WeatherPiArduino to Raspberry Pi

      2) WeatherPiArduino to Arduino

      3) The Whole WeatherPi Solar Powered system using the WeatherPiArduino?

      John

  4. WeatherPIArduino to Arduino.

    I’ve got the WeatherPiArduino and DS3231 clock already.
    Also have the SparkFun sensors (windspeed, wind direction and rain gauge).

    Ordered the two Ada Fruit boards (and Lightniing sensor) today.

    I’ve got an Arduino UNO ready to start with… but not clear on how to wire things.
    Looks like I have to add some headers at a minimum… but would like to fully understand the wiring before I even do that.

  5. No I didn’t see that… that’s EXACTLY what I was looking for.

    I was thinking of installing headers for the various add on boards. A rough dry fit seems to indicate that would fix the issue you’re talking about
    (so makes it an even better thought 🙂 ).

    Thanks a lot!

  6. I’m finally getting around to putting together my WeatherPiArduino and WeatherRack after purchasing several months back. 🙂

    I have additionally installed the HTU21D-F humidity sensor and MOD-1016 Lightning detector.
    I’m working from your Mega2560 instructions and I have some confusion about the documentation.

    The product specification shows the weatherstation peripherals leaving the board through JP2 (page 9; WeatherPiARduino Board Jumper Pin and Plug Locations).
    And JP2-1 to A0, JP2-2 to D2, JP2-3 to D5, JP2-4 to Gnd (page 19; Connecting an Arduino Mega 2560 to the WeatherPiArduino Board).

    Also on page 9, a documentation error: Pin 1 designator wrong for JP4.

    I’m confused about the signal directions listed on page 12; JP2 – WeatherOut, either the direction for RainBucket or Anemometer is wrong, based on WindVane being an output (input to Arduino). I think all 3 pins are outputs, inputs to Arduino. Also, there is a note in the product spec. that the RainBucket and Anemometer are “Not Debounced”, yet the service interrupt routines in the library seem to imply there is something implemented – 1ms? Can you please clarify?

    I’m trying to better understand how RainBucket and Anemometer are functioning, a schematic would be nice.

    Using Anemometer as an example, is the interrupt it generates due to an un-buffered, inductive pulse generated by the contact closing as the magnet moves past a switch? And if I were to put a scope on it, likely the next step, I would see slow edges, the rise and decay of the pulse?

    I can read the outputs from the BMP180 and the HTU21D-F just fine. I haven’t made an attempt yet on the RTC, Memory or Lightning Detector.
    I currently working on the WeatherStation inputs. I am seeing wild variations in readings for all, Wind Speed, Wind Gust, wind Direction, and Total rain.

    The example code of the pin assignments for the Mega2560 are a bit confusing and the download doesn’t match the documentation shown on your web site.
    I think the confusing part is the pin assignments versus the interrupts available on those pins:
    “#define PinAnem 18” is actually INT3 on the Mega2560, which makes “#define intAnem 5” wrong.

    So now to my real issues..
    I’m actually using a MoteinoMega from LowPowerLab.com instead of the Arduino Mega2560. Maybe you can comment on my notes…
    MoteinoMega operated at 3.3V, so I think I should use JP4 with pullups for I2C instead of JP10?
    MoteinoMega has only interrupts 0-2, 0 & 1 are available, but aren’t at least one of these already used for millis() and micros()?

    I didn’t say above, but I sometimes see readings that I would consider reasonable, but most times not. Which is why I am thinking apart from levels (3.3 vs. 5.0 for I2C), I am having interrupt issues. Any thoughts on this?

    It looks like interrupts will be an issue unless I use a Mega2560, or make hardware and software modifications to support.

    I may get burned on the time it takes to read pins, but here is what I am thinking I will have to do to move forward with MoteinoMega:
    I was thinking to create a Interrupt Mux. With an interrupt Mux I would only need one Arduino pin for interrupts, but will need additional digital pins to detect which input caused the interrupt. I have a circuit design in mind for this. Like I mentioned , the microseconds required to read a pins state “might” be an issue.
    Also, I would need to modify the SDL_Weather_80422 library, specifically the way the interrupts get serviced.

    I’m still new to the interrupts, I am hoping that this is not the issue, but I am leaning that way. Any thoughts/comments appreciated.

    • +++
      Wow! A true missive. Comments are between “+++” and “—”

      I’m finally getting around to putting together my WeatherPiArduino and WeatherRack after purchasing several months back. 🙂

      I have additionally installed the HTU21D-F humidity sensor and MOD-1016 Lightning detector.
      I’m working from your Mega2560 instructions and I have some confusion about the documentation.

      The product specification shows the weatherstation peripherals leaving the board through JP2 (page 9; WeatherPiARduino Board Jumper Pin and Plug Locations).
      And JP2-1 to A0, JP2-2 to D2, JP2-3 to D5, JP2-4 to Gnd (page 19; Connecting an Arduino Mega 2560 to the WeatherPiArduino Board).

      +++
      This is correct. You can use other pins if you modify the software.

      Also on page 9, a documentation error: Pin 1 designator wrong for JP4.

      +++
      We have just checked the spec and the Pin 1 designator is correct for JP4. Pin 1 is SCL.

      I’m confused about the signal directions listed on page 12; JP2 – WeatherOut, either the direction for RainBucket or Anemometer is wrong, based on WindVane being an output (input to Arduino). I think all 3 pins are outputs, inputs to Arduino. Also, there is a note in the product spec. that the RainBucket and Anemometer are “Not Debounced”, yet the service interrupt routines in the library seem to imply there is something implemented – 1ms? Can you please clarify?

      +++
      Yes, that is a typo. The Anemometer is an Output too.

      The specification refers to the fact that the outputs are not debounced in hardware. They are debounced in software in the interrupt service routines.

      I’m trying to better understand how RainBucket and Anemometer are functioning, a schematic would be nice.

      +++
      Good suggestion. We will include one in the next revision of the specification. FYI, the Rainbucket is a tipping bucket with a magnetic reed switch and the anemometer has a reed switch with a magnet rotating around closing it on each rotation.

      Using Anemometer as an example, is the interrupt it generates due to an un-buffered, inductive pulse generated by the contact closing as the magnet moves past a switch? And if I were to put a scope on it, likely the next step, I would see slow edges, the rise and decay of the pulse?

      +++
      You absolutely will be able to see this, however, you will see multiple pulses because of the bouncing contacts.

      I can read the outputs from the BMP180 and the HTU21D-F just fine. I haven’t made an attempt yet on the RTC, Memory or Lightning Detector.
      I currently working on the WeatherStation inputs. I am seeing wild variations in readings for all, Wind Speed, Wind Gust, wind Direction, and Total rain.

      +++

      It’s likely a software problem. check your software setup carefully. Put debug statements in to see what is going on.

      The example code of the pin assignments for the Mega2560 are a bit confusing and the download doesn’t match the documentation shown on your web site.
      I think the confusing part is the pin assignments versus the interrupts available on those pins:
      “#define PinAnem 18″ is actually INT3 on the Mega2560, which makes “#define intAnem 5″ wrong.

      +++
      We will take a look at that. We have run this software on the Mega2560 without problems, but some error could very easily have slipped in

      So now to my real issues..
      I’m actually using a MoteinoMega from LowPowerLab.com instead of the Arduino Mega2560. Maybe you can comment on my notes…
      MoteinoMega operated at 3.3V, so I think I should use JP4 with pullups for I2C instead of JP10?
      MoteinoMega has only interrupts 0-2, 0 & 1 are available, but aren’t at least one of these already used for millis() and micros()?

      +++
      That’s a good question. I can’t tell what they are doing from their website and the documenation is not available. I do know that a number of the Arduino “compatible” board guys don’t do the interrupts the same. Even the Arduino.cc site is confusion about the interrupts.

      I didn’t say above, but I sometimes see readings that I would consider reasonable, but most times not. Which is why I am thinking apart from levels (3.3 vs. 5.0 for I2C), I am having interrupt issues. Any thoughts on this?

      +++
      Something else is using the Interrupts, perhaps. 3.3V or 5.0V should both work.
      You are reading the anemometer correctly? If so, then it has to do with Interrupts. BTW, putting Serial.print statements in Interrupt Service Routines is not a good idea. Weird things happen.

      It looks like interrupts will be an issue unless I use a Mega2560, or make hardware and software modifications to support.

      +++
      If you have one around, debug your software on the Mega2560, a known, documented board.

      I may get burned on the time it takes to read pins, but here is what I am thinking I will have to do to move forward with MoteinoMega:
      I was thinking to create a Interrupt Mux. With an interrupt Mux I would only need one Arduino pin for interrupts, but will need additional digital pins to detect which input caused the interrupt. I have a circuit design in mind for this. Like I mentioned , the microseconds required to read a pins state “might” be an issue.

      +++
      Yes, this would work. You have to be careful about “latching” your interrupt status. You probably need to implement hardware debouncing otherwise you have a race in serving the interrupts during the debouncing time.

      Also, I would need to modify the SDL_Weather_80422 library, specifically the way the interrupts get serviced.

      I’m still new to the interrupts, I am hoping that this is not the issue, but I am leaning that way. Any thoughts/comments appreciated.

      +++
      Three rules on Interrupt Servicing on Arduinos
      1) Don’t try to use Serial.print statements or the serial ports inside an interrupt routine. If you have to for debug purposes, prepare for some (but not all the time) flaky behavior and occasional hangs. Don’t leave them in production code.

      2) Spend as little time as possible in the interrupt service routine. Set flags and get out. Don’t do processes that take a lot of time.

      3) If you can, disable interrupts when you enter your routine and enable them as you leave. Stacked interrupts can kill your stack (which is extremely limited on Arduinos)

  7. Rescinding ““#define PinAnem 18″ is actually INT3 on the Mega2560, which makes “#define intAnem 5″ wrong.”, I read the wrong literature for this.

  8. Hey, thanks for the response and tips.

    Regarding the pin 1 designator for JP4, a square through hole symbol is always used to show pin 1, you show the “1” next to pin 4 (round through hole) where it should be under the square through hole. I would expect JP4 to look just like you have pin 1 shown for JP2.

    Regarding the reed switches, there is a bias that the switch toggles? 3.3v?

    Do you have any tips to implement hardware de-bounce based on your past experiences?

    Given the interrupt situation, can you run the lightning detector and the weather station together on a Uno? Doesn’t this use all the interrupts, or is this where the RTC comes into play?

    Thank again.

    • Brian,

      There is a problem with the square hole on JP4. The connecter is place backwards from the way it should be. We modified the specification and the picture so Pin 1 **is** Pin 1. We’ll clean that up on the next revision. Thanks for pointing that out.

      The reed switches are pulled high through a pullup resistor on the WeatherPiArdunio board and then shorted to ground when they close.

      There are a ton of good references on the web for hardware debouncing of signals like this. We have only used software for this board.

      There is a lot of confusion about interrupts on the Uno versus the Mega, etc. Here is a link that kind of explains it: https://playground.arduino.cc/Code/Interrupts

      and the Mega:

      https://www.arduino.cc/en/Reference/AttachInterrupt

      You may have to use the “pin change interrupts” for the UNO to have more than two total.

      The lightning detector doesn’t go off very often, so that is the one I’d use the other mechanism.

      John

  9. Hi John,

    Thanks for the pointers on interrupts. After sending you the first note, I figured I needed to go and study up on interrupts.

    Since last dialog I’ve made some progress, and after some confusion, have convinced myself that the anemometer and rain bucket are working as intended. I believe I got off on a tangent with my scope and its inability to trigger properly down at these speeds. My little DS203 also has a function generator that goes 10HZ. Using that and the calculations, I was able to see the ~15mph be registered, and then ~30mph at 20Mhz. I have some pictures, but I don’t see how to share them here. My biggest problem was grounding.

    Once past that hurdle, I found myself short of interrupts available to add the lightning detector. The MoteinoMega has only 3 interrupts, 0-2, and one of them is used for the RFM69HW radio which I’m using to send the data from outside to inside (currently have a dummy setup inside for testing and debug).

    To remedy this, I’ve added some circuitry to multiplex the 2 interrupts down to 1. I may make it 3 later, or just mux the rain bucket and lightning detector, we’ll see. The circuit uses a NAND gate to OR the 2 interrupt lines into a single interrupt. I also added a RS latch per interrupt to “capture” which device created the interrupt.

    I’ve modified your library and interrupt routines to handle this new setup, and will be debugging the code this weekend – hopefully.

    Unfortunately, I may have taken too long to get this up and running, we’ve had a ship load of rain down here in the Austin area, but I may have missed it. We’ll see.

    Thanks again for you tips and pointer.

    • Excellent way to multiplex the interrupts with the RS latch.

      I’m sure that your scope does have some problems at those low rates. When I have to deal at the low frequencies (at least for digital signals) with a cheap scope, I use my logic analyzer. https://www.saleae.com/logic/

      You can put a link on here to a picture, but you have to host it somewhere. Like photobucket.com

      John

  10. I’m trying to leverage the Weatherpiarduino board with a RaspberryPI 2 Model B. I’ve Adafruit AD board, RTC, and HT21D boards mounted to it. I’ve got everything working but the Anemometer and the rain bucket. I’ve wired them up like the Diagram shows with the Anemometer going to pin 8 and the rain bucket going to pin 10. The test file, SDL_Pi_Weather_80422Test.py, references those two connections on Pin 23 and 24 and I’ve changed it there to be 8 and 10. My Wind Speeds and Rain amounts are always reporting as zero, but Wind Vain is reporting fine. Anyone got any pointers to what I’m doing wrong?

    • Make sure you haven’t confused GPIO numbers with Pin numbers. You aren’t getting interrupts, so they probably aren’t connected.

      SDL

  11. That’s probably the issue, so technically I should be hitting the GPIO number associated with those pins which for the Pi 2 appears to be GPIO 14 (Pin8) and GPIO 15 (pin 10).

  12. Hi John,
    I’m back, and have some more issues.
    I have built and debugged the RS latch and can manually create the interrupt of choice, but I’ve discovered either a documentation issue or a hardware issue for the anemometer.
    First, I think it is interesting to note that each cup on the anemometer has a magnet in it, and for a complete revolution of the anemometer, there will be 3 interrupts generated.
    What I have also discovered, is that rain bucket switch is normally open as documented, which means your 10K pull-up will keep JP2-2 at VCC. When the bucket empties, you get the 2 interrupts you mention in the documentation when the switch closes and pulls JP2-2 to GND.
    HOWEVER, this is NOT the case I am seeing for the Anemometer, it’s switch is normally closed. This means JP2-3 is kept at GND. When the magnet passes the switch, the relay opens and the 10K pull-up pulls JP2-3 to VCC.
    This means, at least to me, that the Anemometer is actually an Active High interrupt not an Active Low interrupt.
    This is easy to test, unplug the cable from J1 and look at both sides of the Anemometer pull-up resistor with a meter – both sides will be at VCC. Now, plug in the cable to J1 and re-measure both sides of the Anemometer pull-up resistor – one side is now at GND.

    Now I need to put an inverter in front of the interrupt mux to make it work correctly.

    It would be nice if you would publish the schematic for the board, it would save me a lot of time….

    • Brian,

      I’m out of the office, but I will get back to you later today.

      John

    • Brian,

      I’ve got permission to send you the part of the schematic you are interested in. The Anemometer, rain bucket are pulled up to VDD (JP1) with a 10K resistor. If your runs are long, you may need a lower value pullup.

      The Anemometer closes and then opens when it is rotated. A wind speed of 1.492 MPH (2.4 km/h) causes the switch to close once per second. That is not necessarily one rotation, if the switch closes once per second, you have 1.492 MPH.

      Check your wiring really closely. It sounds like you have some kind of a problem. The anemometer works perfectly for us and others.

      The one thing I think you have wrong is thinking the Anemometer is an active high or low interrupt. It is not. You should look for a rising or falling EDGE interrupt. This may be your problem.

      John

  13. Hi John,

    Thanks for the schematic and quick response!
    Please perform the following test steps and let me know what you see. I will fill in with the values I measure.
    I’ve performed the following steps multiple times to confirm the results are repeatable.

    Test Procedure to determine Active Low and Active High:

    1) Start with a WeatherPiArduino board without ANY connections at all
    2) Connect GND and 3.3V to the WeatherPiArduino board (I used JP11-6 & JP11-5 respectively)
    3) Use a DVM to measure the voltage between GND and J2-4. This is the switch open condition for the RAINBUCKET. Expect ~3.3V. I measure ~3.3V.
    4) Connect RAINBUCKET to J2.
    5) Use a DVM to measure the voltage between GND and J2-4. This is the switch open condition for the RAINBUCKET. Expect ~3.3V. I measure ~3.3V.
    6) Use a DVM to measure the voltage between GND and J1-4. This is the switch open condition for the ANEMOMETER. Expect ~3.3V. I measure ~3.3V.
    7) Connect ANEMOMETER to J1.
    8) Use a DVM to measure the voltage between GND and J1-4. Be sure the ANEMOMETER is NOT moving. This is the switch open condition for the ANEMOMETER. Expect ~3.3V. I measure ~0.0V.
    9) While measuring the voltage between GND and J1-4, slowly move the ANEMOMETER. Expect voltage transition from ~3.3V to ~0.0V back to ~3.3V. I observe voltage transition from ~0.0V to ~3.3V back to ~0.0V

    Summary:

    The RAINBUCKET appears to be a NO switch (Normally Open) by virtue of measurements from steps 3 through 5 (and as documented), and is active low.
    The ANEMOMETER appears to be a NC switch (Normally Closed) by virtue of measurements from steps 6 through 9 (contrary to documentation), and is active high.

    Is it possible there is a NC and NO version of the ANEMOMETER, and I got an NC version? The difference would be subtle, and I would expect your application to work with either type. Mine won’t because of the MUX requirement and logic. This might explain your comment: “The one thing I think you have wrong is thinking the Anemometer is an active high or low interrupt. It is not. You should look for a rising or falling EDGE interrupt.”.

    Independently I see the switches functioning. I can see interrupts for rain and wind, and voltage for wind direction. Using your library I see what appear to be valid results from the instruments. HOWEVER, because I plan to multiplex the interrupts it is important to know the dormant state of the switches for a correct logic design. The RS latch functionality will be impacted by the NC state of the ANEMOMETER holding the SET input low and will not latch new states. The NAND gate used to OR the active low interrupts to the INT1 pin will also be impacted and will never pass an interrupt because the NC state of the ANEMOMETER will hold one of the NAND inputs low preventing passage of an interrupt.

    I plan to insert an inverter after JP2-3 to address my issue. This will make them (RAINBUCKET and ANEMOMETER) both active low for my application.

    John, I am very interested in understanding the root cause of this issue I am having, please publish what your measurements are for the above test procedure. And, as you can see by the test steps, NO wiring [from my application] is associated with this issue/observation.

    Thanks again for your support.

    9) whi

    • Brian,

      I will do this later today and publish. But based on my measurements yesterday, things looked correct.

      The anemometer may be open or closed depending on where the magnet is sitting. You can’t depend on the level. There is no default level. You need to look for the edge. Now, obviously, this changes your multiplexer. You need to use an edge triggered flip flop and not an RS type latch. I now see why I didn’t understand your question. I forgot that you were using a latch.

      Again, you can’t depend on the level. You need to look for the edge, and you need to debounce the signals either in software or hardware.

      Thanks for the very through email!

      John

  14. Hi,

    As far as I remember the pin25 is setup on rPI to accept triggered lightening and start action. As far as I understand this would be the jp13 on the weather PI board. However it is not connected to anywhere.
    I survived 3 storms without any lightening alert. This is why I’m asking who the lightening sensor should be connected and handled.

    Thanks for the help in advance.

    Zoli

  15. Hi.

    Playing around with the WeatherPiArduino and the weather rack.

    My Question is in order to use the wind direction I need a ADS1015????

    The test program is displaying voltage and direction but it does not seem to be right….

    Thanks

  16. Hi

    New to the weatherpiarduino pruduct. Do I need a ADS1015 to be able to use the wind direction wane??? Its not very clear…. I am getting a reading without it but reading some of the documentation it a lillte bit confusing

    Thank

    Pedro

    • Good morning,

      If you are using an Arduino, then you can use the built in A/D converter. If you are using a Raspberry Pi, you need to either use the ADS1015 or a different AD converter. The Wind Vane generates an analog signal that needs to be measured.

      You can build your own AD converter, but the ADS1015 is pretty inexpensive and has four channels, 12 bit accuracy.

      SDL

  17. Hi again

    A couple of question….
    Working with Raspberry PI 2, WeatherPiArduino board, AD board from Adafruit

    My wind speed seems not to be working, I get a reading using your test python code but the speed never goes higher than 4.2 any ideas…. when I know for a fact that the wind speed is much higher.
    Rain bucket if taking sample every 10 seconds should I add up the quantities to get the total……… actualy should I be doing that many samples
    if I dont will I miss data…….

    Also what is the voltage used for in the wind wane?????

    Thanks

    Pedro M.

      • Hello, I am having trouble with the anemometer.

        I am getting readings from the wind speed but the wind speed and wind gust do not go above 4.5 to 4.7mph, and the wind gust is always lower than the wind speed. When the anemometer is stopped, the readings show 0. What could be causing this? I do not know where to begin troubleshooting… Everything is wired correctly and I’m getting accurate readings from the wind direction and rain counter. I am able to get the temperature from the onboard BMP180, as well as readings from a AM2315, and uv meter.

        Any insight is very appreciated!!

    • i’m having this exact same problem. wind speed will not go higher than about 4.5mph….. i have the latest software installed, so any ideas what could be causing this?

      Thanks!

  18. Hey everyone…,
    The BMP180 of my station stopped working 2 days ago. Its address (0x77) is gone from i2cdetect:
    pi@weather-pi ~ $ sudo i2cdetect -y 1
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: — — — — — — — — — — — — —
    10: — — — — — — — — — — — — — — — —
    20: — — — — — — — — — — — — — — — —
    30: — — — — — — — — — — — — — — — —
    40: 40 — — — — — — — 48 — — — — — — —
    50: — — — — — — — — — — — — — — — —
    60: — — — — — — — — — — — — — — — —
    70: — — — — — — — —

    All is fine beside that, the device is safely sheltered, I see no sign of bad hardware health…
    Would anyone have any idea of what to do to bring the BMP180 back to life?

    See https://donpedro.lediouris.net/php/weather/reports.v2/weather.report.html for the data being logged…

    Any hint most welcome, thank you!
    – Olivier

    • Oliver,

      Do you have any other devices on the I2C bus? We see a 0x48 (ADS1015?) but no DS3231.

      The most likely failure for these devices is connecting the power backwards, connecting the power to 5V or a static zap. Did you fiddle or touch the station during this time period?

      First time we have heard of this issue

      If you need to buy a replacement board, let me know and wi will send you a 10% off coupon.
      SDL

  19. Hi SDL,
    The only missing address is the BMP180 one, I do not use the DS3231.
    The station has been working just fine several weeks in a row, all by itself. I believe the power connections are OK…
    A static zap is the first one I would suspect in this case, would you recommend any way to prevent that?
    And to answer you question, yes, I would like to replace the board if it cannot be fixed.
    Thank you!
    – Olivier

    • Olivier,

      Code sent. Power connections look OK to us. Always ground yourself or better yet wear a strap and work on a static free workstation whenever you work on the box.

      Best regards,

      SDL

    • After closely looking at the wire from JP8-A1 (silk screen is reversed for A0-A3 – see specification), there is no purpose to it in this design and it can be removed.

      A1 is the ADC input port for the Wind Vane. If you were to build an RC analog to digital converter and use the Pi to read the pin, that is where it would be. An RC analog to digital converter is probably not accurate enough for the Wind Vane. See specification.

      We will fix that next revision of the specification.

      Best regards,

      SDL

  20. Received the weatherpiarduino board and read this page and the pdf. I received two GPIO breakout boards but see no indication where they are integrated.

    Also the fritzing diagram for the Pi could be clearer, or embiggened. It appears one jumper goes from what appears to be A3 or A2 on JP8 to a pin on the Pi?

    I’ve already installed a DS321. Surely I could remove the first one in favor of the DS321 that came with the weather pi?

    thx, sam

    • The two GPIO breakout boards would connect to the I2C bus and would be mounted off the board.

      The DS3231 that came with the WeatherPiArduino board should be fine. You can use either one.

      After closely looking at the wire from JP8-A1 (silk screen is reversed for A0-A3 – see specification), there is no purpose to it in this design and it can be removed.

      A1 is the ADC input port for the Wind Vane. If you were to build an RC analog to digital converter and use the Pi to read the pin, that is where it would be. An RC analog to digital converter is probably not accurate enough for the Wind Vane. See specification.

      We will fix that next revision of the specification.

      Best regards,

      SDL

        • Hi Sam,

          Your wiring looks correct. When you start up the Pi, you should see the red LED on the3 DS3231 board and the power light on WeatherPiArduino.

          Run “i2cdetect -y 1” on your Raspberry Pi command line to see if you can see the two I2C boards you added and the onboard BMP180.

          best Regards,

          SDL

      • OK, finally got the Pi to find the ic2s bus. I’m still struggling to understand how to read the ic2s table. It’s here so perhaps this can tell us if the weatherPi board is showing what’s all installed on my board. Based on my Google reading, I’m guessing I see 0x48, 0x57, 0xUU, 0x77. Certainly more than one device so I was hopeful.

        I ran the testAM2315.py which I hoped would show the temp and humidity but it’s output is:
        temperature: 0.0
        humidity: 0.0
        crc: -1

        Do I have a hardware or software problem? Here’s my setup as a reminder. https://powerhat.org/images/IMG_3267.jpg, thx, sam

        • Hi Sam,

          You picture doesn’t show the AM2315 hooked up to your outfit. It is not showing up on your I2C scan (It is address 0x5c).

          Best regards,

          SDL

  21. Yes, so despite the fritzing drawing showing the Pi connection to this board, disregard it? I struggled to find a photo of a populated board showing the Pi. So as not to fry my new board, I’m hoping someone can verify this is correct the connections. This angle is more helpful for me because none of the photos I’ve seen show what’s behind the DST board. https://powerhat.org/images/IMG_3267.jpg

    I’ve read, and re-read, about interrupts which as I gather from the article in Raspberry Pi magazine is that the python script is running constantly and whenever anything changes on the wind vane or rain bucket the script pauses to capture from these sensors? It’s up to me to adapt this script to write to my database?

    thx, sam

    • Sam,

      You are correct. Disregard that connection.

      Interrupts are complicated. I would suggest reading one of the many tutorials on interrupts using Python available on the web.

      The Python script is running continuously and whenever something changes with the rain gauge or the anemometer, your program is interrupted and the interrupt handler updates the data for wind speed and rainfall.

      It is up to you to copy the data to the database. If you want to see how we did it, check out: https://www.switchdoc.com/2015/05/weatherpi-instructable-released-solar-powered-raspberry-pi/

      Best regards,

      SDL

  22. Hello, I’m trying to run the WeatherPi on my setup and finding some modules missing. Some like the INA22 I can comment out because I don’t have the sunairplus. But the Weather 8042 seems pretty critical. The folder for SDL_Pi_Weather_80422 in WeatherPi is empty. It would seem that this repo would be the same but it’s not named exactly the same. Is it the same?

    https://github.com/switchdoclabs/SDL_Weather_80422

  23. Yes, this is very helpful. Running the test in the 80422 module returned
    Error accessing 0x49: Check your I2C address

    sudo i2cdetect -y 1 yields 48, 57, UU and 77. Through the process of elimination, I believe 57 is the DS3231. I can see that, but my other numbers don’t seem to be reflected. How to determine which device is to the other addresses? thx, sam

    • All this information is in the WeatherPiArduino specification. Send us a picture of your board. It doesn’t look like the DS3231 is there. Are you sure you have the I2C pins connected to right pins? Specifically JP4 for the Raspberry Pi.

      https://www.switchdoc.com/weatherpiarduino-bare-board/

      The default I2C addresses are:

      The default I2C addresses for the on board devices and the optional devices are shown below.

      DEVICE
      DESCRIPTION
      HEX ADDRESS
      COMMENTS
      BMP180
      Barometer / Temperature
      0x77
      Included
      DS3231
      Real Time Clock
      0x68
      Included
      AT24C32
      EEPROM
      0x56
      Included
      ADS1015
      ADC
      0x48
      Optional Board. Can change I2C Addresses.
      MOD-1016
      Lightning Detector
      0x03
      Optional Board.
      HTU21D-F
      Humidity Detector
      0x40
      Optional Board.
      FRAM
      32KB FRAM
      0x50
      Optional Board. Can change I2C Addresses.

  24. Yes, my board is as pictured. So the two devices for the vane and airspeed are not in this table? As you can see, the only devices are those for the WeatherPi.

    • We don’t see any picture with your reply.

      The wind vane and airspeed are NOT I2C devices, so they don’t show up on the i2cdetect.

      The wind vane is hooked up to A1 of your ADS1015 ADC and airspeed and rain bucket go to interrupts (GPIO pins) on your Raspberry Pi. See the WeatherRack specification for details.

      Thanks!

      SDL

    • As it says on the DS321 product page (on SwitchDoc Labs), the EEPROM on the DS3231 board is either 56 or 57.

      Can you send the actual output from i2cdetect? That might give us a clue as to what is going on.

      We don’t seem to see the DS3231 on your bus. That should be address 0x68. Is the red LED lighted on the DS3231 board?

      Best regards,
      SDL

  25. 0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: — — — — — — — — — — — — —
    10: — — — — — — — — — — — — — — — —
    20: — — — — — — — — — — — — — — — —
    30: — — — — — — — — — — — — — — — —
    40: — — — — — — — — 48 — — — — — — —
    50: — — — — — — — 57 — — — — — — — —
    60: — — — — — — — — UU — — — — — — —
    70: — — — — — — — 77

    Yes, 57 should be my ds3231 on the alternate. 77 should be the bmp180. The chart says 48 is the ads1015. But in my post above, after running the sudo python SDL_Pi_Weather_80422/SDL_Pi_Weather_80422Test.py I crash on Error accessing 0x49: Check your I2C address. Looking at the parent SDL_Pi_Weather_80422 file, 49 is the ads1015, not 48. Perhaps I should arbitrarily references of 49 to 48? That sounds imprudent. Hope the formatting works of the ic2detect.

    • Sam,

      Yes, change the 0x49 in the code to 0x48. That is the alternate address for the ADS1015.

      Now, notice the UU is in 0x68, which is the address that should be the DS3231. Tell me, does the Weather software pick up the DS3231 on the I2C bus?

      You could also download the SwitchDoc Python library for the DS3231 and test that.
      https://github.com/switchdoclabs/RTC_SDL_DS3231

      The UU generally means that the specific I2C address is already being used by some other bit of software.

      Are you running “sudo i2cdetect -y 1”? Note the “sudo”.

      Best regards,

      SDL

  26. Also, running
    sudo python SDL_Pi_Weather_80422/Adafruit_ADS1x15/Adafruit_I2C.py returns
    Default I2C bus is accessible

    sudo python SDL_Pi_Weather_80422/Adafruit_ADS1x15/Adafruit_ADS1x15.py
    returns nothing

    I have nothing else in my rc.local starting up any other functions. In my first iteration of a weather station, I used PIPIGIO to read a formerly attached DHT22. None of those are running. So I’m unsure where that 0x49 is coming from, sam

    • The UU indicates that you are trying to use the DS3231 from a different program. Did you install the real time clock part of the Raspberry Pi software? That might be taking it over.

      Do you have another SD card that you can try this on?

      Take it one device at a time to find out what is working and what is not. The example programs with all the drivers will help.

      SDL

  27. It appears my earlier comment after removing the first ds3231 is not here. After removing it from my rc.local when I run sudo i2cdetect -y 1

    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: — — — — — — — — — — — — —
    10: — — — — — — — — — — — — — — — —
    20: — — — — — — — — — — — — — — — —
    30: — — — — — — — — — — — — — — — —
    40: — — — — — — — — 48 — — — — — — —
    50: — — — — — — — 57 — — — — — — — —
    60: — — — — — — — — 68 — — — — — — —
    70: — — — — — — — 77

    So the address for the 3231 is as expected. However, running sudo python RTC_SDL_DS3231/testSDL_DS3231.py

    Test the AT24C32 EEPROM
    —————–
    writing first 10 addresses with random data
    address = 0 writing value=7
    Traceback (most recent call last):
    File “RTC_SDL_DS3231/testSDL_DS3231.py”, line 46, in
    ds3231.write_AT24C32_byte(x, value)
    File “/home/pi/apps/WeatherPi/RTC_SDL_DS3231/SDL_DS3231.py”, line 242, in write_AT24C32_byte
    self._bus.write_i2c_block_data(self._at24c32_addr,a1,[a0, value])
    IOError: [Errno 5] Input/output error

    It should find its bus, shouldn’t it? thx, sam

  28. In addtion to my previous comment above, I created a new Wheezy card, set up postgres, and still get the same output of unable to access 0x49 as above.

    • I think you need to change 0x49 to 0x48 as from your i2cdetect output.

      Is your EEPROM address set to 0x57?

      SDL

  29. i bought switchdoc lab weather station and i’m trying to make it work with arduino uno but when i run the sketch which is provided in this web site still giving me the same error what can i do please help me ?!
    this is the error although i installed the library it still giving me the same error .

    Arduino: 1.6.6 (Windows 8), Board: “Arduino/Genuino Uno”

    C:\Users\Eng.Fadhel\Documents\Arduino\libraries\SDL_Weather_80422_Library\SDL_Weather_80422_Library.ino:12:18: fatal error: Time.h: No such file or directory

    #include

    ^

    compilation terminated.

    exit status 1
    Error compiling.

    This report would have more information with
    “Show verbose output during compilation”
    enabled in File > Preferences.

  30. Yes, that’s been the goal all week. It is not clear where it is getting the 0x49 from. The constructor of ADS1x15.py on line 132 is already set to default to address=0x48.

    Searching through the entire codebase for “49” yields nothing that I see in the context of 0x49. I suspect it is dynamically generated for some reason, but don’t know enough python to determine if that is true.

    • Sam,

      Have you tried just running the ADS1015 example software in the library? Isolate the problem if you can.

      SDL

  31. Yes, I will add to my reports above.

    sudo python Adafruit_I2C/Adafruit_I2C.py =>
    => Default I2C bus is accessible

    sudo python Adafruit_ADS1x15/Adafruit_ADS1x15.py =>
    => no result

    sudo python Adafruit_ADS1x15/ads1x15_ex_comparator.py =>
    => 0.3935
    0.313
    0.3125
    0.306
    0.3005
    0.3025
    0.311 etc

    sudo python Adafruit_ADS1x15/ads1x15_ex_differential.py =>
    => 0.83000000 1.09000000 0.26000000 0.06587500

    sudo python Adafruit_ADS1x15/ads1x15_ex_singleended.py =>
    => 0.570000
    which is significant as the error message on running sudo python SDL_Pi_Weather_80422Test.py fails on this method value = self.ads1015.readADCSingleEnded

    So, it appears that these methods are functioning. It’s something in the interaction between the Adafruit I2C_, the Adafruit_ADS1x5 and the SDL_Pi_Weather_80422.py files? I have checked my soldering on the ADS board and the connection of the phone cable from the aenometer and seems secure.

  32. I’m anxious to make progress in getting these weather sensors, temp, humidity running and see that in the WeatherPi distribution there is a shell script which, when I make executable, ought to run the master app and its dependencies. What’s odd is that I can’t get past
    !/usr/bin/env python
    ^
    SyntaxError: invalid syntax

    I’ve run sudo python WeatherPi.py itself but it stalls in the same place. My python is in /usr/bin/python. Looking online to see if I’m overlooking something, I get that the shebang line is there to ensure that it runs different flavors of python. But should I yank them all out of the dependencies?

    M bigger question, is for me to run the sensors I have is am I on the right track to get this started? https://powerhat.org/images/IMG_3267.jpg

    You can see my fork of what I sense to be the program here: https://github.com/sam452/WeatherPi

    How should this program be started? thx, sam

    • Sam,

      You are missing a “#” in front of the command.

      #!/usr/bin/env python

      sudo python WeatherPi.py is the correct command.

      Best regards,

      SDL

  33. Anxious to get this software running on my setup I’ve been commenting out chunks of functions that I don’t have like and pushing through each error.

    Error permission denied for relation systemlog

    sendmail exception raised
    —————–
    Weather Sampling
    —————–
    Traceback (most recent call last):
    File “WeatherPi.py”, line 888, in
    sampleWeather()
    File “WeatherPi.py”, line 426, in sampleWeather
    HTU21DFOut = subprocess.check_output([“htu21dflib/htu21dflib”,”-l”])
    File “/usr/lib/python2.7/subprocess.py”, line 544, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command ‘[‘htu21dflib/htu21dflib’, ‘-l’]’ returned non-zero exit status 254

    OK, I’m going to ignore the core python library and think something’s goofy here in my code. SInce I do have the Weather sensors and the bmp sensor I think it’s needed. As you can see in my fork, I do believe I have this C library installed so it’s not missing. Aside from the connection to the systemlog postgresql table and the sendmail connection it seems to startup OK. Don’t think those are the cause of this failure, but I’m happy to be shown how I can get past this htu21dflib error, thx, sam https://github.com/sam452/WeatherPi

    • Sam,

      The next rewrite of the WeatherPi.py file is going to have conditional defines around all the optional devices. To avoid what you have been going through.

      Now, my question is what devices do you have connected? Do you have an HTU21DF connected to the I2C bus? If you don’t, comment out everything related to the HTU board.

      The HTU21DFlib software will return an error (non zero exit status) if the HTU21DF is not present.

      SDL

  34. It appeared that the HTU21DF is embedded within the Rain and wind sensor so I left it in. It was not mentioned in the Instructables link you provided. It was not a discrete function like the lightning detector for example. So you’re saying it’s OK to excise any reference to HTU21DF?

    https://powerhat.org/images/IMG_3267.jpg

    • Yes. Remove all references. Take a look at the WeatherPiArduino specification. All of the information on what is included or not is in the specification and the Instructable calls out specific part numbers in the Parts List.

      Best regards,

      SDL

  35. Still having a problem with switch bounce in the rain gauge. NOAA has suggested a monostable trigger. I have all the parts, but haven’t put it together yet. The wind vane seems to have quit sending, but I have a back-up to install. My back-up rain gauge has the same switch bounce problems. The software I have written seems to work fine. It’s been rewritten to NOAA specifications for sampling times, averaging intervals, wind gusts, etc. The Arduino Uno sends raw data serially to a Raspberry Pi 2 python program which processes the data, publishes a local web page using a separate thread, saves the data to file, and ftp’s the web page to the school server. The python program runs on Linux or Windows. It should run on a Mac, but I haven’t tested it.. Reliability is up to several days now. As soon as I have the hardware problems fixed I will activate a telnet routine to send data to the CWOP servers. Then I can start calibrating the setup.

    Are you interested in the software as public domain after I work on it a little more?

    • John,

      We would be absolutely interested. We will put it up on Github and write an article about it.

      Switch Bounce? Look at it on a scope and see how bad it is. Get some more data.

      Which wind vane are you using?

      SDL

  36. I have two WeatherRacks and two WeatherPis. I’m not sure about my wind direction averaging algorithm yet because of the wind vane problem.

    I don’t have an oscope. I built a soundcard scope, but it was too noisy. I have an Arduino Mega 2560 with xoscope loaded and running. As soon as I can figure it out I’ll give it a try. That failing, I have a friend with a digital oscope, but I’m a DIY guy.

    What is the address for uploading the code? I’ll send it as soon as I get the get connected to the CWOP server. I hope to get that working over the Christmas break.

  37. I have finally got the tables writing to Postgresql and the WeatherPiArduino is working except for Windspeed and Rain Totals. I know my device windspeed is working because it is spinning in the wind. The RJ cable is connected to the right spot and the aenometer is connected to the windspeed device. I get data for the direction but not windspeed which leads me to believe the device is connected correctly. The only value I get is zero.

    Digging deeper into the SDL_Pi_80422 python file I’m looking at the get_current_wind_speed_when_sampling and get a value greater than zero until it attempts to divide SDL_Pi_Weather_80422._currentWindCount by the time_sample. The numerator returns zero and I’m looking to see where that property gets set to anything other than zero.

    You can see my fork of your repo here: https://github.com/sam452/WeatherPi
    What am I overlooking in returning a valid value? thx, sam

    • Sam,

      Since you don’t get rain and anemometer readings, you probably don’t have the interrupts either wired up correctly or not set up correctly. Both of those values are derived from interrupt routines.

      Uncomment the print statement in

      def serviceInterruptAnem(self,channel):

      #print “Anem Interrupt Service Routine”

      And rotate the anemometer to see if you are responding to the interrupt. You can do the same thing in the Rain interrupt routine.

      SDL

  38. Yes, that makes sense, except how to test it. After uncommenting the two lines in the interrupt methods,and running the SDL_Pi_80422Test.py I still see zeros for the values derived from the interrupts when the anemometer is spinning. Digging into the SDL_Pi_80422.py I’m trying to run the serviceInterruptAnem(self,channel) in terminal but python returns that I’ve not given it the second arguent. Assuming self is understood, I’ve gone through the file to see in context how it is being used and how the channel argument is presented but it’s not clear to me what the second argument should be. So given that I’m unsure how to troubleshoot if either of the methods are being invoked. As before, my code is found here: https://github.com/sam452/WeatherPi

    • Sam,

      I’m not sure I’m understanding you, but if you uncomment those print statements and look at the terminal where you are running your python, and turn the anemometer or tilt the rain bucket, you should see those print statements. If you don’t, then either you have a wiring problem or you have to set up the interrupts.

      Those routines get called by the interrupts.

      SDL

  39. Yes, we’re agreed that the interrupts are what trigger the data collection. So, looking at hardware I went out and reset all the RJ connectors. I still don’t think it’s hardware on the wind sensors because I’m getting wind direction. Could be hardware failure on the rain gauge, but more likely the interrupt triggers.

    So running the WeatherPi.py in terminal I can report this:
    SDL_CWS = 0.000000, SDL_Pi_Weather_80422._shortestWindTime = 4294967295, CWCount=0 TPS=0.000000
    SDL_Pi_Weather_80422._currentWindSpeed= 0.0

    This is from line 245 in get_current_wind_speed_when_sampling(). As to troubleshooting further, it appears that the interrupts are only triggered indirectly from WeatherPi.py and directly in the SDL_Pi_80422.py. So it appears the interrupts aren’t happening. From what I can read they are triggered by a GPIO.add_event_detect. Looking at my git log for this file the only change I’ve made to this file is to change the self.ads1015 address FROM 49 TO 48 per advice provided early on (above). Unsure what to try next, sam

  40. Hello,

    I am trying to build the Solar Powered Weather Station using a WeatherPi and Arduino Uno.

    I was able to read the DS3231 internal temp, however when i try to use the Weather_80422 library in the Arduino IDE Ver 1.6.7, i can load the file, but it gives me a error time.h file is missing.

    Can you tell me how to get the correct time.h header file?

    Thanks,
    Ken

  41. Digging into the theory that my aenonmeter and rain bucket is not wired up in my WeatherPi.py, I can see that the tca49545 is probably needed for the interrupts. This does not appear to be aligned with a piece of hardware that I don’t have I’ve uncommented the instances where it is created for the bus0, which is the only bus I have hardware.

    Running both WeatherPi.py and SDL_Pi_TCA9545/testSDL_Pi_TCA9545.py I get the following error in instantiating this object:

    File “testSDL_Pi_TCA9545.py”, line 51, in
    tca9545 = SDL_Pi_TCA9545.SDL_Pi_TCA9545(addr=TCA9545_ADDRESS, bus_enable = TCA9545_CONFIG_BUS0)
    File “/home/pi/apps/WeatherPi/SDL_Pi_TCA9545/SDL_Pi_TCA9545.py”, line 47, in __init__
    self._write(TCA9545_REG_CONFIG, config)
    File “/home/pi/apps/WeatherPi/SDL_Pi_TCA9545/SDL_Pi_TCA9545.py”, line 52, in _write
    self._bus.write_byte_data(self._addr, register, data)
    IOError: [Errno 5] Input/output error

    My guess is that the constants are not set correctly, but I can show that they are at least set using the sudo i2cdetect -y 1

    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: — — — — — — — — — — — — —
    10: — — — — — — — — — — — — — — — —
    20: — — — — — — — — — — — — — — — —
    30: — — — — — — — — — — — — — — — —
    40: — — — — — — — — 48 — — — — — — —
    50: — — — — — — — 57 — — — — — — — —
    60: — — — — — — — — 68 — — — — — — —
    70: — — — — — — — 77

    My TCA9545_ADDRESS is set to (0x73) which does NOT appear to be in my list of interfaces. I need confirmation about the pins in my code and if tca9545 is actually required for the interrupts, and if so, what should these constants be set? thx, sam

    • Sam,

      You should not need the TCA4945 for the interrupts. The TCA9454 is for I2C devices.

      Clearly by your i2cdetect output, the TCA is NOT on your bus. Check the wiring closely.

      It’s like you do not have the interrupts even connected up to the Raspberry Pi, or have them connected to the wrong pins.

      Best regards,

      SDL

  42. Thank you, I had commented out the TCA because of this output. I believed TCA may be required for the interrupts in my reading of WeatherPi.py but in the Instructables page it is set for the i2c multiplexer. So let’s unpack your last statement. If the weather rack is plugged up correctly (getting wind direction) what needs to happen so “interrupts connected up to the Raspberry Pi”. I was thinking you were indicating software “wiring up” but perhaps I’m mistaken. Perhaps this is a hardware issue? https://powerhat.org/images/IMG_3267.jpg
    As for the wrong pins, I’ve indicated what the code is setting for the constants a few message up that I’m asking for confirmation.

    • Sam,

      For me to evaluate your code, post the code snippets regarding the interrupts and carefully tell me what wires you have hooked up where. Then we can quickly evaluate what you have done.

      Best regards,
      SDL

  43. Yes, I’m unsure where the code for the interrupts are except perhaps in SDL_Pi_weather80422.py which is largely untouched save for uncommenting some print statements. https://github.com/sam452/WeatherPi

    It appears there is more wiring to do beyond the RJ plugs for the Sensors. I found what I think is Pin 2 but cannot find Pin 3. This is what I have now. https://powerhat.org/images/IMG_3410.JPG For what I believe is GPIO 23, 24 I counted 8 from the 5v pin on the outside. In this photo white is for GPIO 23, black is GPIO 24. White is unattached unable to find Pin 2.

    Let me know if you cannot find what will help you in my code on github,

    thx, sam

    • Sam,

      Pin 2 and Pin 3 on what header?

      Looking at your picture, if you have an ADS1015 installed, you should have nothing on the Wind Vane input.

      I’d suggest you write a small test program that will read the two GPIOs you think are connected to the anemometer and rain bucket and continuously print them to the screen.

      The run your program and turn the anemometer and tilt the rain bucket and see if you have the right GPIOs.

      SDL

  44. According to the instructable, I perceive that GPIO 23 or pin 16 should wire to Pin 3 of the WeatherPiArduino.
    According to the instructable, I perceive that GPIO 24 or pin 18 of the Pi should wire to Pin 2 on the WeatherPiArduino that I cannot find.

    Quoting from an earlier reply in this project:
    **The wind vane is hooked up to A1 of your ADS1015 ADC and airspeed and rain bucket go to interrupts (GPIO pins) on your Raspberry Pi. See the WeatherRack specification for details.**

    The WeatherRack specification makes no mention of the ADS1015. Are you saying that the RJ11 plugs are useless and I should use jumpers to hook up my rain bucket and aenonmeter?

    I’m happy to determine what the Pi GPIO are reading if I knew where to attach them. In my picture, one is guessed at and the other is dangling unattached. What am I not understanding in how the Pi and the WeatherPiArduino and the WeatherRack should be wired up?

    • Here is the wiring list for the anemometer and rain bucket:
      PiA+ GPIO/Pin 16: GPIO 23 WPA JP2/Pin3:Anemometer Anemometer Output from WeatherRack – Interrupt
      PiA+ GPIO/Pin 18: GPIO 24 WPA JP2/Pin 2:Rain Bucket Rain Bucket Output from WeatherRack – Interrupt

      Note that Pin 3 and Pin 2 are located on WeatherPiArduino board Header JP2.

      Look at the WeatherPiArduino specification on page 9 to see where JP2 is and what Pin 1 is. https://www.switchdoc.com/wp-content/uploads/2015/10/WeatherPiArdunio_101915-V1.4.pdf

      My mistake to talk about the WeatherRack specification in that response.

      The RJ11 plugs connect the WeatherRack to the WeatherPiArduino board and are present on JP2.

      Since you have an ADS1015, you should have nothing connected to Pin 1. It looks like you have something connected to Pin 1

      Pin 2 and Pin 3 of JP2 on the WeatherPiArduino board should be connected as in the wiring list above.

      Look at the description of JP2 from the specification of the WeatherPiArduino board on page 12.

      Best regards,
      SDL

      • I didn’t see my reply so this may be a duplicate.
        Here is a photo of my wiring following your post. https://powerhat.org/images/img_3411.jpg
        I’m finding that my devices aren’t found.

        Attempting to run the 80422Test script I get this output:

        SDL_Pi_Weather_80422 Library
        WeatherRack Weather Sensors
        —————–
        SDL_Pi_Weather_80422._currentWindSpeed= 0.0
        Rain Total= 0.00 in
        Wind Speed= 0.00 MPH
        MPH wind_gust= 0.00 MPH
        Error accessing 0x48: Check your I2C address
        Error accessing 0x48: Check your I2C address
        Traceback (most recent call last):
        File “SDL_Pi_Weather_80422Test.py”, line 62, in
        print “Wind Direction=\t\t\t %0.2f Degrees” % weatherStation.current_wind_direction()
        File “/home/pi/apps/WeatherPi/SDL_Pi_Weather_80422/SDL_Pi_Weather_80422.py”, line 189, in current_wind_direction
        value = self.ads1015.readADCSingleEnded(1, self.gain, self.sps) # AIN1 wired to wind vane on WeatherPiArduino
        File “./Adafruit_ADS1x15/Adafruit_ADS1x15.py”, line 219, in readADCSingleEnded
        return ( ((result[0] <> 4 )*pga/2048.0
        TypeError: ‘int’ object has no attribute ‘__getitem__’

        0x48 suggests that the wiring is off.
        sudo i2cdetect -y 1
        0 1 2 3 4 5 6 7 8 9 a b c d e f
        00: — — — — — — — — — — — — —
        10: — — — — — — — — — — — — — — — —
        20: — — — — — — — — — — — — — — — —
        30: — — — — — — — — — — — — — — — —
        40: — — — — — — — — — — — — — — — —
        50: — — — — — — — — — — — — — — — —
        60: — — — — — — — — — — — — — — — —
        70: — — — — — — — —
        Would you tell me what I need to do to correct the wiring? thx, sam

        • I had exactly the same problem as sam w, and the solution was to ignore the fritzing schema – the picture shows connections on pins 10 & 12, but that is incorrect.

          As mentioned by SwitchDoc Labs, you actually want pins 16 & 18:

          “PiA+ GPIO/Pin 16: GPIO 23 WPA JP2/Pin3:Anemometer Anemometer Output from WeatherRack – Interrupt
          PiA+ GPIO/Pin 18: GPIO 24 WPA JP2/Pin 2:Rain Bucket Rain Bucket Output from WeatherRack – Interrupt”

          If you move the GPIO wires to 16 & 18, your wind and rain readings will start to work.

  45. I have my ADS1015 installed (I see it on i2c 0x48 and the main board on 0x77), I am able to read the anemometer and rain bucket as well as the BMP stuff, but I am not able to read my wind vane, even when running the test script provided SDL_Pi_Weather_80422Test.py. Can you make any suggestions on where I should start troubleshooting this? (I can see that the code in Adafruit_ADS1x15/Adafruit_ADS1x15.py is pointing properly to 0x48)

    Thanks in advance,
    Hans

    • Hans,

      As you know, the wind vane changes the resistance as it is rotated, hence the voltage from the resistor divider changes voltage.

      I would first go and load up the ADS1015 examples and make sure you are reading a voltage from A1. Then check to make sure that you are reading it in the Weather Software.

      Best regards,

      SDL

  46. HI

    I have WetherPiArdiuno with ADS1015 and the realtime Clock all is working fine.
    Question can I use the other A0, A2 and A4 on the ADS1015 pins or are they used internaly for something else. Also do I plug into the ADS1015 pin or can I plug into the WeatherPIArdiuno board…..

    Thanks

    Pedro

    • PedroMMR,

      You can use A0, A2 and A4 for any use. They are not used internally. A0,2,4 are brought out on a header on the board.

      SDL

  47. Hello,
    I have assembled the Raspberry Pi 2 B+ with the WeatherPiArduino board, and wired them together using the RaspberryPi Fritzing diagram. I cloned the RaspberryPi-WeatherPiArduino from git-hub. I tried to run it, but I seem to get errors . I ran i2cdetect and i see the addresses of the components that i have installed.

    I am new to Linux —- so can you help me get this working?

    Thanks in advance.

    I am trying to eventually get the Solat Powered Weather Station up and working, then possibly add the data to WeatherUnderground.

    • Hi Ken,

      Would you post some of your errors so we can see what they are?

      I assume they are python errors.

      SDL

  48. Hello,
    I seem to be having a problem with my directory structure or file permissions.

    I tried editting the directory structure in code, but then i get an error that the code cannot find the next file in a different subdirectory.

    Please help…..

  49. I’d like to address wlan0 dropping out. The WeatherPi.py script does a good job of polling the network and attempting to restart the wlan0 connection. Because o so many dropouts, I disabled the reboot so that the software keeps running. Once I’m done testing, I’ll set this to root and startup.

    Like your Instructable, my problems mirror your setup. However, because my requirement is to be completely self-contained with a network connection I cannot use the WiPi device as I need a Yagi antenna to tether to my home network. So using my known-good dongles that can take an external antenna, I set up my A+ and get dropouts, about half the day in several-hour chunks of time.

    To further troubleshoot, I hooked up an Adafruit USB charger doctor and find that my amperage is fluctuating around 0.9 a under load.Under load this should be enough to drive it?

    Assuming it could be a power issue I brought in my A+ with a dongle and only running the Postgresql server I get flawless wlan0 connection. This is using a 2 a power adapter. A short time after running Postgres and the WeatherPi my pings start to drop. Maybe an hour after starting the pings.

    Thinking it might be a memory issue, I swapped out the A+ with a newer RPi 2 B with 1gig of RAM. Using a known-good dongle, 2+ a usb power and only running postgresql and WeatherPi with the same SD card I find that the wlan0 drops out after an hour or so.

    I imagine I’ll need to comment out more code to try to isolate why wlan0 might be dropping? Or is there some other troubleshooting I can attempt to isolate the cause? thx, sam

    • I was planning on running the same setup as Instructable, but when I read about the wlan0 and memory issues I was thinking about going a different path..

      I have an external Temp\Hum Sensor, WeatherRack, Camera, PI B+, Ethernet back, Mysql Server\Web-server in the cloud..

      So my plan was to script out the data and run the script every minute.. Use parts of the test scripts to get the data and ship it all via IPv6 to my SQL server..

      The camera I was planning on doing the same thing pulling an image every minute and dumping it on my webserver, then having VLC make a video out of it..

      So I have noticed others pull every second or 15 seconds like in the Instructable document, is that really needed? I do like the “simple loop” they have setup, and really that is where I thinking I am going to go as well.. Just cron it out and not 1 job looping all the time..

  50. Let’s talk about the two breakout boards provided with the WeatherPi board.
    In an earlier missive about this your quote is,
    “The two GPIO breakout boards would connect to the I2C bus and would be mounted off the board.”

    Granted, but I’ve not seen them mentioned in the PDF documentation or how they are implemented in the Instructible.

    Could I use this to add more sensors like the AM2315? If so, please point me to documenation, thx, sam

    • Hi Sam,

      GPIO breakout boards are I2C boards that provide 8 additional GPIO lines per board.

      Sensors like the AM2315 are I2C sensors and would not be connected to the GPIO lines, but rather an I2C Mux / Expander board for additional I2C Address space (AM2315’s I2C Address can’t be changed, so you need to put additional units on the other I2C Busses provided by the I2C Mux.

      SDL

  51. My weather station is finally on the weather map as CWOP station EW8407. You expressed an interest earlier in the code and setup after I got it up on the CWOP. There is still work to do cleaning up the code and documenting the project. The Bill of Materials is set: a WeatherRack, a WeatherPiArduino board, an Arduino Uno, an AM2302 sensor, a prototyping shield and some hook-up wire all for about $140 on Amazon. Could we get a temperature/humidity sensor on the board instead of a RTC? The battery charging circuit in the RTC kept overloading my Raspberry Pi. It was okay after the battery was fully charged, but I didn’t need it. Weather data is logged at time of receipt rather than time of transmittal.

    The Arduino software reads temperature, pressure, humidity, wind speed, wind direction and rain fall. It interprets and corrects the readings and transmits them every five seconds as a human-readable text string via USB.

    The host computer software is written in Python 2.7 and runs on Windows or Linux. It should run on Mac, but I don’t have one to test it on. It parses the data string every five seconds, averaging it every two minutes. It calculates wind chill and heat index. It determines wind gust speed and daily high and low temperatures. It displays processed weather data on the console and archives it in a text file, writes a static web page every two minutes, displays the web page on a Python web server running on a separate thread, ftp’s the webpage to a remote server (https://www.swa.rcschools.net/teachers/marablej/weather.html) and transmits it to the CWOP every ten minutes. NOAA was a great help in getting standard observations and connecting to the CWOP servers. Due to the use of standard libraries, the whole thing is under 12kb so far. I’ll need to delete some debug instructions and add some comments for configuration. There is no configuration file. Put your numbers directly in the code to correct barometer readings to sea level, etc.

    Another program was written for the UNO to calibrate the wind vane. Observed voltages were not close enough to the data sheet values on either of my two wind vanes.

    I am still having problems with the rain tipper. It indicates rain when there is none and greatly exaggerates actual rain fall. That is why there is no rain data on the CWOP page. I am working on a more stable mounting and de-bouncing the switch in software. Is there any chance of a rain tipper with an optical switch in the future?

    Is there an address where I can send the code, documentation and illustrations, or do I just paste it in this little box?

    • Congratulations on joining CWOP!

      A couple of question and comments.

      There is no battery charging circuit in the RTC supplied with the WeatherPiArduino board. It’s something else in your circuit or design.

      The BMP180 has a temperature sensor inside so you can get the inside temperature. We didn’t put on a temperature / humidity sensor on the board by default because most people want to mount a temperature/humidity sensor outdoors. Point is taken however, for indoor humidity.

      You have done a great job on the Arduino code it sounds like. I sent an email to you with an address to send the code and I’ll put it up on Github and make you the moderator.

      Check the voltages carefully on the wind vane. We have checked it thoroughly and it matches both 3.3V and 5V values.
      Remember that the Arduino ADCs are flaky and need to be carefully used to get the full 10bit accuracy. There are a number of pages on the web that talks about improving the performance of the Arduino internal ADC.

      Yes, the rain bucket is a problem unless it is really stable. Thanks for the redesign suggestion.

      If your lines are long from the rain bucket to the Arduino, you may be seeing noise, and not just bucket bouncing or debouncing jitters. Add an additional resistor from VCC to your Rain Bucket input (It’s currently 10K. Make it 5K or so. Improves the noise resistant although it increases the quiescent current.

      SDL

      • You can’t believe everything that you see on the internet:

        https://forum.arduino.cc/index.php?topic=278270.0

        Another post even showed the trace to cut to disable battery charging. I plugged in an external power supply, and the problems went away. After several days I unplugged the external power supply, and the problem did not reappear. Sorry for the confusion, but I just assumed from the evidence that it was a battery charging problem.

        My installation must be atypical. The Arduino Uno with a Proto-Shield mounting the AM2302 and the WeatherPIArduino Board are mounted outside in a shelter. The wires to the anemometer, wind vane and rain gauge were too short for an indoor installation. I thought that other installations would be similar.

        I want to comment the Arduino code a little more before I submit it. There is some configuration in the code such as barometer correction to sea level that needs to be commented better. Since there is no configuration utility, calibration numbers need to be changed directly in the code. I will submit the Python code for the host computer as well. It is currently running on a Raspberry Pi 2, but it has been tested on Windows as well. It should run on OS-X, but I don’t have a Mac to test it on.

        I have two instrument clusters and four Arduinos. There was a significant difference between the two wind vanes with the same Arduino. The solution was to write a calibration program. Position the vane to North, read the voltage in software and continue. I split the voltages settings in the software so that any voltage would give the closest direction. That needs to be documented in the Arduino code also. You mentioned 5v, but only 3.3v is supplied to the board. 5v would bring my observed voltages close to the specification sheet voltages.

        As for the rain tipper, again ten feet of 3/4 inch conduit was probably not a good idea for mounting. I will use a 4×4 post for the final mounting after I get the final instrument housing fabricated. The cable run is only what came with the unit, 8 feet maybe. Thanks for the suggestion to reduce the pull-up resistance. I will definitely try that. I still want to put a mono-stable trigger between the tipper and the Arduino, but my first try using a 555 timer circuit didn’t work. Would four conductor UTP instead of flat cable be a good idea? How long can I extend the cable between the sensors and the interface board?

        CWOP data for my station can be found here:

        https://www.findu.com/cgi-bin/wxpage.cgi?call=EW8407&last=120

        There won’t be rain data until I can get reasonable numbers.

        Thanks for all of the help.

        • John,

          I’m going to go in and look at our RTC modules again. The post you were referring me to was interesting to say the least.

          We have never had the issue you are suggesting and since the batteries are new, the charging argument doesn’t make sense to me. It never should have gone away.

          With the 200ohm resistor and the diode in the circuit, WeatherPiArduino supplies 3.3V to the DS3231 board so it will never charge the battery in any case.

          You scale the voltage down to 3.3/5.0 to read the wind vane. There is a footnote on the Spec regarding scale.

          I don’t think the four conductor UTP would make much difference, it would depend on how it is twisted. You can go a long ways, but you need to take into consideration that your wire will pick up noise. Remember, it is a radio antenna too.

          SDL

  52. Hello again.

    After having just “odd” behavior transmitting info via an Ethernet shield (as well as having the Arduino hooked to a PI for power and monitoring) I’ve decided to simplify the set up of my weather station. Taking out all of the networking and just writing JSON out the serial port gives a much smaller sketch size.

    So, I took the existing working sketch (that works on a Mega) and took out the networking. Downloaded to a UNO and wired it up according to your diagram on this page. Now I’m getting errors reading the temp from the BMP180 and can’t see the HTU21D-F and FRAM.

    Any thoughts on what is could be causing this issue, or what I might be off on the I2C set up (that works fine on a Mega)

    Also, from your example code, what should these be on a UNO :

    #define WpinLED 13
    #define WpinAnem 3
    #define WpinRain 2
    #define WintAnem 5
    #define WintRain 0

    Thanks.

    Earl

    • First thing to do is to run i2cscanner on your Arduino and see if you have the I2C hooked up correctly.

      SDL

      • Yes, I found that after I had posted.

        I didn’t have time last night to try it. But to be prepared for tonight when I can, assuming I see them, what’s the next step?
        If I see them, should the existing code work (from the Mega) or is it possible anything would be different?

        Earl

  53. Just got my board hooked up tonight. I have the ds3231 and ads1015 installed. Nothing else is hooked up at the moment. When I try to run the test, I get the following error:
    pi@raspberrypi:~/SDL_Pi_Weather_80422 $ sudo python SDL_Pi_Weather_80422Test.py
    Traceback (most recent call last):
    File “SDL_Pi_Weather_80422Test.py”, line 20, in
    import SDL_Pi_Weather_80422 as SDL_Pi_Weather_80422
    File “/home/pi/SDL_Pi_Weather_80422/SDL_Pi_Weather_80422.py”, line 20, in
    from Adafruit_ADS1x15 import ADS1x15
    File “./Adafruit_ADS1x15/Adafruit_ADS1x15.py”, line 4, in
    import smbus
    ImportError: No module named smbus

    If I run i2cdetect, I get the following:
    pi@raspberrypi:~/SDL_Pi_Weather_80422 $ i2cdetect -y 1
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: — — — — — — — — — — — — —
    10: — — — — — — — — — — — — — — — —
    20: — — — — — — — — — — — — — — — —
    30: — — — — — — — — — — — — — — — —
    40: — — — — — — — — 48 — — — — — — —
    50: — — — — — — — 57 — — — — — — — —
    60: — — — — — — — — 68 — — — — — — —
    70: — — — — — — — 77

    • Sounds like you are missing the smbus module in python. Your I2Cdetect looks correct!

      sudo apt-get install python-smbus

      Best,

      SDL

  54. That corrected my last issue, now on to the next. Trying to run WeatherPi.py and I get the following error. I have verified I have mySQL installed?

    pi@raspberrypi:~/weather/WeatherPi $ sudo python WeatherPi.py
    Traceback (most recent call last):
    File “WeatherPi.py”, line 22, in
    import pclogging
    File “/home/pi/weather/WeatherPi/pclogging.py”, line 21, in
    import MySQLdb as mdb
    ImportError: No module named MySQLdb

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Verify mySQL–

    pi@raspberrypi:~/weather/WeatherPi $ mysql -V
    mysql Ver 14.14 Distrib 5.5.44, for debian-linux-gnu (armv7l) using readline 6.3

  55. Hi! I recently bought weatherrack and weatherpiarduino. I am new to arduino and I can’t make it work. I have uploaded the sketch from https://github.com/switchdoclabs/SDL_Weather_80422 to my arduino mega. I Followed the fritzing shown here https://i2.wp.com/www.switchdoc.com/wp-content/uploads/2014/10/WPA-ArduinoMega_bbLogo.png, then put the pin to 18 instead of 5. I can only get a reading from anemometer but it always show gust of 747.xx mph and speed at around 200 – 300 mph even with just 1 spin. the rain gauge and wind vane stays at 0.00. What have I done wrong?

    • Time to debug your setup! Let me ask some questions.

      1) Post a picture of your setup showing all the wires. Then we can help you check. You have a wiring error or a software configuration issue.

      2) Download i2cscanner from https://playground.arduino.cc/Main/I2cScanner and make sure you are seeing the WeatherPiArduino board

      Carefully look at your software and make sure you haven’t confused Interrupt numbers and pin numbers.

      Best,

      SDL

  56. I recently purchased from Amazon WeatherRack – Anemometer / Wind Vane / Rain Bucket designed for SwitchDoc Labs WeatherPiArduino Board and Raspberry Pi/Arduino
    and
    WeatherPiArdinuo – Interface board for Weather Instruments for Raspberry Pi / Arudino
    But doesn’t work. Any suggestions or any software I need to install?
    This is a project in school and I need to have it functioned the soonest possible time.

    • You will need to give us all more information to help. What doesn’t work? How are you connecting it? Have you read the spec and the product page?

      Best,

      SDL

  57. It’s working now. I forgot to change the intRain to 0 (arduino mega). The wind vane however gives voltage output that is different from the documentation. That’s why it only returns 0.00 direction degrees.

  58. Okay, i have kinda started over. I needed to swap out my memory card for a larger one. So I went back and installed everything fresh. Now when I run the program I get the following:

    pi@raspberrypi:~/Weather/WeatherPi-master $ sudo python WeatherPi.py
    Traceback (most recent call last):
    File “WeatherPi.py”, line 29, in
    import doAllGraphs
    File “/home/pi/Weather/WeatherPi-master/doAllGraphs.py”, line 12, in
    import TemperatureHumidityGraph
    ImportError: No module named TemperatureHumidityGraph

    I have searched the Github site and can’t find that import. I must be over looking it?

  59. Ok so I have got the am2315 to read me the temps, i have this directly soldered to the RTC, I am unable to read the rain bucket or change the time in the RTC. Here is the output of the i2cdetect:

    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: — — — — — — — — — — — — —
    10: — — — — — — — — — — — — — — — —
    20: — — — — — — — — — — — — — — — —
    30: — — — — — — — — — — — — — — — —
    40: — — — — — — — — — — — — — — — —
    50: — — — — — — — 57 — — — — 5c — — —
    60: — — — — — — — — 68 — — — — — — —
    70: — — — — — — — 77

    I do not see the 0x48. Any ideas?

    Thanks in advance!

    • 0x48 is the default address for an ADS1015. Do you have one installed?

      On the AM2315. Don’t be surprised if you don’t see it all the time on i2cdetect. See the SwitchDoc Labs product page on the AM2315 for details.

      Regarding the RTC, download an example program for the DS3231 and get that working first. It clearly is present on your I2C bus.

      Regarding the Rain bucket, it is probably a wiring error or you don’t have the Interrupts set correctly. Almost for sure a wiring error.

      Best,

      SDL

  60. So I guess I am just confused as to how to hook up the rain bucket and anemometer. I had thought it was through the ADS1015, but i do not have one of these. I tried to follow the wiring list from the indestructible site but I guess it is different for me since the only components I am using is a WeatherPiArduio and a Raspberry Pi B+. I have successfully wired the JP1 to the i2c bus and am able to see the RTC and BPS as well as the AM2315.

    I guess my question is: How do I wire the anemometer and rain bucket to the raspberry pi directly?

    • John,

      As per the specification and product page (https://www.switchdoc.com/weatherpiarduino-bare-board/), you need an external ADC (Analog to Digital Converter) for the Wind Vane for the Raspberry Pi, as the Raspberry Pi does not have a built in ADC. There is a pin header on the WeatherPiArduino board for an Adafruit ADS1015.

      The Rain Bucket and Anemometer are connected to GPIO lines on the Raspberry Pi and are serviced in Python by Interrupt routines. The Fritzing diagrams in the specification show how to hook it up.

      Best,

      SDL

  61. Well, I finally made it past my other errors. It was trial and error but I went through every module and found the reference to a file path that was causing my error. Now I have hit yet another problem. I spent all day and can’t figure out how to start tracing this one down. Has anyone seen this error:

    Traceback (most recent call last):
    File “WeatherPi.py”, line 81, in
    tca9545 = SDL_Pi_TCA9545.SDL_Pi_TCA9545(addr=TCA9545_ADDRESS, bus_enable = TCA9545_CONFIG_BUS0)
    File “./SDL_Pi_TCA9545/SDL_Pi_TCA9545.py”, line 47, in __init__
    self._write(TCA9545_REG_CONFIG, config)
    File “./SDL_Pi_TCA9545/SDL_Pi_TCA9545.py”, line 52, in _write
    self._bus.write_byte_data(self._addr, register, data)
    IOError: [Errno 5] Input/output error

    • Rick,

      Send me your i2cdetect output. I’ll bet you are missing 0x73 (the I2C Mux). IOError indicates that the I2C address you are addressing for is not there.

      Best,

      SDL

  62. I don’t have one hooked up. Do I need one if I don’t plan on using the solar component?

    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: — — — — — — — — — — — — —
    10: — — — — — — — — — — — — — — — —
    20: — — — — — — — — — — — — — — — —
    30: — — — — — — — — — — — — — — — —
    40: — — — — — — — — 48 — — — — — — —
    50: — — — — — — — 57 — — — — — — — —
    60: — — — — — — — — 68 — — — — — — —
    70: — — — — — — — 77

    I do plan on adding a AM2302 sensor since I already own one. Do I need Mux for that?

    If I don’t need this, can I comment out that part of the code?

    • The I2C Mux allows the same I2C address to exist on separate buses. If you do not require that, then you do not need the code. You can comment it out. The AM2302 is not an I2C device, so you won’t need the mux for that.

      Best,

      SDL

  63. Thanks for all the help!! I am new to python and this is my first big project. I’m actually an old COBOL programmer!! I started looking at the code to comment out the Mux. But I started to see references to the bus0 for the GPIO weather rack sensors? So if I remove that code I will not get anything from those sensors. I have the ADS1015 board that I thought was for the GPIO of the sensor rack. Will I need to change the reference from BUS0 to the ADS1015? Or am I totally reading the code wrong?

  64. Hi, I’m having trouble getting my wind speed and rain gage to work. I using a Raspberry PI 2 with the Arduino board fully loaded.

    Here’s the output from SDL_Pi_Weather_80422Test.py:
    SDL_Pi_Weather_80422 Library
    WeatherRack Weather Sensors
    —————–
    Rain Total= 0.00 in
    Wind Speed= 0.00 MPH
    MPH wind_gust= 0.00 MPH
    Wind Direction= 90.00 Degrees
    Wind Direction Voltage= 0.303 V

    Here’s the output from WeatherPiArduino.py:

    WeatherRack Weather Sensors
    —————–
    Rain Total= 0.00 in
    Wind Speed= 0.00 MPH
    MPH wind_gust= 0.00 MPH
    Wind Direction= 90.00 Degrees
    Wind Direction Voltage= 0.303 V
    —————–
    —————–
    DS3231 Real Time Clock
    —————–
    Raspberry Pi= 2016-03-14 13:50:13
    DS3231= 2016-03-14 13:50:13
    DS3231 Temperature= 22.75 C
    —————–
    —————–
    AT24C32 EEPROM
    —————–
    writing first 4 addresses with random data
    address = 0 writing value=80
    address = 1 writing value=102
    address = 2 writing value=200
    address = 3 writing value=93
    —————–
    reading first 4 addresses
    address = 0 value = 80
    address = 1 value = 102
    address = 2 value = 200
    address = 3 value = 93
    —————–
    —————–
    BMP180 Barometer/Temp/Altitude
    —————–
    Temperature = 22.40 C
    Pressure = 101.00 KPa
    Altitude = -55.63 m
    Sealevel Pressure = 101.98 KPa
    —————–
    —————–
    HTU21DF Humidity and Temperature
    —————–
    Temperature = 22.60 C
    Humidity = 35.10 %
    —————–
    —————–
    AS3853 Lightning Detector
    —————–
    Last result from AS3953:
    —-No Lightning detected—
    Lightning Count = 0
    —————–
    —————–
    FRAM Byte Read Test
    —————–
    writing first 3 addresses with random data
    address = 0 writing value=4
    address = 1 writing value=153
    address = 2 writing value=206
    —————–
    reading first 3 addresses
    address = 0 value = 4
    address = 1 value = 153
    address = 2 value = 206

    Here’s the output from i2cdetect:

    pi@raspberrypi:~/RaspberryPi-WeatherPiArduino-master $ sudo i2cdetect -y 1
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: 03 — — — — — — — — — — — —
    10: — — — — — — — — — — — — — — — —
    20: — — — — — — — — — — — — — — — —
    30: — — — — — — — — — — — — — — — —
    40: 40 — — — — — — — 48 — — — — — — —
    50: 50 — — — — — — 57 — — — — — — — —
    60: — — — — — — — — 68 — — — — — — —
    70: — — — — — — — 77

    Everything seems to wired up correctly according to the fritzing diagram for the raspberry PI.

    Thanks,

    John

  65. Two simple questions (I hope);

    First, what’s the purpose of the real time clock (DS3231)? The SDL_Pi_Weather_80422.py script doesn’t appear to make any particular reference to it, and if the RPi has a time you’re happy with then why do we need a real time clock? Or is this just a way of resetting the RPi time if it’s been without power?

    Second, what’s the purpose of the optional FRAM chip? All readings from the rain bucket and wind anemometer require the script to be running in order to be recorded, so I can’t see why we need solid state memory.

    Thanks,
    Geoff

    • Geoff,

      Good questions.

      1) for the Arduino, there is no real time clock. For the Raspberry Pi, there is no real time clock. However, if you are connected to the Net, and if configured correctly, the Raspberry Pi will ask the network what time it is on boot up and periodically after that and set the software clock internally. You can set up the DS3231 to do that for the Raspberry Pi also. You can get the Pi to ask the clock what time it is from the DS3231 on boot up.

      2) The FRAM is for the Arduino end of the house. You record the data and place it in the FRAM to be recovered later. This preserves the data even through power outs. Take a look at Project Curacao and the Battery WatchDog if you want to see how we used it.

      We don’t include the FRAM for just that reason. You don’t need it with a Raspberry Pi.

      Best,
      SDL

  66. I got it working now. The wind Anemometer and rain bucket wires were on the wrong pin of the Pi2. Had them on gpio 15 and 18. Needed to be on gpio 23 and 24. The Raspberry pi fritzing diagram shows these wires going to gpio 15 and 18 Also does the purple wire on gpio 17 serve a purpose? Works ok without it.

    • Congratulations John!

      The GPIO17 line is only used if you don’t have an ADS1015 on the unit.

      Best,
      SDL

  67. I don’t know what to do now? My coding is not great enough to code out the Mux code. So I guess I will need to buy that component and wire it up. Do you have any diagrams on how to do that? Or, does anyone have code to use the WeatherPi board without all the solar components? I would like to use what I have without having to buy more parts. Thanks for any help!!

  68. This sounds like the same issue mentioned earlier – if you followed the instructions for the RPi then you have probably plugged it into the wrong GPIO pins.

    “As mentioned by SwitchDoc Labs, you actually want pins 16 & 18:

    “PiA+ GPIO/Pin 16: GPIO 23 WPA JP2/Pin3:Anemometer Anemometer Output from WeatherRack – Interrupt
    PiA+ GPIO/Pin 18: GPIO 24 WPA JP2/Pin 2:Rain Bucket Rain Bucket Output from WeatherRack – Interrupt”

    If you move the GPIO wires to 16 & 18, your wind and rain readings will start to work.”

    Geoff

  69. Ok, so just to be really clear – on the RPi, the script must be running in order to capture rainfall and windspeed data?
    The reed switches don’t store anything into FRAM until it’s retrieved?
    I’m asking because it would be a really power-efficient design if the RPI could check once an hour to get the rainfall data rather than running non-stop.

    Geoff

  70. If I buy the Mux, will it make it easier to complete this project? Any help will be appreciated!

  71. Ok I have purchased the ADC from Adafruit and installed it on the WPA. I am able to get wind direction using the test program, but for some reason i am unable to get the wind speed or rain. I have the Wind and Rain jumpers hooked up to GPIO 23 and 24 on the Pi. I have the 3.3v and ground connected to the jumper right next to it and the i2c connected to the Pi. Am I missing something? Could it be the Weather Rack?

    Thanks

  72. One last question. Do you have a Fritzing diagram of the pi to MUX to Weatherpi? I don’t quite understand the PDF of examples of wiring for the MUX. I think this is why I got so confused since I never saw the reference to the MUX is the wiring or writeups. This is why i didn’t purchase it with the other components!

  73. Hi, i have a question I buy the weather piarduino board and the weather rack, the anemometer and pluviometer works but I’ve forgotten the ADC for make the raspberry works whit the wind vane my questions is it, is there any difference if I use the ads1115 instead of ads1015 ,do I have to change the code? Or is the same ? Thanks sorry for my bad English gracias

    • Ivan,

      I think you will have to change the code. You just need to call the ADS1115 code in the Adafruit library. The ADS1115 is a 16 bit ADC while the ADS1015 is a 12 bit ADC.

      Best regards,

      SDL

  74. I can’t get the rain gauge to work. I have verified I’m going from JP2/2 to pin 10 on the Pi. I changed the code to reflecr GPIO 15 in the code. I uncommented the print line in the interrupt like you stated above to test. I do not see anything for the rain bucket. For a test, I reversed the wind and rain pins in the code. When I spin the anemometer I get totals. So it appears the bucket is not sending anything? How can I test if the bucket is working?

    • Put a Volt meter on the Rain pin. Tilt it and see if you see the voltage change. If you reversed the connectors, did you get wind interrupts from the rain bucket? That’s a good test.

      That will verify if the bucket is sending anything. Every time the rain bucket tips, it closes a reed switch. That’s how it is measuring the rain.

      Best,

      SDL

  75. So I did the test. It’s reading 3v all the time! As another test, I hooked the bucket up to my Ambient station that uses the same sensor array. It works fine there. Just to make sure I was probing correctly, I did the same on the Anometer and it would bounce up and down on volts as it was spun.

    • It’s hard to see the pulse using a voltmeter on the Rain pin, but it should look like 3V most of the time.

      The fact that you hooked up the Rain bucket to the Ambient station says that the rain bucket is working.

      Can you get the anemometer to make the rain bucket work and did you try the rain bucket on the anemometer interrupt?

      Now it is sounding like a wiring or software problem.

      Best,

      SDL

  76. I checked the pins again with the meter. If I hold the bucket in the middle it does drop to zero. I did what you asked. I printed the interrupt for both. Playing with the wiring and code, I have determined that nothing gets picked up on GPIO14. Could that pin be bad on my board or can I use another GPIO?

  77. I found the problem. I only had wires with one male and one female end. So I had soldered 2 female ends together. I taped them up so I didn’t see the wires has pulled apart! All is working now!!

    • Rick,

      Great job debugging. You worked through the possibilities and then you found the problem.

      Best,

      SDL

  78. Hi, I’m just finishing an adapted version of your system using a Raspi2, your WeatherPiArduino board, your WeatherRack Sensors plus three other external temperature sensors (Adafruit DS18B20). I’m using also a HTU21 board as temp/RH outside sensor.
    The system will be used to measure some temperatures of a telescope mirror for an astrophysics project, sensing also the weather parameters.
    I completeley “delete” from the software the SuAir part and the WLAN connection due to the use of main power and LAN cable from a neraby building.
    We need to sample and record the data in the db in a “fast” way, i.e. every 1-2 seconds (or little more), but it seems that the program has some latency, for example reading the DS18B20 data from files.
    We obtained a sample rate of 7-8 seconds: we shortened the data aquisition rate at the end of WeatherPi.py program in this way:

    second Count = 1
    while True:
    if ((secondCount % (1)) == 0):
    sampleWeather()
    writeWeatherRecord()
    secondCount = secondCount + 1
    time.sleep(.1)

    but the acquisition is still slow (7-8 second as I said) for our purposes.
    Please, do you have any suggestion on how to obtain a faster sample rate ?

    Thank you in advance

    • Mauro,
      Sounds like an incredibly great use of the project! Send us pictures!

      A couple of things come to mind.

      We think that you need to really figure out where the delays are in the program. It’s not clear to us.

      1) If you are using the serial monitor, change your baud rate up to 115200. You will be amazed at the speedup.

      2) Put Serial.print(millis()); statement in a number of places in the program. Figure out where the delays actually are. 7-8 seconds per sample is really, really slow.

      Let us know your results and we will are happy to help.

      While the DS18B20 sensors are cheap, they are slow.

      Best regards,

      SDL

  79. Got my station reporting to Weather Underground!! But I’m seeing some weird readings. I get a .01 reading about everyday? Second are wind gust. The wind is very low-2-3 mph but the gust are reading 20-30 mph? I have even seen a 200mph reading!! Any suggestions on debugging this?

    • Rick,

      Give us a link to your Weather Underground page and if you post the code, give us a webpage to share!

      The culprit is almost certainly noise on your lines from the computer to the WeatherRack sensors. How long are they? Are you close to a Radio or TV Station?

      Some answers:

      Long lines cause noise issues, but not necessarily voltage drop issues.

      Here is what you can do to probably make it longer (in Project Curacao, we went 30 meters. We used Cat10 wire and doubled the wires). For the Rain Bucket and Anemometer, add another pullup resistor to 3.3V on the line. It is currently 10K, so adding another 10K or even 5K resistor will make the line less susceptible to noise. You can also fiddle with the software debounce software to make it less susceptible to noise. For the Wind Vane, changing the software to read it multiple times and average it will make it less susceptible to noise.

      It is almost certainly electrical noise issues. Or a loose ground! “You can always trust your Mother, but you can never trust your Ground” as our CTO says.

      Best,

      SDL

  80. Let me clean the code up and I will share with you. I will try the resistor and see if that helps! I tried to add a link to the WU page but it will not post. I guess I can email you everything?

25 Trackbacks / Pingbacks

  1. Wind Power for the Pi/Arduino - 8 Days in the Breeze - SwitchDoc Labs
  2. WeatherPiArduino Weather Station Product Released - SwitchDoc Labs
  3. Weather For Your Raspberry Pi - WeatherPiArduino - SwitchDoc Labs
  4. Weather For Your Arduino - WeatherPiArduino - SwitchDoc Labs
  5. WeatherPiArduino PCB for the SparkFun Weather SEN-08942 - SwitchDoc Labs
  6. WeatherRack Weather Sensors Released - SwitchDoc Labs
  7. WeatherPiArduino Complete and Ready for the Caribbean - SwitchDoc Labs
  8. Make Your Own Weather Station - SwitchDoc Labs
  9. Solar Power for the Pi/Arduino - Six Days In The Sun - SwitchDoc Labs
  10. WeatherPiArduino Software Released for WeatherRack Sensors - SwitchDoc Labs
  11. WeatherRack Weather Sensors Arduino Drivers Released - SwitchDoc Labs
  12. Arduino Software Released: WeatherRack Sensors / WeatherPiArduino - SwitchDoc Labs
  13. Raspberry Pi Python Software Released: WeatherRack / WeatherPiArduino - SwitchDoc Labs
  14. Raspberry Pi Python I2C Driver for TCS34725 RGBC color sensor - SwitchDoc Labs
  15. Solar Power, Weather and the Raspberry Pi - SwitchDoc Labs
  16. WeatherPi Solar Power Weather Station - Boxing Up - SwitchDoc Labs
  17. WeatherPi Solar Power Weather Station - Monitoring the Sun - SwitchDoc Labs
  18. WeatherPi Solar Powered Weather Station - 3D Printing Parts - SwitchDoc Labs
  19. WeatherPi Solar Powered Weather Station Deployed Outside - SwitchDoc Labs
  20. WeatherPi Outside- 7 Days in the Sun - SwitchDoc Labs
  21. Turning the Pi On and Off - WeatherPi Solar Power - SwitchDoc Labs
  22. Solar Power - Project Curacao Update - SwitchDoc Labs
  23. Project Curacao Update - Loose Wire in the Caribbean - SwitchDoc Labs
  24. 3 Months in Paradise - Project Curacao Happy! - SwitchDoc Labs
  25. Environmental Management with Raspberry Pi + Solar | Voltaic Systems Blog – Solar DIY and Device Charging

Comments are closed.