loading

In this Instructable you will learn:

  1. How to a connect a Lightning Detector to a Solar Powered Weather Station
  2. How to design and position the lightning detector for best perfomance
  3. How to gather data to see the Lightning story as it happens
  4. How to wire up a the lightning detector to an I2C Mux and a Raspberry Pi
  5. Building 3D Printed Parts for the pylon to hold the Lightning Detector
  6. Examine the Python software for running the Lightning Detector on a Raspberry Pi

Recently, we published an Instructable detailing how to build a solar powered Raspberry Pi weather station, WeatherPi.

Updated: February 6, 2016: Changed to new I2C Mux Board. Grove 4 Channel I2C Mux Board.

What is Weather Pi?

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

Enter the Lightning

This Instructable will show you how to add an Embedded Adventures MOD-1016 AS3935 Lightning Detector Breakout Board to the Solar Powered Raspberry Pi Weather Station.

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

What is the AS3935 and How Does It Work?

The Austrian Microsystems AS3935 is a programmable Lightning Sensor IC that detects the presence and approach of potentially hazardous lightning activity in the vicinity and provides an estimation on the distance to the head of the storm. The embedded lightning algorithm checks the incoming signal pattern to reject the potential man-made disturbers and various noise sources.

The AS3935 can also provide information on the noise level and inform the Raspberry Pi of high noise conditions.

Step 1: Connect the Lightning Detector to WeatherPi

The complete Instructable for building WeatherPi, a solar powered Raspberry Pi based Weather Station, including the parts list and full wiring list is here.

Since we left our other MOD-1016 AS3935 breakout board on the WeatherPiArduino board for the time being, we decided to add an additional MOD-1016 AS3935.

Since the MOD-1016 has a fixed I2C address (0x03), we couldn't connect it up to the same I2C bus as the WeatherPiArduino board is on. So, using the I2C Multiplexer board, we put the second MO-1016 on bus 2.

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 0x03, and you are just out of luck in running both of them on the same I2C bus without a lot of jimmy rigging.

4 Channel Multiplexed I2C Breakout Board

To get around this addressing problem (specifically the conflict between an INA3221 and the Inside Humidity Sensor as well as having two identical lightning sensors - see below) 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. Below is our current list of I2C devices in WeatherPi.

ModuleAddressI2C Mux Bus #
BMP180 Barometric Pressure0x77Bus 0
Real Time Clock DS32310x68Bus 0
ATC EEPROM0x56 (or 0x57)Bus 0
ADS1015 Analog to Digital Converter0x49Bus 0
FRAM non-volatile storage0x50Bus 0
ADS1015 on SunAirPlus0x48Bus 1
INA3221 3 Channel Voltage/Current Monitor on SunAirPlus0x40Bus 1
Embedded Adventures Lightning Detector0x03Bus 0
Embedded Adventures Lightning Detector0x03Bus 2
AM2315 Outdoor Temp/Humidity0x5CBus 1
Grove I2C 4 Channel I2C Bus Mux0x73On All Busses
HTU21D-F Humidity Sensor0x40Bus 0

Note that a number of devices have the same address. This is fixed by using the Grove I2C Mux Breakout Board.

Wiring List

These are just the additions to the wiring list for the AS3935 Breakout Board connected to Bus2 of the I2C Mux and placed in the 3D Printed Pylon. The full wiring list for WeatherPi is in the Instructable.

Grove I2C Mux Board (GI2CM)
JP5 - I2C Bus2External AS3935 Breakout Board (ASBB)
GI2CM JP5/Pin 3: VDU2

3.3V From Pi/Screw Connector

3.3V From Pi/Screw Connector

GI2CM JP5/Pin 2: GNDASBB: GNDGND for ASBB Board
GI2CM JP5/Pin 5: SC2ASBB: SCLSCL for ASBB Board
GI2CM JP5/Pin 4: SD2ASBB: SDASDA for ASBB Board

External AS3935 Breakout Board (ASBB)


External AS3935 Breakout Board (ASBB)

JP5 - I2C Bus2

ASBB: VCC

3.3V From Pi/Screw Connector

3.3V From Pi/Screw Connector

ASBB: GND

GI2CM JP5/Pin 2: GND

GND for ASBB Board
ASBB: SCL

GI2CM JP5/Pin 5: SC2

SCL for ASBB Board
ASBB: SDA

GI2CM JP5/Pin 4: SD2

SDA for ASBB Board
ASBB: IRQ

PiA+ GPIO/Pin 15: GPIO 22

IRQ Line to Raspberry Pi

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 uses Bus 0, Bus 1 and Bus 2.

