pcfens / RaspberryPi-AS3935

A basic library for working with the AS3935 that's connected to the Raspberry Pi.
Other
52 stars 24 forks source link

Input/output error #22

Open wvanbreukelen opened 8 years ago

wvanbreukelen commented 8 years ago

Hi there,

I was testing out my sensor with your library, but I ran into an issue. When I try to simulate lightning using a lighter, I mostly gave the following error:

Traceback (most recent call last): File "lightning_web.py", line 38, in register_strike reason = sensor.get_interrupt() File "/usr/local/lib/python2.7/dist-packages/RPi_AS3935/RPi_AS3935.py", line 48, in get_interrupt self.read_data() File "/usr/local/lib/python2.7/dist-packages/RPi_AS3935/RPi_AS3935.py", line 228, in read_data self.registers = self.i2cbus.read_i2c_block_data(self.address, 0x00) IOError: [Errno 5] Input/output error

I thought of some fixes by myself, like changing 0x00 to 0x03 (i am using the Embedding Systems V8 version), but I doubt this would fix the issue.

Can you think of any solution to solve this problem?

pcfens commented 8 years ago

The 0x00 there is which register is being read off of the sensor, not the sensor address (Raspberry Pi's were having some trouble with repeated starts when I wrote this library and I haven't revisited it).

Does everything before simulating lightning work? Does this always fail when you simulate lightning or just intermittently?

wvanbreukelen commented 8 years ago

It does it intermittently. When no IOError is thrown, it shows up as an disturber. It might be the same issue as https://github.com/pcfens/RaspberryPi-AS3935/issues/1

pcfens commented 8 years ago

That wouldn't surprise me. I've also found a thread on the RPi forums that addresses a similar issue - maybe that helps?

pcfens commented 8 years ago

Hi @wvanbreukelen - Did you have any success fixing this? If you did, I'd like to close this issue. Thanks!

sesykes71 commented 8 years ago

Phil,

I am late to this thread but I seem to have the same problem that @wvanbreukelen has. I am using a piezo effect lighter to simulate the lightning. As you can see it detects what it thinks is lightning sometimes. i2cdetect, always detects the board so I don't understand the Errno 5 which I think suggests that it doesn't see the module. Any suggestions? I have two Pi's, a 2 and a 3, they both act the same.

Regards, Steve

Waiting for lightning - or at least something that looks like it Noise level too high - adjusting We sensed lightning! It was 1km away. (01:00:15 - 2016/08/30)

Traceback (most recent call last): File "RaspberryPi-AS3935/demo.py", line 23, in handle_interrupt reason = sensor.get_interrupt() File "/home/pi/RaspberryPi-AS3935/RPi_AS3935/RPi_AS3935.py", line 48, in get_interrupt self.read_data() File "/home/pi/RaspberryPi-AS3935/RPi_AS3935/RPi_AS3935.py", line 234, in read_data self.registers = self.i2cbus.read_i2c_block_data(self.address, 0x00) IOError: [Errno 5] Input/output error Traceback (most recent call last): File "RaspberryPi-AS3935/demo.py", line 23, in handle_interrupt reason = sensor.get_interrupt() File "/home/pi/RaspberryPi-AS3935/RPi_AS3935/RPi_AS3935.py", line 48, in get_interrupt self.read_data() File "/home/pi/RaspberryPi-AS3935/RPi_AS3935/RPi_AS3935.py", line 234, in read_data self.registers = self.i2cbus.read_i2c_block_data(self.address, 0x00) IOError: [Errno 5] Input/output error

dlitchfield commented 7 years ago

Hi,

I'm getting a similar error to the others above. When simulating using a piezo lighter, about half the time I get lightning detected and the other half the same error message as wvanbreukelen and sesykes71.

Would really appreciate some help!

pcfens commented 7 years ago

Does there appear to be any pattern associated with issue? I haven't been able to cause the error to pop back up.

Just brainstorming, but is your Pi connected directly to the sensor? Are there other devices on the I2C bus? Is there more than 12 inches of wire separating the sensor and Pi (some I2C devices can't drive longer distances of wire)?

dlitchfield commented 7 years ago

Hi, Thanks for coming back to me. No there doesn't seem to be any pattern. Since I last played with this, I now only get at best a single disturber message and then only the error message.

As for your specific suggestions - the Pi is connected via a breadboard to the sensor with no other devices on the I2C bus. There is less than 12" of wire.

Embedded Adventures sent a replacement sensor but the same error is occurring. I have also tried it on a second Pi 3, with an identical error.

jrleeman commented 7 years ago

Wondering if this is pathological timing of interference on the communication from the spark? Catching it with a try/except to retry communication could work?

ggggson commented 5 years ago

there,

I was testing out my sensor with your library, but I ran into an issue. When I try to simulate lightning using a lighter, I mostly gave the following error:

Traceback (most recent call last): File "lightning_web.py", line 38, in register_strike reason = sensor.get_interrupt() File "/usr/local/lib/python2.7/dist-packages/RPi_AS3935/RPi_AS3935.py", line 48, in get_interrupt self.read_data() File "/usr/local/lib/python2.7/dist-packages/RPi_AS3935/RPi_AS3935.py", line 228, in read_data self.registers = self.i2cbus.read_i2c_block_data(self.address, 0x00) IOError: [Errno 5] Input/output error

I thought of some fixes by myself, like changing 0x00 to 0x03 (i am using the Embedding Systems V8 version), but I doubt this would fix the issue.

Can you think of any solution to solve this problem?

I have the same reason ,I find my pi cannot connect to as3935.I make a i2c to connect wo as3935,but when i used "i2cdectect -y 1" ,I could get nothing .could you give me some message ,thank you. my e-mail:346236337@qq.com