Introduction: Create Your Own Solar Powered Raspberry Pi Weather Station (Updated)

Picture of Create Your Own Solar Powered Raspberry Pi Weather Station (Updated)

Note: This Instructable has been replaced with a new Grove based solder less instructable.


https://www.instructables.com/id/GroveWeatherPi-Ras...




In this Instructable you will learn:

  1. How to build a solar powered system
  2. How to design and size the panels and batteries
  3. How to gather data to analyze your system performance
  4. How to wire up a Raspberry Pi to a solar power system
  5. How to safely turn a Raspberry Pi on and off
  6. Building 3D Printed Parts for WeatherPi

And most importantly, have fun doing it!


This Instructable was updated on February 6, 2016 with new parts and wiring list.

What is WeatherPi?

WeatherPi is a solar powered Raspberry Pi WiFi connected weather station designed for Makers by SwitchDoc Labs. This is a great system to build and tinker with. All of it is modifiable and all source code is included. The most important functions are:

  • Senses 20 different environmental values
  • Completely Solar Powered
  • Has a full database containing history of the environment (MySQL)
  • Monitors and reports lots of data on the solar powered system - great for education!
  • Self contained and monitored for brownouts and power issues
  • Can be modified remotely
  • Download your data to crunch it on your PC
  • Can be modified to do SMS (Text) messaging, Twitters, webpages and more
  • Has an iPad Based Control Panel
  • Easy to connect to Twitter, WeatherUnderground, etc

This Instructable will show you how to build a WiFi Solar Powered Raspberry Pi Weather Station. This project grew out of a number of other projects, including the massive Project Curacao, a solar powered environmental monitoring system deployed on the Caribbean tropical island of Curacao. Project Curacao was written up in an extensive set of articles in MagPi magazine (starting in Issue 18 and continuing through Issue 22).

The WeatherPi Solar Powered Weather Station is an excellent education project. There are many aspects of this project that can be looked at and analyzed for educational purposes:

  • How do solar power systems behave? Limitations and advantages
  • Temperature, Wind and Humidity data analysis.
  • Shutting down and starting up small computers on solar power
  • Add your own sensors for UV, dust and pollen count and light color

Follow along on updates to the WeatherPi story on www.switchdoc.com.

Step 1: The WeatherPi Block Diagram

Picture of The WeatherPi Block Diagram

The WeatherPi Block Diagram looks a lot more complicated than it actually is.

The first thing to notice that the dashed lines are individual boards (WeatherPiArduino and SunAirPlus) which contain a lot of the block diagram and the second thing is that all of the sensors to the left of the diagram plug into the WeatherPiArduino board which simplifies the wiring. Don't be intimidated!

The Subsystems

The Power Subsystem of WeatherPi uses a SunAirPlus Solar Power Controller which handles the solar panels, charging of the battery and then supplies the 5V to the Raspberry Pi and the rest of the system. It also contains sensors that will tell you the current and voltage produced by the Solar Panels and consumed by the batteries and the Raspberry Pi. Gather that Data! More Cowbell! It also contains the hardware watchdog timer and the USB PowerControl that actually shuts off the power to the Raspberry Pi during a brownout event (after the Pi shuts gracefully down under software control).

The Sensor Subsystem of WeatherPi uses a WeatherPiArduino as the base unit and then plugs in a bunch of optional sensors such as wind speed / direction / rain, lightning detect (how cool is that!), inside and outside temperature and humidity.

The Software Subsystem of WeatherPi runs in Python on the Raspberry Pi. It collects the data, stores in in a MySQL database, builds graphs and does housekeeping and power monitoring.

Step 2: WeatherPi Sensor Suite

Picture of WeatherPi Sensor Suite

The WeatherPi Sensor Suite senses the following environmental values:

  • Wind Speed
  • Wind Direction
  • Rain
  • Outside Temperature
  • Outside Humidity
  • Lightning Detection
  • Barometric Pressure (and Altitude)
  • Inside Box Temperature
  • Inside Box Humidity

You can add more to the I2C bus and Analog to Digital Converter such as UV, dust counts, light color (sensing some types of pollution) and more! It's a great platform for expansion.

The sensor suite is built on the WeatherPiArduino board but there are several similar boards out there on the market.

Step 3: What's on the I2C Bus?

Picture of What's on the I2C Bus?

WeatherPi makes extensive use of the I2C bus on the Raspberry Pi.

At SwitchDoc Labs, we love data. And we love I2C devices. We like to gather the data using lots of I2C devices on our computers and projects. Project Curacao has a total of 12, WeatherPi has 11 devices and SunRover (a solar powered rover under development at SwitchDoc - you will see it as an Instructable in fall 2015) will have over 20 and will require one I2C bus just for controlling the motors. We are always running into conflicts with addressing on the I2C device. Since there are no standards, sometimes multiple devices will have the same address, such as 0x70 and you are just out of luck in running both of them on the same I2C bus without a lot of jimmy rigging.

To get around this addressing problem (and our conflict with an INA3221 and the Inside Humidity Sensor) we added an I2C Bus Multiplexer to the design which allows us to have many more I2C devices on the bus, irregardless of addressing conflicts. Here is our current list of I2C devices in WeatherPi:


DeviceI2C Address
BMP180 Barometric Pressure0x77
Real Time Clock DS32310x68
ATC EEPROM0x56
ADS1015 Analog to Digital Converter0x49
FRAM non-volatile storage0x50
ADS1015 on SunAirPlus0x48
INA3221 3 Channel Voltage/Current Monitor on SunAirPlus 0x40
HTU21D-F Humidity Sensor0x40
Embedded Adventures Lightning Detector0x03
AM2315 Outdoor Temp/Humidity0x5C
I2C 4 Channel I2C Bus Mux0x73

Here is what the I2C bus looks like on the Raspberry Pi. This is the output from the example code with the I2C 4 Channel Mux (hence there are 4 independent busses shown for the I2C bus).

Note that WeatherPi only uses Bus 0 and Bus 1.

Test SDL_Pi_TCA9545 Version 1.0 - SwitchDoc Labs

Sample uses 0x73
Program Started at:2015-05-10 20:00:56

-----------BUS 0-------------------
tca9545 control register B3-B0 = 0x1
ignore Interrupts if INT3' - INT0' not connected
tca9545 control register Interrupts = 0xc
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          03 -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 -- -- -- -- -- -- -- -- 49 -- -- -- -- -- -- 
50: 50 -- -- -- -- -- 56 -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- 73 -- -- -- 77                         

-----------------------------------

-----------BUS 1-------------------
tca9545 control register B3-B0 = 0x2
ignore Interrupts if INT3' - INT0' not connected
tca9545 control register Interrupts = 0xe
     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: -- -- -- 73 -- -- -- --                         

-----------------------------------

-----------BUS 2-------------------
tca9545 control register B3-B0 = 0x4
ignore Interrupts if INT3' - INT0' not connected
tca9545 control register Interrupts = 0xc
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- 73 -- -- -- --                         

-----------------------------------

-----------BUS 3-------------------
tca9545 control register B3-B0 = 0x8
ignore Interrupts if INT3' - INT0' not connected
tca9545 control register Interrupts = 0xc
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- 73 -- -- -- --                         

-----------------------------------
<\pre>

Step 4: Sizing Your Solar Power System

Picture of Sizing Your Solar Power System

One of the first things that comes up in a solar powered design is how to design the power system. The three main questions to be asked and answered are:

  1. How much power do I need?
  2. How many solar panels do I need?
  3. What size battery do I need?

The first thing you need to do when designing a solar powered system is to determine the power requirements for your solar powered design. Our criteria is that we want the WeatherPi Raspberry Pi Model A to run all day and at least three hours before sunrise and three hours after sunset. Our goals and budget influence our hardware choices, so they are not totally independent.

The table below contains estimated power consumption for models of the Raspberry Pi, including a Wireless USB dongle. We are assuming in each of these that you turn the HDMI port off which saves ~20ma.

Model AModel A+Model BModel B+Model Pi2 B
Current (mA)260(200)195(135)480(420)290(230)304(240)
Power (W)1.30.9752.41.451.52
SourceMeasuredMeasuredMeasuredMeasuredMeasured

All of the above measurements include about 60ma for the USB WiFi Dongle! Parenthetical numbers are without the 60ma.

Based on the above, first we will lay out my assumptions for our Raspberry Pi Model A+ based design. The LiPo batteries chosen will store 6600mAh. Why choose the Model A+? It's the lowest current consuming raspberry Pi!

What is mAh (milli Amp hours)? 6600mAh means you can take 100mA for 66 hours, theoretically. In actuality, you will not be able to get more than about 80% on average depending on your battery. How fast you discharge them also makes a big difference. Slower the discharge rate, the more mAh you can get out of the battery. For comparison, an AA battery will hold about 1000mAh[citation: http://en.wikipedia.org/wiki/AA_battery] and a D battery will hold about 10000mAh[citation: http://en.wikipedia.org/wiki/AA_battery]

In a system like this, it is best to charge your LiPo batteries completely and then hook up the computer and see how long it takes to discharge the battery and die. We did this test on the WeatherPi system. The results are here on switchdoc.com.

Assumptions:

  • Two Voltaic 3.4W 6V/530ma Solar Cells (total of 6.8W) (530ma x 2 panels = 1060ma)
  • 8 Hours of Sun running the cells at least at 70% of max Delivery of current to Raspberry Pi at 85% efficiency (you lose power in the charging and boosting circuitry)
  • Raspberry Pi Model A+ takes 195mA on average (with the Wireless USB Dongle)
  • Raspberry Pi Model A+ running 24 hours per day
  • 6600mAh LiPo Batteries

Given these we can calculate total Raspberry Pi Model A runtime during a typical day:

PiRunTime = (8 Hours * 70% * 1060mA) *85% / (195mA) = 25 hours

Our goal was for 24 hours, so it looks like our system will work. 16 Hours of running the Raspberry Pi Model A+ on batteries alone will take (195mA/85%)*16 Hours = 3670mAh which is comfortably less than our 6600mAh batteries can store. The WIFI dongle added about 60mA on average. It was enabled the entire time the Raspberry Pi was on. No effort was made to minimize the power consumed by the WiFi dongle. Your results will depend on what other loads you are driving, such as other USB devices, GPIO loads, I2C devices, etc.

Note that during the day, on average, we are putting into the battery about 6000mAh.

This also means a bigger battery than 6600mAh will not make much difference to this system.

So, on a bright sunny day, we should be able to run 24 hours a day. Looking at the results from WeatherPi being out in the sun for a week, this seems to be correct. However, it will be cloudy and rainy and your system will run out of power. The next most important part of the design is how to handle Brownouts! See a step later in this Instructable about how to hand this nasty little problem.

The four most important parts of verifying your Solar Power Design:

  • Gather real data
  • Gather more real data
  • Gather still more real data
  • Look at your data and what it is telling you about the real system. Rinse and Repeat.

Step 5: The Power System

Picture of The Power System

The power system in Weather Pi consists of four parts:

  • Two Solar Panels
  • One 6600Ah LiPo Battery
  • SunAirPlus Solar Power Controller, Pi Power Supply and Data Gathering system
  • USB PowerControl board for Pi Power Control

We are using 2 3.4W Solar Panels from Voltaic Systems. These are high quality panels that we have used in previous projects and last a long time even in the tropical sun. The picture above is of the same panels on Project Curacao after six months in the sun. Those are clouds reflected on the panels, not dirt. The panels are prefect.

We selected a 6600mAh battery from Adafruit for this design. See the "Sizing your Solar System" step below.

We are using a SunAirPlus Solar Power Controller in this design.

SunAirPlus includes an I2C INA3221 3 Channel Current / Voltage Monitor and a I2C 4 channel 12 bit Analog to Digital Converter (ADS1015). The INA3221 allows you to monitor all of the major currents and voltages in the system (Battery / Solar Panels / Load - Computer ). You can tell what your solar power project is doing in real time.

Here are some results from the SunAirPlus board using the onboard INA3221. You can see that the battery is almost fully charged and the solar cell voltage (actually a variable power supply on the test bench) is 5.19V and it is supplying 735mA.

Test SDL_Pi_INA3221 Version 1.0 - SwitchDoc Labs

Sample uses 0x40 and SunAirPlus board INA3221
Will work with the INA3221 SwitchDoc Labs Breakout Board


------------------------------
LIPO_Battery Bus Voltage: 4.15 V 
LIPO_Battery Shunt Voltage: -9.12 mV 
LIPO_Battery Load Voltage:  4.14 V
LIPO_Battery Current 1:  91.20 mA

Solar Cell Bus Voltage 2:  5.19 V 
Solar Cell Shunt Voltage 2: -73.52 mV 
Solar Cell Load Voltage 2:  5.12 V
Solar Cell Current 2:  735.20 mA

Output Bus Voltage 3:  4.88 V 
Output Shunt Voltage 3: 48.68 mV 
Output Load Voltage 3:  4.93 V
Output Current 3:  486.80 mA

You can use this board to power your projects and add a servo or stepper motor to allow it to track the sun using photoresistors to generate even more power.

The USB PowerController Board is basically a controlled Solid State Relay to turn the power on and off to the Raspberry Pi. This board sits between the Solar Power Controller (SunAirPlus) and a Raspberry Pi Model A+. The input to the board was designed to come directly from a LiPo battery so the computer won't be turned on until the LiPo battery was charged up above ~ 3.8V. A hysteresis circuit is provided so the board won't turn on and then turn immediately off because the power supply is yanked down when the computer turns on (putting a load not the battery). This really happens!!!! You kill Raspberry Pi SD Cards this way.

Step 6: Safely Turning the Pi on and Off

Picture of Safely Turning the Pi on and Off

The Brownout Problem

In this important step, we are going to discuss the problem of powering down and up your Raspberry Pi. In Solar Powered systems, this is called the "Brownout Problem". We will be showing how to use a simple device, the USB Power Control from SwitchDoc Labs to solve this problem.

One of the most important issue in designing a Raspberry Pi Solar Power System is turning on and off. The "Brownout Problem" is a real issue. Why worry? If you have a long string of cloudy days, you may run your battery down. You can compensate for this in your design by adding more panels and more batteries, but that can get really expensive and your system might still run out of power, just a lot less frequently.

Shutting Off the Pi

Shutting a Raspberry Pi off is pretty easy. When the battery voltage falls below some value, you just do a “sudo shutdown -h now” and your Raspberry Pi will shutdown cleanly. After doing the test talked about here, we chose 3.5V as the voltage to shut down the Raspberry Pi.

Note that in most solar power systems, you need to monitor the battery voltage and not the 5V power supply because with most modern voltage booster systems, the circuitry will work very hard to keep the 5V going and then just give up crashing to a much lower voltage when it runs out of power.

That means your computer would have little or no warning when the voltage is about to drop. By monitoring the battery voltage, you can tell when the battery is getting low enough and then shut down your computer safely. For LiPo batteries, this will be when your voltage gets down to about 3.5V or so. This can all be monitored with the SunAirPlus solar charge controller that we are using in WeatherPi.

Starting the Pi

Enough about shutting down the computer. What about starting it up?

The Issue

You can’t just let the controller power up the computer. The problem is that the supply voltage will move up and down until there is enough charge in the battery to fully supply the computer. When the computer turns on (connecting a full load), you will pull the battery down hard enough to brown out the computer causing the Raspberry Pi to crash. This constant rebooting cycle can corrupt and ruin your SD card and cause your computer to never boot at all, even when the power is restored. We had this VERY thing happen to us 3500 miles away with Project Curacao. Arduinos are more tolerant of this, but Raspberry Pi’s do not like a ill-behaved power supply. You just can’t be sure of what state the computer will power up at without a good power supply.

This issue can be handled in a number of ways. The first is to use another computer (like an Arduino made to be very reliable by using a WatchDog - see the Reliable Computer series on switchdoc.com - http://www.switchdoc.com/2014/11/reliable-projects-watchdog-timers-raspberry-pi-arduinos/) to disconnect the Raspberry Pi’s power through a latching relay or MOSFET when there isn’t enough power. Project Curacao (http://www.switchdoc.com/project-curacao-introduction-part-1/) used this approach.

We didn't want to add an additional computer to WeatherPi, so we chose a second solution.

Power Your Pi Up and Down with the USB Power Control

A second (and cheaper!) way of handling the brownout and power up problem is to use a dedicated power controller that will shut the power off to the Raspberry Pi and restore the power when the battery voltage is high enough to avoid ratcheting the supply voltage up and down because of the load of the Raspberry Pi. This is called Hysteresis. We have designed a board to do just this (called the USB Power Controller) that will plug between the USB coming out of the SunAir Solar Power Controller and the Raspberry Pi as in the picture to the right.

The USB Power Controller Board

The USB PowerControl board is a USB to USB solid state relay.

Anything you can plug into a USB port can be controlled with USB PowerControl. It's easy to hook up. You connect a control line (a GPIO line or the output of a LiPo battery) to the LIPOBATIN line on the USB Power Control device and if the line is LOW (< ~3.3V) the USB Port is off. If it is HIGH (above 3.8V) the USB Port is turned on and you have 5V of power to the USB plug.

There is a hysteresis circuit so the board won't turn on and then turn immediately off because the power supply is yanked down when the computer turns on (putting a load not the battery).

There is little software for this device. You connect it directly to your LiPo battery for automatic control! The only software used detects the battery voltage and decides when to shut down the computer. The USB Power Control takes care of shutting the power to the Raspberry Pi when the battery voltage gets low enough. Note that a shutdown Raspberry Pi still draws current (according to one quick measurement, about 100ma).

One More Scenario

One last point. After thinking about the power down sequence, we came up with one more scenario. What if:

1) The battery voltage reaches 3.5V and the Raspberry Pi is shut down.

2) The USB PowerController will turn the power off when the battery reaches about ~3.4V.

However, what if the sun comes up at this time and the battery starts charging again? Then the USB PowerController will never reach ~3.4V and will never turn off. And the Pi will never reboot. Not a good scenario!

We fixed this by adding a hardware watchdog timer. For a tutorial on hardware watchdog timers, read the SwitchDoc series starting here.

We used a Dual WatchDog Timer Board to fix this problem. We set the RaspberryPi python to "pat the dog" (preventing the watchdog timer from triggering) every 10 seconds. The timer is set to trigger after about 200 seconds if it isn't patted. The timer is connected to pull the "COut" point down to ground on the USB PowerController which shuts off the Raspberry Pi. Because of the hysteresis circuit on the USB PowerController the Raspberry Pi will stay off until the battery voltage reaches ~3.9V and then the Pi will reboot. Now the above scenario will never happen. By the way, there is no real way of using the internal Pi Watchdog to do this. You don't want to reboot the Pi, you want to shut off the power in this scenario.

Step 7: The Parts List

Picture of The Parts List

No project is complete without a parts list. These are suggestions! There are lots of options for a number of these boards. If you substitute, make sure you check for compatibility!

Parts List (February 6, 2016)

Step 8: Building the Box

Picture of Building the Box

As with most projects, we tend to "breadboard" the circuitry before we put it into the enclosure. With WeatherPi, we spread out the parts, wired them up, made sure each of the major paths worked (and of course, took the obligatory nighttime geek shot) and then started placing them in the box, attaching them with screws and posts through the plastic.

Putting the WeatherPi into the BUD Industries box was pretty straight forward. We chose to put the solar power part of the circuit on top and the Raspberry Pi and the WeatherPiArduino Sensor array in the box bottom. The parts were all placed and then all the screw holes and outside screws were sealed with silicon caulking.

We used Gland Connectors to run the wires in and out of the box. Then we sealed the Gland Connectors. The Gland Connectors aren't necessarily waterproof, but they make things tighter and provide a good strain relief. We then used a waterproof disconnectable connector to tie into the WeatherRack weather instruments.

Step 9: 3D Printing and the WeatherPi

Picture of 3D Printing and the WeatherPi

In building the WeatherPi Solar Powered Weather Station, we saw a couple of parts that we decided it would be good to 3D Print. In the 6 months since we bought our SwitchDoc Labs MakerBot Replicator, we have totally changed the way we build special parts for prototyping. And with the latest extruder and firmware updates, the MakerBot rocks! I have done 10 long prints with no problem. It used to be Xacto knives and foam, wood and glue, but now we just build new parts when we need them. The three parts we have used 3D Printing for so far are:

  • Bracket with Hinges to connect solar panel panels to weather station box (adjustable for latitude)
  • Opposite hinge on which to hang solar power panels (the tabs on the side of the rectangle are just to make sure the bracket is flat!)
  • Sun Cover for AM2315 Temperature and Humidity Sensor - we killed the Humidity sensor in one of these in the sun in Project Curacao.

Here are the OpenSCAD files.

Step 10: The Raspberry Pi Python Software

Picture of The Raspberry Pi Python Software

A big part of the WeatherPi project is the software. All of the python software for this project is up on github at the switchdoclabs section. We also included all of the various libraries for the I2C devices we are using.

Non-Normal Requirements for your Pi

You will need to add the following software and libraries to your Raspberry Pi

MySQL

There are lots of tutorials on the net for installing MySQL. Here is the one we used.

Addition on July 22, 2015: The structure of the WeatherPi MySQL database in mysqldump format is located on github https://github.com/switchdoclabs/WeatherPiSQL. You can use this file to build the MySQL database for the WeatherPi Project.

MatPlotLib

This is the graphing subsystem with a great interface to Python. It is a bit more complex to install, so we wrote a tutorial on how to install it on SwitchDoc.com. Note that the installation takes a long time, about 8 hours on a Raspberry Pi (mostly unattended).

The WeatherPi Python Software

The WeatherPi software is pretty simple. The application was much less complex than the Project Curacao software so we decided not use the apscheduler package and decided just to use a simple loop with a "every 15 seconds" type of control. Here is the main loop:

secondCount = 1
while True:

        # process Interrupts from Lightning

        if (as3935Interrupt == True):
                process_as3935_interrupt()


        # process commands from RasPiConnect
        print "---------------------------------------- "

        processCommand()

        if ((secondCount % 10) == 0):
                # print every 10 seconds
                sampleAndDisplay()
                patTheDog()      # reset the WatchDog Timer
                blinkSunAirLED2X(2)




        # every 5 minutes, push data to mysql and check for shutdown


        if ((secondCount % (5*60)) == 0):
                # print every 300 seconds
                sampleWeather()
                sampleSunAirPlus()
                writeWeatherRecord()
                writePowerRecord()

                if (batteryVoltage < 3.5):
                        print "--->>>>Time to Shutdown<<<<---"
                        shutdownPi("low voltage shutdown")


        # every 15 minutes, build new graphs

        if ((secondCount % (15*60)) == 0):
                # print every 900 seconds
                sampleAndDisplay()



        # every 48 hours, reboot
        if ((secondCount % (60*60*48)) == 0):
                # reboot every 48() hours seconds
                rebootPi("48 hour reboot")


        secondCount = secondCount + 1
        # reset secondCount to prevent overflow forever

        if (secondCount == 1000001):
                secondCount = 1

        time.sleep(1.0)

Note that we reboot the Pi every two days. Why do we do that? We have noticed that after heavy usage of MatPlotLib and/or MySQL, that sometimes after a long time, you run out of resources, giving all sorts of odd behavior. Since the RaspberryPi A+ has a small amount of RAM, rebooting is the easiest way of fixing it.

Check out all the code up on github.com.

The code for the RasPiConnect control panel is discussed in another step.

Step 11: Building a Control Panel Using RasPiConnect

Picture of Building a  Control Panel Using RasPiConnect

We use RasPiConnect to build our control panels for our projects. It allows us to put graphs, controls, buttons, sliders, etc. up on our iPad/iPhone screens without having to write apps. RasPiConnect works on Raspberry Pi's and on Arduinos. We have used this software on 5 different projects, with WeatherPi being the latest.

How to build a control panel for WeatherPi is beyond the scope of this Instructable, but here is the tutorial we wrote for doing what we are doing for WeatherPi. We are using the same command passing mechanism in WeatherPi that we used in MouseAir. RasPiConnect comes with an excellent, comprehensive manual here.

All the RasPiConnect code that we used in WeatherPi is on github under github.com/switchdoclabs. Note that only the directory local is uploaded as that is the only places changes to the code are made as explained in the RasPiConnect manual.

Step 12: Full Wiring List

Picture of Full Wiring List

Following is the complete wiring list for WeatherPi. As you wire it, check off each wire for accuracy.

Key:

Raspberry Pi A+:PiA+

Grove I2C Bus Mux: GI2CM

Dual WatchDog Timer Board:WDT

WeatherPiArduino:WPA

USB Power Control: USBPC

SunAirPlus: SAP


