trombik / AS3935-ESP-I2C

AS3935 I2C library for ESP8266
5 stars 4 forks source link

Not sure this is working correctly #11

Open mischmerz opened 4 years ago

mischmerz commented 4 years ago

Howdy - I am plenty confused. And - as we didn't had a thunderstorm yet, I can't really tell if my thing process works correctly.

I am setting the parameters as;:

Serial.print("Setindoor:"); Serial.println(as3935.setIndoor()); Serial.print("SetMinimum:"); Serial.println(as3935.setMinimumLightning(1)); Serial.print("SetCapacitor:"); Serial.println(as3935.setTuningCapacitor(7)); // 53pf / 8 Serial.print("SetNoiseFloor:"); Serial.println(as3935.setNoiseFloor(2)); // From 0 - 7

and in loop() I check the status of the interrupt pin every 200ms :

if (!analogRead(interruptPin)) { s_nothing++; return(0); } reason = as3935.getIntrruptReason();

I am using the interrupt i/o as a register, the interrupt is NOT attached within the sketch (e.g. as in attachInterrupt(digitalPinToInterrupt(D5),test,'RISING')) ..

All I get is Disturbers or Noise. Never got any false (or any) strikes, As I said, no thunderstorms around for the last 3 weeks. What concerns me a bit is that I tried other libraries (Sparkfun) and it did have a number of wrong strike warnings.

So - all I am asking is that I'd like to know if the way I coded around your library is correct?

Thanks

Michaela

trombik commented 4 years ago

sorry for the confusion. if you are in doubt, you better choose one of other libraries. after writing this, I wrote another one in C, with some fixes. Tested it on a ESP8266, but I would not recommend it either because the library has not been tested in rainy season. calibration is also tricky to perform. here is the URL just for reference: https://github.com/trombik/TRB_AS3935

mischmerz commented 4 years ago

It's me who should apologize. Thank you for your work. I agree, those sensors need a lot of tuning and fiddling. I adapted the SparkFun library for my needs and I realized that timing is extremely important - e.g. if you read the interrupt register directly after reading HIGH on the interrupt pin, the whole sensor stops delivering data. I also have problems with clearing the statistics cache as this also seems to confusing the sensor. I am now waiting for another thunderstorm to verify my current application.

trombik commented 4 years ago

the chip is slightly expensive just for fun, but i like it. hope i have enough time in the next rainy season. if you make progress, i would love to contribute.