# AS3935 Lightning sensor

**URL:** <https://community.particle.io/t/as3935-lightning-sensor/2049>\
**Category:** Project Share\
**Created:** [January 14, 2014, 1:40am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049 "2014-01-14T01:40:20Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![redland](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@redland](https://community.particle.io/u/redland)\
**Post date:** [January 14, 2014, 1:40am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/1 "2014-01-14T01:40:20Z")

</div>

Hello. Has anyone tried to use the AS3935 with the spark core?

[http://www.designspark.com/blog/detecting-lightning-with-an-arduino](http://www.designspark.com/blog/detecting-lightning-with-an-arduino)

---

<div class="post-metadata">

**Author:** ![neal\_tommy](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/neal_tommy/32/1169_2.png) [@neal\_tommy](https://community.particle.io/u/neal_tommy)\
**Post date:** [April 23, 2014, 7:26pm UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/2 "2014-04-23T19:26:52Z")

</div>

Redland. I have just got myself the AS3935 Breakout Board and will be trying to hook it up to the SparkCore. I’ve downloaded the example Arduino code and have emailed the designers of the board / code (let’s see what they say).

Otherwise I trust someone else is also heading down a similar path?

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [April 23, 2014, 8:27pm UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/3 "2014-04-23T20:27:29Z")

</div>

> [@neal\_tommy](#):
>
> AS3935 Breakout Board

Looks cool! It looks like it's just a SPI device, so connecting it should be totally do-able I would think. I was considering grabbing a geo-phone to do a wifi seismic sensor, but this might be a more fun project in the meantime. Where did you pick one of these up from?

Thanks!  
David

---

<div class="post-metadata">

**Author:** ![bko](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bko/32/20704_2.png) [@bko](https://community.particle.io/u/bko)\
**Post date:** [April 23, 2014, 8:42pm UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/4 "2014-04-23T20:42:03Z")

</div>

One of the comments mentioned this source

> **[AS3935 Lightning Sensor Board by Tautic Electronics Llc on Tindie](https://www.tindie.com/products/TAUTIC/as3935-lightning-sensor-board/)**
>
> This new board is a breakout / development board for the AMS AS3935 Franklin Lightning Sensor.

$35.99 + $2.75 to ship.

It looks very interesting!

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [April 23, 2014, 9:18pm UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/5 "2014-04-23T21:18:32Z")

</div>

The code looks good and just requires a few minor tweaks. I can do the port but someone else will have to test it 😄

---

<div class="post-metadata">

**Author:** ![redland](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@redland](https://community.particle.io/u/redland)\
**Post date:** [April 23, 2014, 10:25pm UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/6 "2014-04-23T22:25:10Z")

</div>

Hello Guys, Thank you for the reply. I bought one of those from [tindie.com](http://tindie.com) and It works fine with arduino. I made it to send lightning reports to a php page using a RN-XV wifly radio. but it would be more fun of course with the spark. I haven’t try it with the core because don’t know from where to start. Im not that good in programing )-; Please keep me post it on any update?  
Thank you all.

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [April 24, 2014, 12:12am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/7 "2014-04-24T00:12:40Z")

</div>

I have adapted the Arduino library for the Spark core [**here on my github**](https://github.com/pkourany/AS3935-Spark-Library). I compiles on the web IDE. All that is needed is for someone to test it. 🙂

---

<div class="post-metadata">

**Author:** ![redland](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@redland](https://community.particle.io/u/redland)\
**Post date:** [April 24, 2014, 1:24am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/8 "2014-04-24T01:24:02Z")

</div>

Hello peekay. I would love to try it. But I don’t know where to start. Where do I upload those files to?  
can you provide me step by step on how to do it? (I’m OK about wiring the AS3935.)  
Sorry for this stupid question?  
Thank You

---

<div class="post-metadata">

**Author:** ![redland](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@redland](https://community.particle.io/u/redland)\
**Post date:** [April 24, 2014, 1:39am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/9 "2014-04-24T01:39:28Z")

</div>

I think I got it. I’ll keep you posted.

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [April 24, 2014, 1:40am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/10 "2014-04-24T01:40:25Z")

</div>

redland, assuming you are using the web IDE, create a new “app” and name it “LightningDetector.ino” which is the name of the example program provided (in the example folder). Then create a new file “pair” using the add file button on the RHS of the build window. Name the file AS3595 and the IDE will supply the .cpp and .h extensions automatically. On github, copy and paste the code from the AS3595 files to the corresponding AS3595 files in the IDE (each is a tab). Don’t forget to save.

Finally, delete all the stuff in the LightningDetector.ino file tab and copy and paste the content from the github file of the same name (the example). Again, hit the save button. If all goes well, you can hit the verify button and you should have no errors. You can now send the code over the air to the core of your choice.

---

<div class="post-metadata">

**Author:** ![redland](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@redland](https://community.particle.io/u/redland)\
**Post date:** [April 24, 2014, 2:54am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/11 "2014-04-24T02:54:38Z")

</div>

I flashed the core and it took it fine. It seems to work. But now how can I see it?  
Thank You,

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [April 24, 2014, 2:57am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/12 "2014-04-24T02:57:48Z")

</div>

redland, you need to open a terminal window with the correct serial port selected. I am on Win 8 so I use Putty for that. Does that help you?

---

<div class="post-metadata">

**Author:** ![redland](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@redland](https://community.particle.io/u/redland)\
**Post date:** [April 24, 2014, 3:31am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/13 "2014-04-24T03:31:55Z")

</div>

peekay, It WORKS!! Yay… It needs to be fine-tuned. But it works… I had to disable the: AS3935.enableDisturbers(); to make the detector work.  
 ![](https://community.particle.io/uploads/particle/1177/9ca19696c6f7f21d.png)

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [April 24, 2014, 3:36am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/14 "2014-04-24T03:36:46Z")

</div>

redland, great news! It’s obvious that it does not like Disturbers() to be enabled (huh!). 😮

---

<div class="post-metadata">

**Author:** ![redland](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@redland](https://community.particle.io/u/redland)\
**Post date:** [April 24, 2014, 3:45am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/15 "2014-04-24T03:45:35Z")

</div>

To test it. I use the Lightning Emulator.

---

<div class="post-metadata">

**Author:** ![bko](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bko/32/20704_2.png) [@bko](https://community.particle.io/u/bko)\
**Post date:** [April 24, 2014, 4:09am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/16 "2014-04-24T04:09:21Z")

</div>

Thank goodness it was an emulated storm! I was worried for a minute there.

Some of the buyers comments on Tindie make me think it is a bit fiddly to get set up right.

---

<div class="post-metadata">

**Author:** ![neal\_tommy](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/neal_tommy/32/1169_2.png) [@neal\_tommy](https://community.particle.io/u/neal_tommy)\
**Post date:** [April 24, 2014, 5:49am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/17 "2014-04-24T05:49:01Z")

</div>

Excellent news peekay123, I’ll also be giving it a try on my Sparkcore. Thanks for the porting! I got mine from tindie; just arrived yesterday.

---

<div class="post-metadata">

**Author:** ![neal\_tommy](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/neal_tommy/32/1169_2.png) [@neal\_tommy](https://community.particle.io/u/neal_tommy)\
**Post date:** [April 24, 2014, 7:25am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/18 "2014-04-24T07:25:47Z")

</div>

Redland. Do you have to disable the AS3935.enableDisturbers() in all three files or just the LightningDetector.ino?

I’ve got the following error when I tried to compile it (even though I’ve followed peekay123’s instructions step by step):

AS3595.cpp:22:20: fatal error: AS3935.h: No such file or directory  
compilation terminated.  
make: \*\*\* [AS3595.o] Error 1

---

<div class="post-metadata">

**Author:** ![neal\_tommy](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/neal_tommy/32/1169_2.png) [@neal\_tommy](https://community.particle.io/u/neal_tommy)\
**Post date:** [April 24, 2014, 7:30am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/19 "2014-04-24T07:30:43Z")

</div>

Sorry, worked it out… I had mixed up the AS3935 and AS3595…!

---

<div class="post-metadata">

**Author:** ![redland](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@redland](https://community.particle.io/u/redland)\
**Post date:** [April 24, 2014, 11:47am UTC](https://community.particle.io/t/as3935-lightning-sensor/2049/20 "2014-04-24T11:47:32Z")

</div>

neal\_tommy. Only in the LightningDtector.ino . Also I had to add AS3935.reset(); under two if statements. because if you don’t have it lets say you got a lightning at 10 kilometer and you get another one at 12 kilometer it shows the closest one (10) . Also if you get a Storm overhead, watch out! and the next one is 6 kilometers away still get the Storm overhead, watch out!. So for me by adding that, it fixed. I don’t know if that would be the right way to fixed it, but it worked. (-:

Thank You peekay​123 for helping us out!!!

[Next page](https://community.particle.io/t/as3935-lightning-sensor/2049.md?page=2)