Raspberry Pi A+ (PiA+)
GPIO Header
From ToDescription
PiA+ GPIO/Pin 1: 3.3V GI2CM JP1/Pin 3:VCCPower for I2C Mux Board - Computer Interface
PiA+ GPIO/Pin 2: 5.0VWDT JP1/Pin 1:VDDPower for Dual WatchDog Timer Board
PiA+ GPIO/Pin 3: SDAGI2CM JP1/Pin2:SDASDA for I2C Mux Board - Computer Interface
PiA+ GPIO/Pin 5: SCLGI2CM JP1/Pin1:SCLSCL for I2C Mux Board - Computer Interface
PiA+ GPIO/Pin 6: GNDGI2CM JP1/Pin4:GNDGND for I2C Mux Board - Computer Interface
PiA+ GPIO/Pin 11 GPIO 17WDT JP2/Pin1:DOG1_TRIGGERTrigger Input for WatchDog 1 Timer (Pat the Dog)
PiA+ GPIO/Pin 12: GPIO 18WPA JP13/Pin1: LD-IRQInterrupt Request from the AS3935 on Lightning Detector Board
PiA+ GPIO/Pin 16: GPIO 23WPA JP2/Pin3:AnemometerAnemometer Output from WeatherRack - Interrupt
PiA+ GPIO/Pin 17: 3.3VVCC Screw Connector To provide more 3.3V Connections
PiA+ GPIO/Pin 18: GPIO 24WPA JP2/Pin 2:Rain BucketRain Bucket Output from WeatherRack - Interrupt
PiA+ GPIO/Pin 22: GPIO 25SAP JP13/Pin8: EXTGP0GP0 on SunAir Board - Yellow LED display
Grove I2C Mux Board (GI2CM)
JP1 - Computer
GI2CM JP1/Pin 2:SDAPiA+ GPIO/Pin 3:SDASDA to I2C Mux Board - Computer Interface
GI2CM JP1/Pin 1: SCLPiA+ GPIO/Pin 5:SDASCL to I2C Mux Board - Computer Interface
GI2CM JP1/Pin 4: GNDPiA+ GPIO/Pin 6:GNDGND for I2C Mux Board - Computer Interface
GI2CM JP1/Pin 3: VCCPiA+ GPIO/Pin 1: 3.3VPower for I2C Mux Board - Computer Interface



JP2 - I2C Bus 0WeatherPiArduino I2C Bus
GI2CM JP2/Pin 3: VDU0WPA JP1/Pin 2: VDD3.3V from WPA Board
GI2CM JP2/Pin 2: GNDWPA JP1/Pin 1: GNDGND for WPA Board
GI2CM JP2/Pin 5: SC0WPA JP4/Pin 1: SCLSCL for WPA Board
GI2CM JP2/Pin 4: SD0WPA JP4/Pin 2: SDASDA for WPA Board
JP3 - I2C Bus 1SunAirPlus I2C Bus
GI2CM JP3/Pin 3: VDU1SPA JP23/Pin 3: VDD5.0V for Bus 1 for I2C Mux
GI2CM JP3/Pin 2: GNDSAP JP13/Pin 4: GNDGND for SAP Board
GI2CM JP3/Pin 5: SC1SAP JP13/Pin 1: EXTSCLSCL for SAP Board
GI2CM JP3/Pin 4: SD1SAP JP13/Pin 2: EXTSDASDA for SAP Board
JP4 - I2C Bus 3Auxiliary GND for WDT Board
GI2CM JP4/Pin2: GNDWDT JP1/Pin 1:GNDGND for WDT Board


Dual WatchDog Timer Board (WDT)
JP1
WDT JP1/Pin 1: VDDPiA+ GPIO/Pin 2:VDD (5.0V)
WDT JP1/Pin 2: GNDGI2CM JP4/Pin 2:GNDGND for WDT Board
JP2
WDT JP2/Pin 1: DOG1_TRIGGERPiA+ GPIO/Pin 11:GPIO 17WDT Trigger from Raspberry Pi
JP3
WDT JP3/Pin 1: DOG1_ARDUINORESETUSBPC: TP3 - COUTSolder Wire to TP3 - COUT on USB PowerControl

WeatherPiArduino (WPA)
JP1
WPA JP1/Pin 1: GNDGI2CMux JP2/Pin 2: GNDGND for WPA Board from GI2CMux
WPA JP1/Pin 2: 3V3GI2CMux JP2/Pin 3: VDU03.3V for I2C Bus 0 from WPA
JP2
WPA JP2/Pin 2: Rain BucketPiA+ GPIO/Pin 18: GPIO 24Rain Bucket Output from WeatherRack - Interrupt
WPA JP2/Pin 3: AnemometerPiA+ GPIO/Pin 16: GPIO 23Anemometer Output from WeatherRack - Interrupt
JP4
WPA JP4/Pin 1: SCLGI2CMux JP4/Pin 5: SCLSCL from GI2C Mux Board
WPA JP4/Pin 2: SDAGI2CMux JP4/Pin 4: SDASDA from GI2C Mux Board
WPA JP4/Pin 3: 3V3VCC Screw Connector 3.3V From Pi/Screw Connector
JP13
WPA JP13/Pin 1: LD-IRQPiA+ GPIO/Pin 12: GPIO 18Interrupt Request from the AS3935 on Lightning Detector Board

USB Power Control (USBPC)
USBIN: USB Connector from SAPUSB A OUT on SAP
USBOUT: USB Connector to PiA+USB Power Input on PiA+
JP1
USBOUT JP1/Pin 1: LIPOBATINSAP JP4/Pin1: LiPo Battery OutSAP Plus of LiPo Battery Out to USB PowerControl
TP3 - COUT: WDT JP3/Pin 1: DOG1_ARDUINORESETShuts USB Power Control down if Raspberry Pi has been shutdown and LIPOBATIN < ~3.9V

SunAirPlus (SAP)
USB A Out:USBIN on USBPC
J5 Battery:To LiPo Battery Pack
J6 Solar:To Solar Panels
JP4
SAP JP4/Pin 1:USBPC: JP1/Pin1 LIPOBATINSAP Plus of LiPo Battery Out to USB PowerControl
JP10
SAP JP10/Pin 1: SCLSCL (5.0V)Connected to Outdoor Temp/Hum AM2315 Sensor - works better on 5.0V I2C Bus
SAP JP10/Pin 2: SDASDA (5.0V)Connected to Outdoor Temp/Hum AM2315 Sensor - works better on 5.0V I2C Bus
SAP JP10/Pin 3: VDD5VDD5Connected to Outdoor Temp/Hum AM2315 Sensor - works better on 5.0V I2C Bus
SAP JP10/Pin 4: GNDGNDConnected to Outdoor Temp/Hum AM2315 Sensor - works better on 5.0V I2C Bus
JP13
SAP JP13/Pin 1: EXTSCLGI2CMux JP3/Pin 5: SC1SCL
SAP JP13/Pin 2: EXTSDAGI2CMux JP3/Pin 4: SD1SD
SAP JP13/Pin 3: VDDSPA JP23/Pin2: VDD55V I2C Interface from SAP
SAP JP13/Pin 4: GNDGI2CMux JP3/Pin 2: GNDGND form GI2CMux Board
SAP JP13/Pin 8: EXTGP0PiA+ GPIO/Pin 22: GPIO 25Line from Raspberry Pi to flash SAP Yellow LED on GP0
JP23
SAP JP23/Pin 2: VDD5SAP JP13/Pin 3: VDD5.0V for SAP I2C Bus to GI2CMux
SAP JP23/Pin 3: VDD5 GI2CMux JP3/Pin 3: VDU15.0V for IG2CMux I2C Bus1

Step 13: Obsolete Parts List (as of February 6th, 2016) for Weather Pi

On February 6, 2016, the I2C Mux board was replaced with the new model Grove I2C Mux with Status LEDs.

------------------

This parts list is presented for completeness.

-------------------

No project is complete without a parts list. These are suggestions! There are lots of options for a number of these boards. If you substitute, make sure you check for compatibility!

Parts List (Obsolete as of February 6, 2016)

Step 14: Obsolete Wiring List (as of February 6, 2016)

OBSOLETE as of February 6, 2016

Following is the complete wiring list for WeatherPi. As you wire it, check off each wire for accuracy.

Key:

Raspberry Pi A+:PiA+

I2C Bus Mux: I2CM

Dual WatchDog Timer Board:WDT

WeatherPiArduino:WPA

USB Power Control: USBPC

SunAirPlus: SAP


Raspberry Pi A+ (PiA+)
GPIO Header
From ToDescription
PiA+ GPIO/Pin 1: 3.3V I2CM JP1/Pin 4:VCCPower for I2C Mux Board - Computer Interface
PiA+ GPIO/Pin 2: 5.0VWDT JP1/Pin 1:VDDPower for Dual WatchDog Timer Board
PiA+ GPIO/Pin 3: SDAI2CM JP1/Pin1:SDASDA for I2C Mux Board - Computer Interface
PiA+ GPIO/Pin 5: SCLI2CM JP1/Pin2:SCLSCL for I2C Mux Board - Computer Interface
PiA+ GPIO/Pin 6: GNDI2CM JP1/Pin3:GNDGND for I2C Mux Board - Computer Interface
PiA+ GPIO/Pin 11 GPIO 17WDT JP2/Pin1:DOG1_TRIGGERTrigger Input for WatchDog 1 Timer (Pat the Dog)
PiA+ GPIO/Pin 12: GPIO 18WPA JP13/Pin1: LD-IRQInterrupt Request from the AS3935 on Lightning Detector Board
PiA+ GPIO/Pin 16: GPIO 23WPA JP2/Pin3:AnemometerAnemometer Output from WeatherRack - Interrupt
PiA+ GPIO/Pin 17: 3.3VVCC Screw Connector To provide more 3.3V Connections
PiA+ GPIO/Pin 18: GPIO 24WPA JP2/Pin 2:Rain BucketRain Bucket Output from WeatherRack - Interrupt
PiA+ GPIO/Pin 22: GPIO 25SAP JP13/Pin8: EXTGP0GP0 on SunAir Board - Yellow LED display

I2C Mux Board (I2CM)
JP1 - Computer
I2CM JP1/Pin 1:SDAPiA+ GPIO/Pin 3:SDASDA to I2C Mux Board - Computer Interface
I2CM JP1/Pin 2: SCLPiA+ GPIO/Pin 5:SDASCL to I2C Mux Board - Computer Interface
I2CM JP1/Pin 3: GNDPiA+ GPIO/Pin 6:GNDGND for I2C Mux Board - Computer Interface
I2CM JP1/Pin 4: VCCPiA+ GPIO/Pin 1: 3.3VPower for I2C Mux Board - Computer Interface
I2CM JP1/Pin 5: RESET’VCC Screw Connector 3.3V From Pi/Screw Connector
JP2 - I2C Bus 0WeatherPiArduino I2C Bus
I2CM JP2/Pin 2: VD0WPA JP1/Pin 2: VDD3.3V from WPA Board
I2CM JP2/Pin 3: GNDWPA JP1/Pin 1: GNDGND for WPA Board
I2CM JP2/Pin 4: SC0WPA JP4/Pin 1: SCLSCL for WPA Board
I2CM JP2/Pin 5: SD0WPA JP4/Pin 2: SDASDA for WPA Board
JP3 - I2C Bus 1SunAirPlus I2C Bus
I2CM JP3/Pin 2: VD1SPA JP23/Pin 3: VDD5.0V for Bus 1 for I2C Mux
I2CM JP3/Pin 3: GNDSAP JP13/Pin 4: GNDGND for SAP Board
I2CM JP3/Pin 4: SC1SAP JP13/Pin 1: EXTSCLSCL for SAP Board
I2CM JP3/Pin 5: SD1SAP JP13/Pin 2: EXTSDASDA for SAP Board
JP4 - I2C Bus 3Auxiliary GND for WDT BoardGND for WDT Board
I2CM JP4/Pin 3: GNDWDT JP1/Pin 1:GNDGND for WDT Board


Dual WatchDog Timer Board (WDT)
JP1
WDT JP1/Pin 1: VDDPiA+ GPIO/Pin 2:VDD (5.0V)
WDT JP1/Pin 2: GNDI2CM JP4/Pin 3:GNDGND for WDT Board
JP2
WDT JP2/Pin 1: DOG1_TRIGGERPiA+ GPIO/Pin 11:GPIO 17WDT Trigger from Raspberry Pi
JP3
WDT JP3/Pin 1: DOG1_ARDUINORESETUSBPC: TP3 - COUTSolder Wire to TP3 - COUT on USB PowerControl

WeatherPiArduino (WPA)
JP1
WPA JP1/Pin 1: GNDI2CMux JP2/Pin 3: GNDGND for WPA Board from I2CMux
WPA JP1/Pin 2: 3V3I2CMux JP2/Pin 2: VD03.3V for I2C Bus 0 from WPA
JP2
WPA JP2/Pin 2: Rain BucketPiA+ GPIO/Pin 18: GPIO 24Rain Bucket Output from WeatherRack - Interrupt
WPA JP2/Pin 3: AnemometerPiA+ GPIO/Pin 16: GPIO 23Anemometer Output from WeatherRack - Interrupt
JP4
WPA JP4/Pin 1: SCLI2CM JP2/Pin 1: SCLSCL from I2C Mux Board
WPA JP4/Pin 2: SDAI2CM JP2/Pin 2: SDASDA from I2C Mux Board
WPA JP4/Pin 3: 3V3VCC Screw Connector 3.3V From Pi/Screw Connector
JP13
WPA JP13/Pin 1: LD-IRQPiA+ GPIO/Pin 12: GPIO 18Interrupt Request from the AS3935 on Lightning Detector Board

USB Power Control (USBPC)
USBIN: USB Connector from SAPUSB A OUT on SAP
USBOUT: USB Connector to PiA+USB Power Input on PiA+
JP1
USBOUT JP1/Pin 1: LIPOBATINSAP JP4/Pin1: LiPo Battery OutSAP Plus of LiPo Battery Out to USB PowerControl
TP3 - COUT: WDT JP3/Pin 1: DOG1_ARDUINORESETShuts USB Power Control down if Raspberry Pi has been shutdown and LIPOBATIN < ~3.9V

SunAirPlus (SAP)
USB A Out:USBIN on USBPC
J5 Battery:To LiPo Battery Pack
J6 Solar:To Solar Panels
JP4
SAP JP4/Pin 1:USBPC: JP1/Pin1 LIPOBATINSAP Plus of LiPo Battery Out to USB PowerControl
JP10
SAP JP10/Pin 1: SCLSCL (5.0V)Connected to Outdoor Temp/Hum AM2315 Sensor - works better on 5.0V I2C Bus
SAP JP10/Pin 2: SDASDA (5.0V)Connected to Outdoor Temp/Hum AM2315 Sensor - works better on 5.0V I2C Bus
SAP JP10/Pin 3: VDD5VDD5Connected to Outdoor Temp/Hum AM2315 Sensor - works better on 5.0V I2C Bus
SAP JP10/Pin 4: GNDGNDConnected to Outdoor Temp/Hum AM2315 Sensor - works better on 5.0V I2C Bus
JP13
SAP JP13/Pin 1: EXTSCLI2CMux JP3/Pin 4: SC1
SAP JP13/Pin 2: EXTSDAI2CMux JP3/Pin 5: SD1
SAP JP13/Pin 3: VDDSPA JP23/Pin2: VDD55V I2C Interface from SAP
SAP JP13/Pin 4: GNDI2CMux JP3/Pin 3: GNDGND form I2CMux Board
SAP JP13/Pin 8: EXTGP0PiA+ GPIO/Pin 22: GPIO 25Line from Raspberry Pi to flash SAP Yellow LED on GP0
JP23
SAP JP23/Pin 2: VDD5SAP JP13/Pin 3: VDD5.0V for SAP I2C Bus to I2CMux
SAP JP23/Pin 3: VDD5 I2CM JP3/Pin 2: VD15.0V for I2CMux I2C Bus1

Step 15: Results!

Picture of Results!

The WeatherPi has been outside for about 2 weeks now. Working perfectly. You can see the box being charged up and then going to battery power as the sun moves behind the house. We have had hot days and cold nights as we are just starting to move out of Spring into Summer. It is not quite generating enough electricity to run 24 hours at the moment (because it is in the shade until 9am and after about 3pm - not quite 8 hours of sun). This will be fixed when we move it up to the top of the house where it will have sun about 12 hours a day on average (when the sun is not behind clouds!).

What is Left To Do (as of May 10, 2015)?

We have the following issues to address:

We are working three small issues.

1) The plug for the WeatherRack Weather Sensors need to be better secured to the outside of the box. Right now it is just attached and sealed by silicon caulking. Too easily broken with small amounts of pressure. We have Gland Connector pressure cable pass throughs that we can use for this.

2) The cheap RT5370 Wireless Adapter WiFi dongle we are using is shutting itself down occasionally. The Raspberry Pi keeps running, collecting data, etc., but we are locked out of the system. When we look at the WiFi adaptor when it has shut itself down, it is no longer blinking blue, but the Raspberry Pi and all the external hardware is still running. Looking at the web shows some people having had similar problems with this dongle. We have now replaced it with a WiPi USB Dongle which works well. Interestingly enough, the WiPi USB dongle reports it is using the RT5370 also, but the WiPi works.

3) Humidity is too high inside of the box. We are going to add small vent hole at the bottom of the box to correct for this. Don't want that condensing humidity.

Improvements

We aren't building graphs for the Wind Speed, Direction and Rain yet. Just reporting the current values on the RasPiConnect control panel. All the data is being saved into MySQL, however.

The temperature and lightning displays need to be fixed and improved.

The cool thing is that all of this can be done remotely!

Step 16: What Else Can You Do With This?

Picture of What Else Can You Do With This?

Here are some additional ideas for projects based on WeatherPi:

  • Replacing the WiFi with a GSM data connection (or just send text messages)
  • Make it tweet the weather!
  • Make a custom Facebook posting with your weather
  • Adding a GPS receiver and store that data. You now have a mobile weather station! When it gets back to WiFi all the stored data will be available.
  • Adding additional air quality sensors, UV sensors, Dust sensors. You have a lot of I2C addressing space that you can fill
  • Connect to the WeatherUnderground or similar services

Step 17: Conclusion

Picture of Conclusion

WeatherPi is a flexible WiFi connect solar powered Weather Station architecture. It is designed to be a reliable data gathering system that can be placed outdoors in a remote location for an extended amount of time. It is not designed for extreme environments such as extremely cold locations, but it will work in most places for an extended period of time.

Tinker with the design! Change it! Modify it! Let us know what you are doing with WeatherPi!

Comments

SwitchDocLabs (author)2016-03-30

WeatherPi makes it through the winter! Check out new posting on www.switchdoc.com

SDL

SwitchDocLabs (author)2016-02-06

We have updated this instructable correcting some Typos and updated the parts list and parts list to a new I2C Mux.

Best Building!

SDL

rokhead22 (author)2015-10-26

If I were to add a wind turbine as supplemental power source like the one you described, would it plug directly into a Solar Charge Controller like your SunAirPlus?

SwitchDocLabs (author)rokhead222015-10-26

The answer is Yes and No. Yes, you can use SunAirPlus to charge your batteries with a wind turbine, but you need to do some power conditioning. We have actually done this. Check out this posting on our website:

http://www.switchdoc.com/2014/12/using-sunair-wind-power-control/

This should help a bunch!

SwitchDoc Labs

SwitchDocLabs (author)2015-07-22

Addition on July 22, 2015: The structure of the WeatherPi MySQL database in mysqldump format is located on github https://github.com/switchdoclabs/WeatherPiSQL. You can use this file to build the MySQL database for the WeatherPi Project.

bbpi (author)2017-02-01

where can I find pre grove instructions ?

SwitchDocLabs (author)bbpi2017-02-01

There are two sections in:

https://www.instructables.com/id/Create-Your-Own-So...

These two sections list the obsolete parts list and wiring diagrams.

Best,

SDL

clamonti (author)2016-08-08

I've started on this project, and followed the wiring instructions. I'm running the testSDL_Pi_TCA9545.py to see if the i2c mux board is wired correctly, but everytime i plug the DS3231 RTC into the weatherPiArduino weather board, the python test program fails at line 58 (tca9545.write_control_register(TCA9545_CONFIG_BUS0)). Do I need to insert a pull up register for the 32k line, or something else? or is the DS3231 or WeatherPiArduino board faulty?

Any advise would be appreciated. Thanks in advance.

clamonti (author)clamonti2016-08-09

Update : I've unplugged the DS3231 from the WPA, and commented out the code in WeatherPi.py. The AM2315, HTU21DF and Wind speed sensors seem to be returning realistic results, but the BMP180 is returning 82.7c (raw temp is 91) and a pressure of -4385 kpa. I don't have the ADS1015 plugged in, nor the DS3231 - could these cause the strange results or does something need to be changed in the BMP085.py code? Does it have something to do with the DS3231 causing error (see my initial post)?

Help!

SwitchDocLabs (author)clamonti2016-08-09

Strange. We are about to release a new version of the WEatherPi software, but it is for the new Grove based weather station which has a different I2C mapping so it won't be too good.

However, the new WeatherBoard software (this is the new WeatherPiArduino board) will detect all the devices and tell you what is not working which is handy.

Download the software and give it a try and see what happens with this software. This should help us figure out what is going on.

https://github.com/switchdoclabs/SDL_Pi_WeatherBoa...

I believe that you must have a new version of the WPA board with a BMP280 on the board, which is probably what the problem is with the Barometer.

Regarding the DS3231, I don't know. Can you run a test program just on the DS3231?

SDL

clamonti (author)SwitchDocLabs2016-08-15

Thanks. It indeed was the BMP280 sensor and the new code did the trick. I'm still having problems with the DS3231 though, but I think the SCL pin is causing the error : once it's plugged in, it causes the TCA9545 write control register function to fail. Is there another way to test it?

Also, I recently received the ADS1015 ADC for the wind vane, and I've plugged it in, as well as shorting ADDR and GND to use 0x48 as the address. However, the I2C Mux board test code doesn't seem to detect it (it's -- instead of 48). Is it dependent on the DS3231 being plugged in, or do I need to connect something from JP8?

Thanks for the advice!

gestionsfa (author)2016-07-21

Hi !

Could you tell me if i still need those parts , if a bought Mux breakout board ?

  • Adafruit 32KB FRAM I2C breakout board
  • Adafruit ADS1015 4 Channel A/D I2C board

Thanks !

Ontario IT (author)2016-07-21

Hello,

Having trouble trying to connect to the IC2. We are running the test TCA9545 and it errors out on line 52 (IOErrors: [Errno110] Connection timed out) - which is trying to write to the Mux board. Any ideas? We are stuck!

Ontario IT (author)2016-07-21

Hello,

Having trouble trying to connect to the IC2. We are running the test TCA9545 and it errors out on line 52 (IOError: [Errno 110] Connection timed out) - which is trying to write to the Mux board. Any ideas? We are stuck!

kd7eir (author)2016-07-06

If not individual openscad files, then can you provide stl files?

kd7eir (author)2016-07-06

Any chance of getting individual openscad files? As they are now it's just one big file with all the parts.

jrm964 (author)2016-05-16

Hello, Having an issue getting the graphs to appear in the RasPiConnect App. Checked the timestamps on the .png files in the RasPiConnectServer/static folder and all appear to be updating normally. Even opened the png files on my desktop and look fine. Not sure if this is a WeatherPi issue or a RasPiConnect Server issue? I see most other readings. The BR-1 bargraph doesn't appear to work either. I get green lights on all the panels when I validate.

camrex (author)jrm9642016-05-16

I ended up going a different route with displaying the data. Instead of RasPiConnect I set up weewx, which gives allot of flexibility. PM me if you are interested in what needs to be done to set it up.

jrm964 (author)2016-04-29

I Seem to be having trouble getting the AM2315 outdoor temp/humidity sensor working. I believe I downloaded to correct drivers.

https://github.com/lexruee/am2315.git

Getting the following error when running testAM2315.py

pi@raspberrypi:~/WeatherPi-master $ sudo ./testAM2315.py
./testAM2315.py: 1: ./testAM2315.py: import: not found
from: can't read /var/mail/tentacle_pi.AM2315
./testAM2315.py: 3: ./testAM2315.py: Syntax error: "(" unexpected

Get the following when running the test.py

pi@raspberrypi:~/WeatherPi-master/am2315-master/examples $ sudo python test.py
temperature: 0.0
humidity: 0.0
crc_ok: False

I have it wired to my sunairplus JP10 correctly. Not sure what else I'm missing. All other sensors work fine.

camrex (author)jrm9642016-05-03

You need to make sure you have run the following:

sudo apt-get install python-pip libi2c-dev
sudo pip install tentacle_pi

The AM2315 library used is from tentacle_pi

The AM2315 is a bit finicky. From what I can tell it doesn't follow i2c standards, but the tentacle_pi python library works pretty well.

jrm964 (author)camrex2016-05-09

Thanks. That got me a bit further. I don't get any errors anymore but now I see 0 values on both temp and humidity. The AM2315 works if I connect it directly to the pi. But get 0's when hooked up through the SDL on JP10. All other sensors work fine. I can actually run wetherPi server and RasPiConnect server and get values on my iPad accept the outdoor temp/humidity.

temperature: 0.0
humidity: 0.0
crc_ok: -1

SwitchDocLabs (author)jrm9642016-05-09

Glad you have made such good progress!

Can you read the INA3221 on SunAirPlus? What I2C Channel is the INA3221 on (Assuming you are using the Mux)? Are you setting the I2C channel before you read the AM2315? That what it sounds like the problem is.

Also, make sure you have wired up the AM2315. Sometimes the colors are not the same, although they should agree with the yellow tag on the AM2315 cable.

Best,

SDL

jrm964 (author)SwitchDocLabs2016-05-10

I can read the INA3221 just fine. And yes using a mux. How do you set the channel before the read? The wiring is good.

WeatherRack Weather Sensors Sampling
-----------------
Rain Total= 0.00 in
Wind Speed= 0.00 MPH
MPH wind_gust= 0.00 MPH
Wind Direction= 225.00 Degrees
Wind Direction Voltage= 2.055 V
-----------------
-----------------
DS3231 Real Time Clock
-----------------
Raspberry Pi= 2016-05-10 07:55:56
DS3231= 2016-05-10 07:55:55
DS3231 Temperature= 22.50 C
-----------------
-----------------
BMP180 Barometer/Temp/Altitude
-----------------
Temperature = 22.40 C
Pressure = 102.00 KPa
Altitude = -64.16 m
Sealevel Pressure = 102.09 KPa
-----------------
-----------------
HTU21DF Humidity and Temperature
-----------------
Temperature = 22.70 C
Humidity = 31.40 %
-----------------
-----------------
AS3853 Lightning Detector
-----------------
Last result from AS3953:
----No Lightning detected---
Lightning Count = 0
-----------------
-----------------
AM2315
-----------------

outsideTemperature: 0.0 C
outsideHumidity: 0.0 %
crc: -1
-----------------
-----------------
-----------------
SunAirPlus Currents / Voltage
-----------------
LIPO_Battery Bus Voltage: 4.15 V
LIPO_Battery Shunt Voltage: 10.76 mV
LIPO_Battery Load Voltage: 4.16 V
LIPO_Battery Current 1: 107.60 mA
Battery Power 1: 0.45 W

Solar Cell Bus Voltage 2: 4.69 V
Solar Cell Shunt Voltage 2: -12.64 mV
Solar Cell Load Voltage 2: 4.68 V
Solar Cell Current 2: 126.40 mA
Solar Cell Power 2: 0.59 W

Output Bus Voltage 3: 4.94 V
Output Shunt Voltage 3: 18.04 mV
Output Load Voltage 3: 4.94 V
Output Current 3: 180.40 mA
Output Power 3: 0.89 W

camrex (author)jrm9642016-05-10

Here is the code within the WeatherPi.py script that changes the Mux's (TCA9545) I2C Bus:

tca9545.write_control_register(TCA9545_CONFIG_BUS1)

The above assumes that the AM2315 is attached to BUS 1, if you followed the instructable, it would be attached to the SunAirPlus which would be connected to Bus 1 of the Mux.

Now, there is a much easier way to use the TCA9545, which no longer requires calling the above code to switch between the I2C buses of the Mux.

In RaspberryPi Kernel 4.4 we can add a Device Tree Overlay for the TCA9545 that adds access to the TCA9545 from the kernel.

To get kernel 4.4 you may or may not require running (it might be the current version):

sudo BRANCH=next rpi-update

So what would adding the overlay do?

It will allow you to access the mutiplexed I2C address via the raspberry pi's I2C interface. Currently, if you look within your /dev directory on your RPi you will see i2c-1, but no other i2c devices (even with the TCA9545 connected). When you add the Device Tree Overlay for the TCA9545 you will see (in my case), not only i2c-1, but also i2c-3, i2c-4, i2c-5 and i2c-6 (I do not know why i2c-2 was skipped, but it was). This then allows you to use i2cdetect -y [bus] to see the devices on each i2c bus. It also gets rid of the need to use the:

tca9545.write_control_register(TCA9545_CONFIG_BUS1)

to access the i2c buses of the mux. This is huge as far as I'm concerned. The only thing you will need to do is define the bus your device is connected to when you initialize the device.

So here is what you need to do to get the Device Tree Overlay working for the TCA9545:

1) Make sure you are on Raspberry Pi Kernel 4.4 (may require sudo BRANCH=next rpi-update).

2) Add the device tree overlay file for the TCA9545a to the /boot/overlays directory (I will post a link to the i2c-mux-pca9545a.dtbo file that I created).

3) Add the following line to you /boot/config.txt file:

dtoverlay=i2c-mux-pca9545a,addr=0x73

4) Reboot your RaspberryPi

You should now see multiple i2c devices in your /dev directory, where i2c-1 is your raspberry pi's i2c bus, and the additional i2c devices are your mux where the first (after i2c-1) is Bus 0 on the mux, etc.

camrex (author)camrex2016-05-10

Here is a link to the .dtbo file.

The .dtbo and .dtb files are compiled versions of the .dts file. The .dtbo should be the only required file.

https://github.com/camrex/i2c-mux-pca9545a

I plan on submitting a pull request to the RPi Kernel for this, so it will be included in the Kernel distribution.

jrm964 (author)camrex2016-05-10

Thanks again for the help. I updated the kernel to 4.4 and applied the changes you mentioned. I'm now seeing the overlays. Getting a UU instead of 0x73. Also,still not clear on the changes I need to make in the WeatherPi.py file.

pi@raspberrypi:~ $ sudo i2cdetect -y 0
Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directo ry
pi@raspberrypi:~ $ 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: -- -- -- UU -- -- -- --
pi@raspberrypi:~ $ sudo i2cdetect -y 2
Error: Could not open file `/dev/i2c-2' or `/dev/i2c/2': No such file or directo ry
pi@raspberrypi:~ $ sudo i2cdetect -y 3
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: -- -- -- UU -- -- -- 77
pi@raspberrypi:~ $ sudo i2cdetect -y 4
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: -- -- -- UU -- -- -- --
pi@raspberrypi:~ $ sudo i2cdetect -y 5
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- UU -- -- -- --
pi@raspberrypi:~ $ sudo i2cdetect -y 6
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- UU -- -- -- --

y 0x73 address is now UU.

camrex (author)jrm9642016-05-10

The UU in 0x73 on i2c-1 is expected, as that denotes that the i2c address is in use, which it is, as it is the MUX. It is used across all Buses.

NOTE: In the below directions I have the AS3935 connected to MUX Bus 2, it appears you have it connected to MUX Bus 0, so adjust as necessary.

jrm964 (author)camrex2016-05-11

This is strange. I get wind speed and rain gauge readings but no wind direction. Sometimes I get wind direction on the first pass and nothing on the rest. Also I'm sending the AM2315 back to SwtchDocs for testing. I tried it on my other Raspberry Pi and still get 0 values and no 0x5c on the i2cdetect.

camrex (author)jrm9642016-05-11

I have experienced the same problem. But I thought it was connected to other changes I made to the SDL_Pi_Weather_80422.py file, as I altered it to use the updated Adafruit ADS_1x15 library.

I've been needing to get in and figure the Wind Direction problem out, so I'll do some work on it now. From some initial testing I've done, I do get an analog output from the Wind vane, but the translation to Wind Direction is not calculating correctly.

I'll write a quick python script that will record the analog output, the calculated voltage, and the Wind Direction Value and write it to a file, which can be run while manually positioning the wind vane. Once I have it done, I'll post if you'd like to use it to test.

jrm964 (author)camrex2016-05-11

That would be great, thank you.

camrex (author)jrm9642016-05-11

I believe I found the solution to the Wind Vane problem. I'm not sure why this problem had popped up, whether a change in the hardware or what, but try changing two lines in SDL_Pi_Weather_80422/SDL_Pi_Weather_80422.py

LINES 191 & 207:
ORIGINAL: voltageValue = value/1000
TO: voltageValue = value / 1000 * 3

One thing I have not been able to quite figure out is, what is the purpose of _currentWindDirection? It is always 0.0. There is no code that updates that value, and from what I can tell that should be the previous Wind Direction value. Maybe I'm missing something though.

Let me know if the above fix works for you. It worked for me in my test code, and I am going to merge it into my modified code. If you are still having problems I'll post the test python script.

camrex (author)camrex2016-05-11

The other option is to change:

ADJUST3OR5 = 0.66

to

ADJUST3OR5 = 0.22

jrm964 (author)camrex2016-05-12

Thanks, I'll make those changes and give it try. It looks like the defaultWindDirection is a set value of 0.0 If you look at the logic under def voltageToDegrees(value, defaultWindDirection) where the variable is passed, , the logic runs though a series of 'if' statements, If none are true it returns the defaultWindDirection which is 0.0 Instead of using a variable I suppose you could simply return 0.0 as in the first 'if' statement of that function.

camrex (author)jrm9642016-05-10

In WeatherPi.py (Line numbers assume unchanged WeatherPi.py from Github)

Remove the following:
sys.path.append('./SDL_Pi_TCA9545')
import SDL_Pi_TCA9545
[LINES 59-85] --All of the TCA9545 initialization stuff
[Any line starting with] tca9545.write_control_register -- See lines:
85, 106, 147, 149, 166, 178, 180, 203, 228, 236, 413, 451, 464, 509, 598, 868
You can also remove the comment line above each... # turn I2CBus 1 on

Now here are the additions (or line changes) that need to be made:

Line 90:
ORIGINAL: ina3221 =SDL_Pi_INA3221.SDL_Pi_INA3221(addr=0x40)

CHANGE TO: ina3221 = SDL_Pi_INA3221.SDL_Pi_INA3221(twi=4, addr=0x40)

Line 133:
ORIGINAL: ds3231 =SDL_DS3231.SDL_DS3231(1, 0x68, 0x57)
CHANGE TO: ds3231 = SDL_DS3231.SDL_DS3231(3, 0x68, 0x57)

Line 152:
ORIGINAL: as3935 = RPi_AS3935(address=0x03, bus=1)
CHANGE TO: as3935 = RPi_AS3935(address=0x03, bus=5)

Line 230:
ORIGINAL: am2315 = AM2315(0x5c,"/dev/i2c-1")
CHANGE TO: am2315 = AM2315(0x5c,"/dev/i2c-4")

Line 238:
ORIGINAL: #fram = SDL_Pi_FRAM.SDL_Pi_FRAM(addr = 0x50)
CHANGE TO: #fram = SDL_Pi_FRAM.SDL_Pi_FRAM(addr = 0x50, twi=3)

In SDL_Pi_Weather_80422/SDL_Pi_Weather_80422.py:

Line 179:
ORIGINAL: self.ads1015 = ADS1x15(ic=ADS1015, address=0x48)
CHANGE TO: self.ads1015 = ADS1x15(ic=ADS1015, address=0x48, busnum=3)

This should be all the necessary changes. If you have any problems let me know.

camrex (author)camrex2016-05-10

The above changes assume the following:
MUX Bus 0 = i2c-3
MUX Bus 1 = i2c-4
MUX Bus 2 = i2c-5
MUX Bus 3 = i2c-6

If your bus numbering is different as shown in /dev then adjust the numbering in the above line changes (such as: twi=4, bus=5, /dev/i2c-4, etc...)

The above also assumes that the i2c hierarchy is as follows:

-i2c Mux
---BUS 0: WeatherPi
-----FRAM
-----DS3231
-----ADS1015
---BUS 1: SunAirPlus
-----ina3221
-----AM2315
---BUS 2: AS3935

jrm964 (author)camrex2016-05-10

Almost starts then I get the following:

WeatherPi Solar Powered Weather Station Version 1.9 - SwitchDoc Labs


Program Started at:2016-05-10 14:32:36

sendmail exception raised
----------------------------------------
----------------------------------------
Processing Command: SAMPLEBOTH
-----------------
Weather Sampling
-----------------
-----------------
SunAirPlus Sampling
-----------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
Processing Command: SAMPLEBOTH
-----------------
Weather Sampling
-----------------
Traceback (most recent call last):
File "WeatherPi.py", line 872, in <module>
processCommand()
File "WeatherPi.py", line 277, in processCommand
sampleWeather()
File "WeatherPi.py", line 421, in sampleWeather
bmp180Temperature = bmp180.read_temperature()
File "build/bdist.linux-armv7l/egg/Adafruit_BMP/BMP085.py", line 137, in read_ temperature
File "build/bdist.linux-armv7l/egg/Adafruit_BMP/BMP085.py", line 111, in read_ raw_temp
File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 109, in write8
IOError: [Errno 5] Input/output error

Here is my i2cdetects:

pi@raspberrypi:~/WeatherPi-master $ 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: -- -- -- UU -- -- -- --
pi@raspberrypi:~/WeatherPi-master $ sudo i2cdetect -y 3
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: -- -- -- UU -- -- -- 77
pi@raspberrypi:~/WeatherPi-master $ sudo i2cdetect -y 4
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: -- -- -- UU -- -- -- --
pi@raspberrypi:~/WeatherPi-master $ sudo i2cdetect -y 5
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- UU -- -- -- --
pi@raspberrypi:~/WeatherPi-master $ sudo i2cdetect -y 6
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- UU -- -- -- --
pi@raspberrypi:~/WeatherPi-master $

My MUX board layout:

-i2c Mux
---BUS 0: WeatherPi
-----FRAM
-----DS3231
-----ADS1015
-----AS3935
---BUS 1: SunAirPlus
-----ina3221
-----AM2315
---BUS 2: Nothing
---BUS 4: GND wire to WDT board

My AS3935 Lightning Detector is on the WeatherPi board and should be on the same BUS as the WeatherPi.

camrex (author)jrm9642016-05-10

Try changing the following line (Line 91):
bmp180 =BMP180.BMP085()

TO: bmp180 =BMP180.BMP085(busnum=3)

jrm964 (author)camrex2016-05-10

Thanks, that got me through the errors. I do see samplings coming through now but the Wind Direction is zero and outdoor Temp/humidity is still zero

camrex (author)jrm9642016-05-10

For the Wind Direction issue.

I want to confirm that you are using the Adafruit ADS1x15 library that was included in the SDL_Pi_Weather_80422 github repository and not the updated Adafruit library. This will determine how we approach the problem.

jrm964 (author)camrex2016-05-11

I'm using the library that was included in the SDL_Pi_Weather_80422. It seems to work fine when I run SDL_Pi_Weather_80422Test.py but not when I ./startserver under WeattherPiSolarPoweredWeather. Must be a setting in the WeatherPi.py. Still troubleshooting the AS2315. I can't seem to get it to work wired up directly to the Pi now. May be a sensor.

camrex (author)jrm9642016-05-10

Lets try to tackle the AM2315 issue first.

Edit Line 3 of the testAM2315.py file to:

am = AM2315(0x5c,"/dev/i2c-4")

And then try running it to see if you get any output.

If you still get 0, then check your wiring. Refer to the yellow tag on the AM2315 to make sure you have the SCL/SDA wires correct. (The difference here with the AM2315 is that it is using 5V logic. I need to check my wiring at home to make any further recommendations. I will check when I get home in a few hours.)

SwitchDocLabs (author)camrex2016-05-10

This is a great addition. I'll include this in the next instructable.Do you mind if wedo a posting on this on our blog?

SDL

camrex (author)SwitchDocLabs2016-05-10

Feel free.

SwitchDocLabs (author)jrm9642016-05-10

To learn how to switch between I2C Channels, take a look at the example program supplied with the TCA9545.

tca9545.write_control_register(TCA9545_CONFIG_BUS1)

Best,

SDL

SwitchDocLabs (author)2016-05-10

All right! Looking good. Graphs soon?

idaknow (author)2016-04-10

SDL, you have been a lot of help. Thank You.

It usually helps to run the right program....

I had to copy the SDL_Pi_INA3221, SDL_Pi_TCA9545 and SDL_Pi_Weather_80422 contents found in github to their respective directories in WeatherPi. there are no files inside those directories in the Github WeatherPi.

(Is that correct?) it seemed to move me along.

anyway now when I run WeatherPi.py i get the following:

pi@raspberrypi:~/WeatherPiSolarPoweredWeather $ python WeatherPi.py
Traceback (most recent call last):
File "WeatherPi.py", line 154, in <module>
as3935.set_indoors(False)
File "/usr/local/lib/python2.7/dist-packages/RPi_AS3935/RPi_AS3935.py", line 156, in set_indoors
self.read_data()
File "/usr/local/lib/python2.7/dist-packages/RPi_AS3935/RPi_AS3935.py", line 228, in read_data
self.registers = self.i2cbus.read_i2c_block_data(self.address, 0x00)
IOError: [Errno 5] Input/output error

Any suggestions,

camrex (author)idaknow2016-04-19

Do you have the AS3935 connected through the I2C Mux or the WeatherPiArduino board?

From what I can tell in the github code, the code is set up to have it connect through the I2C Mux and not to the WPA board.

I am currently working on building this project and am working through the code now, so I will report back if I run into the same problem.

idaknow made it! (author)camrex2016-04-19

A week or 2 so ago I was looking back at old comments and seen somebody had changed the address on the ads1015 to 49 as its default or off the shelf condition is 48. I did this because the I2C list in the Instructables manual shows it to be 49 on BUS 0 but it should be 48.

I have WeatherPi up and running everything is working or at least data is being put into the mysql database. Yeah...

but having a problem with the weatherpi.py code on checking the WLAN its says there is no connection and keeps rebooting the pi. I run headless on this pi so I know the lan is connected just fine. Ignorant on coding so trying to figure it out.

Next is building some kinda web page so I can look at my data as I dont have any Apple products to use the App.

To answer your question I am going through the mux. If I can help I will try.

Thanks

camrex (author)idaknow2016-04-19

Be sure to set the ip address in the WLAN_check function to the ip address of your router. It is hard coded to 192.168.1.1, which may be different for you.

idaknow (author)camrex2016-04-20

That didn't help. Did change it to 192.168.0.1 (my router)

I can ping the router with no errors. Looking at the mysql systemlog it resets the lan 4 to 6 times then reboots pi, then starts all over again.

About This Instructable

88,105views

700favorites

License:

Bio: SwitchDoc Labs, LLC is a software and hardware engineering company producing specialized products and designs for the small computer industry maker movement (Raspberry Pi, Arduinos ... More »
More by SwitchDocLabs:GroveWeatherPi - Solar Raspberry Pi Based Weather Station - No Soldering Required (Updated October 24, 2016)Build a Solar Powered ESP8266Using XML on the Raspberry Pi with Python
Add instructable to: