loading

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


http://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

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.

<p>WeatherPi makes it through the winter! Check out new posting on <a href="http://www.switchdoc.com"> www.switchdoc.com</a></p><p>SDL</p>
<p>We have updated this instructable correcting some Typos and updated the parts list and parts list to a new I2C Mux.</p><p>Best Building!</p><p>SDL</p>
<p>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?</p>
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:<br><br>http://www.switchdoc.com/2014/12/using-sunair-wind-power-control/<br><br>This should help a bunch!<br><br>SwitchDoc Labs<br>
<p>Addition on July 22, 2015: The structure of the WeatherPi MySQL database in mysqldump format is located on github <a href="http://www.instructables.com/editInstructable/edit/%E2%80%8Bhttps://github.com/switchdoclabs/WeatherPiSQL" rel="nofollow">https://github.com/switchdoclabs/WeatherPiSQL</a>. You can use this file to build the MySQL database for the WeatherPi Project.</p>
<p>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?</p><p>Any advise would be appreciated. Thanks in advance.</p>
<p>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)? </p><p>Help!</p>
<p>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.</p><p>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.</p><p>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.</p><p><a href="https://github.com/switchdoclabs/SDL_Pi_WeatherBoard">https://github.com/switchdoclabs/SDL_Pi_WeatherBoa...</a></p><p>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. </p><p>Regarding the DS3231, I don't know. Can you run a test program just on the DS3231?</p><p>SDL</p>
<p>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?</p><p>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?</p><p>Thanks for the advice!</p>
<p>Hi !</p><p>Could you tell me if i still need those parts , if a bought Mux breakout board ?</p><ul><li>Adafruit 32KB FRAM I2C breakout board<li>Adafruit ADS1015 4 Channel A/D I2C board</ul><p>Thanks !</p>
<p>Hello,</p><p>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!</p>
<p>Hello,</p><p>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! </p>
<p>If not individual openscad files, then can you provide stl files?</p>
<p>Any chance of getting individual openscad files? As they are now it's just one big file with all the parts.</p>
<p>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.</p>
<p>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.</p>
<p>I Seem to be having trouble getting the AM2315 outdoor temp/humidity sensor working. I believe I downloaded to correct drivers. </p><p><a href="https://github.com/lexruee/am2315.git">https://github.com/lexruee/am2315.git</a></p><p>Getting the following error when running testAM2315.py</p><p><a href="mailto:pi@raspberrypi:~/WeatherPi-master">pi@raspberrypi:~/WeatherPi-master</a> $ sudo ./testAM2315.py<br>./testAM2315.py: 1: ./testAM2315.py: import: not found<br>from: can't read /var/mail/tentacle_pi.AM2315<br>./testAM2315.py: 3: ./testAM2315.py: Syntax error: &quot;(&quot; unexpected</p><p>Get the following when running the test.py</p><p><a href="mailto:pi@raspberrypi:~/WeatherPi-master/am2315-master/examples">pi@raspberrypi:~/WeatherPi-master/am2315-master/examples</a> $ sudo python test.py<br>temperature: 0.0<br>humidity: 0.0<br>crc_ok: False</p><p>I have it wired to my sunairplus JP10 correctly. Not sure what else I'm missing. All other sensors work fine.</p>
<p>You need to make sure you have run the following:</p><p>sudo apt-get install python-pip libi2c-dev<br>sudo pip install tentacle_pi</p><p>The AM2315 library used is from tentacle_pi</p><p>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.</p>
<p>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. </p><p>temperature: 0.0<br>humidity: 0.0<br>crc_ok: -1</p>
<p>Glad you have made such good progress! </p><p>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.</p><p>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.</p><p>Best,</p><p>SDL</p>
<p>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.</p><p> WeatherRack Weather Sensors Sampling<br>-----------------<br>Rain Total= 0.00 in<br>Wind Speed= 0.00 MPH<br>MPH wind_gust= 0.00 MPH<br>Wind Direction= 225.00 Degrees<br>Wind Direction Voltage= 2.055 V<br>-----------------<br>-----------------<br> DS3231 Real Time Clock<br>-----------------<br>Raspberry Pi= 2016-05-10 07:55:56<br>DS3231= 2016-05-10 07:55:55<br>DS3231 Temperature= 22.50 C<br>-----------------<br>-----------------<br> BMP180 Barometer/Temp/Altitude<br>-----------------<br>Temperature = 22.40 C<br>Pressure = 102.00 KPa<br>Altitude = -64.16 m<br>Sealevel Pressure = 102.09 KPa<br>-----------------<br>-----------------<br> HTU21DF Humidity and Temperature<br>-----------------<br>Temperature = 22.70 C<br>Humidity = 31.40 %<br>-----------------<br>-----------------<br> AS3853 Lightning Detector<br>-----------------<br>Last result from AS3953:<br>----No Lightning detected---<br>Lightning Count = 0<br>-----------------<br>-----------------<br>AM2315<br>-----------------</p><p>outsideTemperature: 0.0 C<br>outsideHumidity: 0.0 %<br>crc: -1<br>-----------------<br>-----------------<br>-----------------<br>SunAirPlus Currents / Voltage<br>-----------------<br>LIPO_Battery Bus Voltage: 4.15 V<br>LIPO_Battery Shunt Voltage: 10.76 mV<br>LIPO_Battery Load Voltage: 4.16 V<br>LIPO_Battery Current 1: 107.60 mA<br>Battery Power 1: 0.45 W</p><p>Solar Cell Bus Voltage 2: 4.69 V<br>Solar Cell Shunt Voltage 2: -12.64 mV<br>Solar Cell Load Voltage 2: 4.68 V<br>Solar Cell Current 2: 126.40 mA<br>Solar Cell Power 2: 0.59 W</p><p>Output Bus Voltage 3: 4.94 V<br>Output Shunt Voltage 3: 18.04 mV<br>Output Load Voltage 3: 4.94 V<br>Output Current 3: 180.40 mA<br>Output Power 3: 0.89 W</p>
<p>Here is the code within the WeatherPi.py script that changes the Mux's (TCA9545) I2C Bus:</p><p>tca9545.write_control_register(TCA9545_CONFIG_BUS1)</p><p>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.</p><p>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. </p><p>In RaspberryPi Kernel 4.4 we can add a Device Tree Overlay for the TCA9545 that adds access to the TCA9545 from the kernel.</p><p>To get kernel 4.4 you may or may not require running (it might be the current version):</p><p>sudo BRANCH=next rpi-update</p><p>So what would adding the overlay do?</p><p>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:</p><p>tca9545.write_control_register(TCA9545_CONFIG_BUS1)</p><p>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.</p><p>So here is what you need to do to get the Device Tree Overlay working for the TCA9545:</p><p>1) Make sure you are on Raspberry Pi Kernel 4.4 (may require sudo BRANCH=next rpi-update).</p><p>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).</p><p>3) Add the following line to you /boot/config.txt file:</p><p>dtoverlay=i2c-mux-pca9545a,addr=0x73</p><p>4) Reboot your RaspberryPi</p><p>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.</p>
<p>Here is a link to the .dtbo file.</p><p>The .dtbo and .dtb files are compiled versions of the .dts file. The .dtbo should be the only required file.</p><p><a href="https://github.com/camrex/i2c-mux-pca9545a">https://github.com/camrex/i2c-mux-pca9545a</a></p><p>I plan on submitting a pull request to the RPi Kernel for this, so it will be included in the Kernel distribution.</p>
<p>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.</p><p><a href="mailto:pi@raspberrypi">pi@raspberrypi</a>:~ $ sudo i2cdetect -y 0<br>Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directo ry<br><a href="mailto:pi@raspberrypi">pi@raspberrypi</a>:~ $ sudo i2cdetect -y 1<br> 0 1 2 3 4 5 6 7 8 9 a b c d e f<br>00: -- -- -- -- -- -- -- -- -- -- -- -- --<br>10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>70: -- -- -- UU -- -- -- --<br><a href="mailto:pi@raspberrypi">pi@raspberrypi</a>:~ $ sudo i2cdetect -y 2<br>Error: Could not open file `/dev/i2c-2' or `/dev/i2c/2': No such file or directo ry<br><a href="mailto:pi@raspberrypi">pi@raspberrypi</a>:~ $ sudo i2cdetect -y 3<br> 0 1 2 3 4 5 6 7 8 9 a b c d e f<br>00: 03 -- -- -- -- -- -- -- -- -- -- -- --<br>10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>40: 40 -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --<br>50: 50 -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --<br>60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --<br>70: -- -- -- UU -- -- -- 77<br><a href="mailto:pi@raspberrypi">pi@raspberrypi</a>:~ $ sudo i2cdetect -y 4<br> 0 1 2 3 4 5 6 7 8 9 a b c d e f<br>00: -- -- -- -- -- -- -- -- -- -- -- -- --<br>10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>40: 40 -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --<br>50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>70: -- -- -- UU -- -- -- --<br><a href="mailto:pi@raspberrypi">pi@raspberrypi</a>:~ $ sudo i2cdetect -y 5<br> 0 1 2 3 4 5 6 7 8 9 a b c d e f<br>00: -- -- -- -- -- -- -- -- -- -- -- -- --<br>10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>70: -- -- -- UU -- -- -- --<br><a href="mailto:pi@raspberrypi">pi@raspberrypi</a>:~ $ sudo i2cdetect -y 6<br> 0 1 2 3 4 5 6 7 8 9 a b c d e f<br>00: -- -- -- -- -- -- -- -- -- -- -- -- --<br>10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>70: -- -- -- UU -- -- -- --</p><p>y 0x73 address is now UU. </p>
<p>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.</p><p>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.</p>
<p>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. </p>
<p>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.</p><p>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. </p><p>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.</p>
<p>That would be great, thank you.</p>
<p>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</p><p>LINES 191 &amp; 207:<br>ORIGINAL: voltageValue = value/1000<br>TO: voltageValue = value / 1000 * 3</p><p>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.</p><p>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.</p>
<p>The other option is to change:</p><p>ADJUST3OR5 = 0.66</p><p>to</p><p>ADJUST3OR5 = 0.22</p>
<p>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.</p>
<p>In WeatherPi.py (Line numbers assume unchanged WeatherPi.py from Github)</p><p>Remove the following:<br>sys.path.append('./SDL_Pi_TCA9545')<br>import SDL_Pi_TCA9545<br>[LINES 59-85] --All of the TCA9545 initialization stuff<br>[Any line starting with] tca9545.write_control_register -- See lines:<br>85, 106, 147, 149, 166, 178, 180, 203, 228, 236, 413, 451, 464, 509, 598, 868<br>You can also remove the comment line above each... # turn I2CBus 1 on</p><p>Now here are the additions (or line changes) that need to be made:</p><p>Line 90: <br>ORIGINAL: ina3221 =SDL_Pi_INA3221.SDL_Pi_INA3221(addr=0x40)</p><p>CHANGE TO: ina3221 = SDL_Pi_INA3221.SDL_Pi_INA3221(twi=4, addr=0x40)</p><p>Line 133:<br>ORIGINAL: ds3231 =SDL_DS3231.SDL_DS3231(1, 0x68, 0x57)<br>CHANGE TO: ds3231 = SDL_DS3231.SDL_DS3231(3, 0x68, 0x57)</p><p>Line 152:<br>ORIGINAL: as3935 = RPi_AS3935(address=0x03, bus=1)<br>CHANGE TO: as3935 = RPi_AS3935(address=0x03, bus=5)</p><p>Line 230:<br>ORIGINAL: am2315 = AM2315(0x5c,&quot;/dev/i2c-1&quot;)<br>CHANGE TO: am2315 = AM2315(0x5c,&quot;/dev/i2c-4&quot;)</p><p>Line 238:<br>ORIGINAL: #fram = SDL_Pi_FRAM.SDL_Pi_FRAM(addr = 0x50)<br>CHANGE TO: #fram = SDL_Pi_FRAM.SDL_Pi_FRAM(addr = 0x50, twi=3)</p><p>In SDL_Pi_Weather_80422/SDL_Pi_Weather_80422.py:</p><p>Line 179:<br>ORIGINAL: self.ads1015 = ADS1x15(ic=ADS1015, address=0x48)<br>CHANGE TO: self.ads1015 = ADS1x15(ic=ADS1015, address=0x48, busnum=3)</p><p>This should be all the necessary changes. If you have any problems let me know.</p>
<p>The above changes assume the following:<br>MUX Bus 0 = i2c-3<br>MUX Bus 1 = i2c-4<br>MUX Bus 2 = i2c-5<br>MUX Bus 3 = i2c-6</p><p>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...)</p><p>The above also assumes that the i2c hierarchy is as follows:</p><p>-i2c Mux<br>---BUS 0: WeatherPi<br>-----FRAM<br>-----DS3231<br>-----ADS1015<br>---BUS 1: SunAirPlus<br>-----ina3221<br>-----AM2315<br>---BUS 2: AS3935<br></p>
<p>Almost starts then I get the following:</p><p>WeatherPi Solar Powered Weather Station Version 1.9 - SwitchDoc Labs</p><p><br>Program Started at:2016-05-10 14:32:36</p><p>sendmail exception raised<br>----------------------------------------<br>----------------------------------------<br>Processing Command: SAMPLEBOTH<br>-----------------<br> Weather Sampling<br>-----------------<br>-----------------<br> SunAirPlus Sampling<br>-----------------<br>----------------------------------------<br>----------------------------------------<br>----------------------------------------<br>----------------------------------------<br>Processing Command: SAMPLEBOTH<br>-----------------<br> Weather Sampling<br>-----------------<br>Traceback (most recent call last):<br> File &quot;WeatherPi.py&quot;, line 872, in &lt;module&gt;<br> processCommand()<br> File &quot;WeatherPi.py&quot;, line 277, in processCommand<br> sampleWeather()<br> File &quot;WeatherPi.py&quot;, line 421, in sampleWeather<br> bmp180Temperature = bmp180.read_temperature()<br> File &quot;build/bdist.linux-armv7l/egg/Adafruit_BMP/BMP085.py&quot;, line 137, in read_ temperature<br> File &quot;build/bdist.linux-armv7l/egg/Adafruit_BMP/BMP085.py&quot;, line 111, in read_ raw_temp<br> File &quot;build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py&quot;, line 109, in write8<br>IOError: [Errno 5] Input/output error</p><p>Here is my i2cdetects:</p><p><a href="mailto:pi@raspberrypi:~/WeatherPi-master">pi@raspberrypi:~/WeatherPi-master</a> $ sudo i2cdetect -y 1<br> 0 1 2 3 4 5 6 7 8 9 a b c d e f<br>00: -- -- -- -- -- -- -- -- -- -- -- -- --<br>10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>40: 40 -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --<br>50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>70: -- -- -- UU -- -- -- --<br><a href="mailto:pi@raspberrypi:~/WeatherPi-master">pi@raspberrypi:~/WeatherPi-master</a> $ sudo i2cdetect -y 3<br> 0 1 2 3 4 5 6 7 8 9 a b c d e f<br>00: 03 -- -- -- -- -- -- -- -- -- -- -- --<br>10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>40: 40 -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --<br>50: 50 -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --<br>60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --<br>70: -- -- -- UU -- -- -- 77<br><a href="mailto:pi@raspberrypi:~/WeatherPi-master">pi@raspberrypi:~/WeatherPi-master</a> $ sudo i2cdetect -y 4<br> 0 1 2 3 4 5 6 7 8 9 a b c d e f<br>00: -- -- -- -- -- -- -- -- -- -- -- -- --<br>10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>40: 40 -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --<br>50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>70: -- -- -- UU -- -- -- --<br><a href="mailto:pi@raspberrypi:~/WeatherPi-master">pi@raspberrypi:~/WeatherPi-master</a> $ sudo i2cdetect -y 5<br> 0 1 2 3 4 5 6 7 8 9 a b c d e f<br>00: -- -- -- -- -- -- -- -- -- -- -- -- --<br>10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>70: -- -- -- UU -- -- -- --<br><a href="mailto:pi@raspberrypi:~/WeatherPi-master">pi@raspberrypi:~/WeatherPi-master</a> $ sudo i2cdetect -y 6<br> 0 1 2 3 4 5 6 7 8 9 a b c d e f<br>00: -- -- -- -- -- -- -- -- -- -- -- -- --<br>10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br>70: -- -- -- UU -- -- -- --<br><a href="mailto:pi@raspberrypi:~/WeatherPi-master">pi@raspberrypi:~/WeatherPi-master</a> $</p><p>My MUX board layout:</p><p>-i2c Mux<br>---BUS 0: WeatherPi<br>-----FRAM<br>-----DS3231<br>-----ADS1015<br>-----AS3935<br>---BUS 1: SunAirPlus<br>-----ina3221<br>-----AM2315<br>---BUS 2: Nothing<br>---BUS 4: GND wire to WDT board</p><p>My AS3935 Lightning Detector is on the WeatherPi board and should be on the same BUS as the WeatherPi.</p>
<p>Try changing the following line (Line 91):<br>bmp180 =BMP180.BMP085()</p><p>TO: bmp180 =BMP180.BMP085(busnum=3)</p>
<p>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</p>
<p>For the Wind Direction issue.</p><p>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.</p>
<p>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.</p>
<p>Lets try to tackle the AM2315 issue first.</p><p>Edit Line 3 of the testAM2315.py file to:</p><p>am = AM2315(0x5c,&quot;/dev/i2c-4&quot;)</p><p>And then try running it to see if you get any output.</p><p>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.)</p>
<p>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?</p><p>SDL</p>
<p>Feel free.</p>
<p>To learn how to switch between I2C Channels, take a look at the example program supplied with the TCA9545.</p><p>tca9545.write_control_register(TCA9545_CONFIG_BUS1)</p><p>Best,</p><p>SDL</p>
<p>SDL, you have been a lot of help. Thank You.</p><p>It usually helps to run the right program....</p><p>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.</p><p>(Is that correct?) it seemed to move me along.</p><p>anyway now when I run WeatherPi.py i get the following:</p><p>pi@raspberrypi:~/WeatherPiSolarPoweredWeather $ python WeatherPi.py<br>Traceback (most recent call last):<br> File &quot;WeatherPi.py&quot;, line 154, in &lt;module&gt;<br> as3935.set_indoors(False)<br> File &quot;/usr/local/lib/python2.7/dist-packages/RPi_AS3935/RPi_AS3935.py&quot;, line 156, in set_indoors<br> self.read_data()<br> File &quot;/usr/local/lib/python2.7/dist-packages/RPi_AS3935/RPi_AS3935.py&quot;, line 228, in read_data<br> self.registers = self.i2cbus.read_i2c_block_data(self.address, 0x00)<br>IOError: [Errno 5] Input/output error</p><p>Any suggestions,</p>
<p>Do you have the AS3935 connected through the I2C Mux or the WeatherPiArduino board?</p><p>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.</p><p>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.</p>
<p>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. </p><p>I have WeatherPi up and running everything is working or at least data is being put into the mysql database. Yeah...</p><p>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.</p><p>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.</p><p>To answer your question I am going through the mux. If I can help I will try.</p><p>Thanks</p>
<p>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.</p>
<p>That didn't help. Did change it to 192.168.0.1 (my router)</p><p> 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.</p>
<p>Hmm...I've not quite gotten that far so can test it myself. I ran into your previous problem with the as3935 error, and tried the 48 to 49 address fix, but that didn't seem to fix it, and after trying to troubleshoot for a while, I commented out all of the as3935 code and that got me past that error. But ran into another error (Error accessing 0x48: Check your I2C address), followed by other errors. So I might recheck my wires and set it up exactly as described and reflash and install everything to start fresh.</p><p>BTW...Once I get the code and hardware working I plan on implementing weewx (http://weewx.com/) as the interface.</p>
<p>have you ran the testSDL_Pi_Tca9545.py to see all addresses and confirm they are as the &quot;manual&quot; indicates.. except &quot;I think BUS 0 49 should be 48&quot; it seemed to have fixed me seeing the Lightning detector cant confirm until I get some lightning. </p><p>I briefly looked into weewx perhaps I should revisit....Thanks.</p>
<p>idaknow,</p><p>When we were developing the prototype for this project, I bought the hideously expensive lightning generator ($240) from Austrian Micro Systems to test. It all worked.</p><p>We *did* notice while we were building it if we had the detector right next to a big monitor or my iPhone it would trigger occasionally. Cheaper than $240.</p><p>SDL</p>

About This Instructable

76,892views

670favorites

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 ESP8266 Using XML on the Raspberry Pi with Python 
Add instructable to: