Will this code work with the board sold by Embedded Adventures? Same chip.
Don't think it has all the same outputs..
and can I use an arduino uno instead of the Mega?
Neither do I have a board sold by EA, nor I have Uno, but I have reports of library working with Uno no problems.
While claims of EA that they have each board "pre-tuned" make me doubt their level of competence, after all, tuning depends on temperature (even with C0G capacitors in tank circuit) and bunch of other conditions and should be redone once those conditions change, besides, library takes care of that and there is nothing tricky there.
Our lightning sensors, along with many of our other weather related modules are being used by people around the world to find out more about the world around them.
We have provided open source C software to communicate with the sensor, including deciding on the tuning values, but provide the tuning parameters we found when testing as a service to our customers.
We pride ourselves on making awesome products that people love and we are always open to feedback. Feel free to drop us a line at feedback at embeddedadventures dot com or post up here if you have specific questions. Happy to help.
Hello Ravis.I use the library of AS3935 but when I compile the following appears
'AS3935' does not name a type to
LightningDetector: 48: error: 'AS3935' does not name a type
LightningDetector.pde: In function 'void setup ()':
LightningDetector: 64: error: 'AS3935' was not declared in this scope
LightningDetector.pde: In function 'void loop ()':
LightningDetector: 102: error: 'AS3935' was not declared in this scope
LightningDetector.pde: In function 'void printAS3935Registers ()':
LightningDetector: 130: error: 'AS3935' was not declared in this scope
can you help me?
I had been wondering about the performance to that lightning detection chip.
I do lightning research in my spare time and I currently use an AM radio for discharge detection. It would be interesting to see if your solution gives better performance.
Have you verified the sensitivity of the color sensor? How good is its spectral purity?
All I can say, it does indeed detect lightnings I have no idea how good it is at it though.
Regarding color sensor, I havent seen it in flesh, wrote library solely based on datasheet and then debuged it remotely on a laptop located in US that had arduino and sensor attached.
Hello to all,
I am learning something new everyday, but I have no idea how to change the "Noisefloor" in the AS3935 lightning detector. Could someone please give me a kick in the right direction since I am fairly new to all of this?
If you are using my library, then there is function for that:
int AS3935::setNoiseFloor(int noisefloor)
Thank you for the reply. I have tried using your suggest before I wrote my question. I am not sure how to use it for sure. As I stated I am learning and very new to this all. I have a couple more ideas to try. Hands-on is the best way for me to learn and to keep trying ideas to find a solution. If you could give me a hint on how to use the code.
Well, there is example included with library. Other than working with specific chip, this library follows generic arduino programming paradigm.
Thank you for the library.
Of course it compiles and such but it (the example code) complains that the tuning is out of range.
Tried it with an arduino uno and a pro mini. Also tried 3,3V instead of 5V.
The bestdiff value it finds during calibrate is 3125.
Let me guess, you have Embedded Adventures breakout?
Indeed I do.
They require anything special?
I have two of them in fact and both fail. Both in i2c and spi.
I get a lot of support requests because of those breakouts and I have no idea if that is because they are only ones left who make them or if that is because those guys do something wrong, like use not so high quality caps in tank circuit. Since they seem to refer people to me for support, I kindly asked them to send me one of their modules, but got no reply whatsoever.
Anyway, a few days ago I wrote instructions on how to connect to UNO R3, untested, because I neither have Uno, nor breakout by Embedded Adventures:
Open example sketch and comment out the line
and uncomment line
at the end of setup() function.
If you still get that dreaded tuning error, make sure your wires are short and module is away from EMI sources (especially ones that are susceptible to be around 500kHz) during tuning. After tuning sample sketch prints some register values, if all of those are zeros then most likely there is something wrong with SPI comms.
My library does not support I2C, but there is a fork on github that is modified for that - https://github.com/SloMusti/AS3935-Arduino-Library
If you like I can buy you one?
If so, please contact me at firstname.lastname@example.org
In the mean time I'll give your suggestion a try tonight.
Note that I also attached such a device to a raspberry pi. It communicates with the rpi but does not detect any lightnings. Well unless none did strike in the last 10 days, that's also possible I guess.
Thanks, but no thanks I could buy one myself if I wanted, but I don't, too much of different stuff piling up and gathering dust as it is, besides, I wrote the library as a courtesy to my friend Jayson of TAUTIC Electronics, who made first breakouts of this chip and I had never had real interest in detecting lightnings.
Downloaded the library, and made the "adjustments'' to the code to operate with UNO. I connected the sensor to my UNO, and was stuck at "Noise floor" message, with a clearly non responsive sensor. Changed noise Floor settings from 0-7, but still no go (also followed other suggestions you made). Ordered 4 Tautic boards, (arrived yesterday), noise floor message still appears - but the sensor responds to disrupters (such as every time I operate my barbeque lighter) thus I would expect lightning to trigger the sensor! It's a very nice and easy to use library you have written - I almost feel lazy, as it makes using the sensor "too easy". I live in far north Queensland, and storm season is imminent. Will roll out 4 sensors in various locations, and process the information via the internet, and my Arduino Mega GSM project. Thanks again for a great library, and clear instructions to get started. I will post updates on my project when completed, and after some storms have been detected. My expectations are realistic, I do not expect to detect every strike - but to simply have the sensor detect the storm, and give some guidance of strike numbers and distance.
Thanks for the kind words and good luck with your project
Using UNO R3 + Embedded Adventures under I2C interface
Try the following connections:
EA - UNO R3
Vcc - 5 VDC
GND - GND
SCL -> A5 (analog PIN)
SDA -> A4 (analog PIN)
IRQ - 2 (digital pin)
That is according the information from I2C library: for UNO R3 SDA (data line) is on analog input pin 4, and SCL (clock line) is on analog input pin 5.(https://github.com/rambo/I2C)
Check your EA board version. If you have the hardware v4 release the I2C address must be changed in the code to 0x03 (Embedded Adventures - Products - MOD-1016 AS3935 Lightning and Storm Sensor Module).
After run the code I obtained the following result:
regW 3 C0 0 read 1 write 1 err 0
regW 8 80 1 read 0 write 80 err 0
regW 8 F 0 read 80 write 80 err 0
regW 8 F 1 read 80 write 81 err 0
regW 8 F 2 read 81 write 82 err 0
regW 8 F 3 read 82 write 83 err 0
regW 8 F 4 read 83 write 84 err 0
regW 8 F 5 read 84 write 85 err 0
regW 8 F 6 read 85 write 86 err 0
regW 8 F 7 read 86 write 87 err 0
regW 8 F 8 read 87 write 88 err 0
regW 8 F 9 read 88 write 89 err 0
regW 8 F A read 89 write 8A err 0
regW 8 F B read 8A write 8B err 0
regW 8 F C read 8B write 8C err 0
regW 8 F D read 8C write 8D err 0
regW 8 F E read 8D write 8E err 0
regW 8 F F read 8E write 8F err 0
regW 8 F 2 read 8F write 82 err 0
regW 8 80 0 read 82 write 2 err 0
regW 0 3E 12 read 24 write 24 err 0
regW 3 20 0 read 0 write 0 err 0
Noise floor is: 2
Spike rejection is: 2
Watchdog threshold is: 2
Noise level too high, try adjusting noise floor
Same problem here.
I cannot change the noise level on the AS3935.
I am not an expert and I cannot figure how to make it with the code provided.
If you use breakout made by Embedded Adventures, I can not help since I ado not have any sample boards by them, besides, my version of driver supports only SPI and not I2C.
If your using the Embedded Adventures board it works fine. You have to use SPI or mod the code for I2C. Embedded Adventures tells you how to set the board up. Some things you should know about the AS3935. The noise level is going to depend on your surroundings. So dont stay connected using your USB port and serial monitor. Use LEDS for the outputs: Noise, disturbers, and lightning strikes. I have mine powered by a battery, even the demo board from AWS is battery powered. When using SPI dont use pin 13 for an LED.
AS3935.setNoiseFloor(2) is an example of how to set the noise floor to 2. You can use the values from 1 to 7. If your all the way up to 7, you have a noisy surrounding and it will never detect lightning.
Let me know if I can provide any other help,
Embedded Adventure MOD-1016 V6
Sparkfun Arduino Pro v14
Noise Floor is 2
Spike Rejection is 2
Watchdog Threshold is 4
Minimum lighting is 1
embeddedadventures replied to my e-mail and promised to send me one of their lightning breakouts, so hopefully I will be able to answer Embedded Adventures AS3935 breakout related questions better. I might add i2c support into library as well.
Unfortunately I do not have AS3935 breakout that would work over I2C, so I can not help. Bear in mind that AS3935 does not work correctly when I2C address is set to 0 - http://fll-freak.com/blog/?p=581
That artical describes an issue reading register 0, not address 0 and may be missleading as the two are not related., the only info I can find on any bug is documented by Skye Sweeney and only him. while using I2C address 0 is not recomended, if it is the only device on the bus it is not an issue either
The I2C specification would never set constraints on a specefic register of a device, only on how you talk to the device. Some devices may not even have a register as such
Also you do actually need a pull up on BOTH i2C pins, not just one, anything from 1K - 10K will do in a short wired system
Firmware update with a breakout board is detailed in this PDF but this is the PIC firmware, not the AS3935 chip
I found solution.
I use AS3935 and eth shield with SPI interface, but when i must read from AS3935 i must set SPI_MODE1, instead of SPI_MODE0.
Now all seem to work, but how i can test AS3935, and my setup is correct ?
Noiser Floor = 2
Spike Rejection = 2
Watchdog Treshold = 7
Someone has optimized configuration ?
simply change a chip select line of one of the attached devices and adjust the code to initialize the device to use the new pin ?
Yes. I used pin 9 for as3935 cs, pin 10 is set default for eth.
but u need a trick. Before read or write to as3935 set spi_mode1 and after change to spi_mode0.
To see my project at work go to http://meteo.ispica.org
No tricks, the SPI library supports this directly using
"SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0))"
putting in your settings of course
See https://www.arduino.cc/en/Reference/SPISettings for details
Nice project, I will keep an eye on it for pending lightning
1 of 1 people found this helpful
Tnk u Peter.
if anyone needs the code can ask.
I need code interfacing As3935 with arduino uno using SPI
Hello Peter today in my town there is a bad time with lot of lightining, but my AS3935 does not detect anything.
Arduino Leonardo is powered by POE, with a switch of Nilox, and is apparently working. In fact, the detection of the temperature and humidity, as well as sending to the web server function. BUT AS3935 NO !
So I decided to feed the board with a battery and stabilize the voltage to 7V. Magic, I found lots of lightning. But now another problem arose, taking the reference network http://www.blitzortung.org/ distances detected does not correspond example, if my AS3935 says 30km in effect is at least 60,
if it say up to 8 km it is at least 30, and if it say 1km, instead the lightining is 10 / 15km far.
May depend on what?
Which pin will be output in AS3935
A bit of a shameless self-promotion I wrote two libraries for two interesting sensor chips, first is AS3935 lightning detector chip, that can warn you about coming storm while it is still 40 kilometers away and the second in high dinamic range 16bit resolution color and light sensor chip TCS34717. Both libraries in my opinion are interesting in the way communications are implemented, library code does not access any other library, like SPI or Wire, directly, but rather relies on user sketch to provide functions to communicate over SPI or i2c bus, which makes them usable with almost any imaginable setup and scenario.
Both libraries can be downloaded from my github - https://github.com/raivisr?tab=repositories
And break-outs if anyone is interested in these, can be purchased here - https://www.tindie.com/shops/TAUTIC