Bus 2 is only used for connecting to the external MOD-1016 AS9535 Lightning detector. Running the test software for the I2C Mux Breakout Board gives the following results:

Test SDL_Pi_TCA9545 Version 1.0 - SwitchDoc Labs

Sample uses 0x73
Program Started at:2015-05-19 02:45:59

-----------BUS 0-------------------
addr = 0x73 returndata = 0x81 
tca9545 control register B3-B0 = 0x1
ignore Interrupts if INT3' - INT0' not connected
tca9545 control register Interrupts = 0x8
     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-------------------
addr = 0x73 returndata = 0xa2 
tca9545 control register B3-B0 = 0x2
ignore Interrupts if INT3' - INT0' not connected
tca9545 control register Interrupts = 0xa
     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-------------------
addr = 0x73 returndata = 0x84 
tca9545 control register B3-B0 = 0x4
ignore Interrupts if INT3' - INT0' not connected
tca9545 control register Interrupts = 0x8
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          03 -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- 73 -- -- -- --                         

-----------------------------------
<p>Updated February 6, 2016: Changed parts list and wiring diagrams to new Grove I2C 4 Channel Mux Board.</p><p>SDL</p>
<p>It would be great if we could use Adafruit&rsquo;s Weatherproof TTL Serial JPEG Camera with NTSC Video and IR LEDs.</p><p><a href="https://www.adafruit.com/products/613">https://www.adafruit.com/products/613</a></p>
i2cdetect -y 1 picks up the embedded adventures AS3935 board.<br><br>Either your board is bad or you have it hooked up wrong. I&rsquo;ve had very good luck with the Embedded Adventures board.<br><br>John<br>
<p>John..Ok. Well, I ordered the Embedded Adventures board. Assuming that it shows up with ic2detect, any hints on how to get the demo program running. Even with the (assumed) bad board, wouldn't it at least show some error messages if I started the program up?</p><p>Thanks, Steve</p>
<p>hello..I am trying to run the demo as3935 program I downloaded from the GitHub depository you referenced in the instructable. I am a noobe with Python, and I cannot figure out how to get the program running to see if my as3935 is even working. Any suggestions would be appreciated. Thanks, Steve</p>
Hi Steve,<br><br>First thing to do is connect things up and see if you even see the As3935 on your I2C bus. i2cdetect -y 1 will do it. If you see the AS3935 then you have that working!<br><br>Tell me the exact repository you downloaded it from (github.com/....) and I'll help you out.<br><br>John
Hi John, Thank you very much for offering to help me. Here is information that you may need; I have this AS3935 break-out board; http://playingwithfusion.com/productview.php?pdid=22&amp;catid=1001<br><br>i2cdetect -y 1 did not show the board, but according to this it may not show up: https://github.com/pcfens/RaspberryPi-AS3935 This is the same repository I downloaded from.<br><br>I first tried it on my RasPi 2, and when it was not detected there I switched to my &quot;test bed&quot; RasPi B+ with the same result. With the possibility that the board is bad and/or not compatible with the RasPi, I have ordered the same one you are using from Imbedded Adventures.<br><br>I am attempting to integrate it into my weather station which is online here: http://photokinetics.org/Weather/index.html<br><br>Your instructable is great, and while I won't be building the entire station as you have, I may look into a way to get the lightning sensor and possibly a cam outside.<br><br>Again, many thanks for any help you can give.
Interesting build! How water &quot;proof&quot; has your enclosure been? <br><br>I would worry about my electronics in storms. Hopefully yours is working well!<br><br>Have a great day! :-)
<p>The BUD enclosure is a good enclosure. Make sure you seal all the holes with silicon caulking into the enclosure. It would be good to seal the seams on the lightning pylon too. I've had BUD enclosures outside for up to a year with no problems.</p>
<p>I just finished up soldering up my new Blitzortung.org red sensor system and it has provisions to add the AS3935 for local lightning detection. I am looking to added it, but was wondering did you need the $230 development board to trouble shoot the software or for actual placement and function. The cost seems a little steep and just want to spend the $25 for the actual card. My next project is going to be your weatherpi. Can't wait, now I have to buy two AS3935.</p>
<p>Now that I understand the sensor much better, I would say it is not worth it to buy the $230 development board. I was writing an article about it and had no good way to test it, so I bought it. It is really steep! Now that I understand the sensor and how far away to mount the sensor from the electronics, I wouldn't buy it. I guess if I could have read my article before I bought it, I could have saved myself some money!</p>
Awesome!

About This Instructable

19,013views

148favorites

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: