Has anybody else noticed that the Arduino Mega pins 20/21 are exceedingly unreliable over long periods of time? It has been the case four times now where I have hooked up no more than 3 I2C devices to these pins and had them fail after approx. 10 days of light use on average.

For example, my team and I had 3 sensors hooked up and were successfully running tests for about two weeks, then right before our launch, I2C stopped working entirely, returning completely incorrect (all zero) data every time.

Again, I have had this issue four separate times in the past, some where pull-up resistors are present, others not.

I seem to be unable to find related information on the web.

Has anyone else noticed this?

closed as unclear what you're asking by gre_gor, per1234, Enric Blanco, Greenonline, SDsolar Jul 14 '17 at 11:17

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    If you mean a lasting failure, this may be indicative of electrical abuse. Are you running these to off-board sensors? I2C in its everyday form really isn't intended for that. What sort of environment and power situation are you operating in? And what do you mean by without pull-up resistors - those are absolutely required... – Chris Stratton Jul 12 '17 at 23:26
  • 1
    then right before our launch, I2C stopped working entirely, - have you changed absolutely nothing in that time (including code)? I find it exceedingly hard to believe that the I2C circuit "wears out". – Nick Gammon Jul 13 '17 at 7:28
  • 1
    Your question would be better by including the sensors part numbers, and your code and schematic. As it is, your question is really "some unidentified sensors, connected in a way we haven't disclosed, using code we haven't posted, fails after two weeks". – Nick Gammon Jul 13 '17 at 7:29
  • That's because it has a built-in "crisis detector" and you made the mistake of talking about your presentation where it could hear you. ;-) – SDsolar Jul 14 '17 at 2:16
  • Welcome to Arduino Stack Exchange. Please take the tour to see how to get the most out of this site: arduino.stackexchange.com/Tour - you will notice that it is best to show us what you have tried (photos, code, etc.) then post a specific question about where you have a problem. Then put your question in the title. – SDsolar Jul 14 '17 at 2:17

The I2C pins on the Arduino Mega 2560 board are 100% reliable, but you have to use them correctly.

The Wire library could halt when something is wrong with the hardware I2C bus. In that case the sketch stops. The Wire library should have timeouts programmed in case something is wrong with the hardware, but sadly it doesn't have timeouts.

The hardware I2C bus on the Arduino Mega 2560 board is a 5V I2C bus, because the Arduino Mega 2560 has 10k pullup resistors to 5V for SDA and SCL.
The wires for I2C can only be short. Long wires will not work.
The worst thing is when SDA and SCL are in a flat ribbon cable next to each other. The crosstalk between SDA and SCL will make the I2C very unreliable.
Because it is a 5V I2C bus, you may not connect 3.3V sensors to that 5V I2C bus. In that case you need a level converter.
The total value of all pullup resistors in parallel should not be too high (more sensitive for electrical noise, longer wires are not possible) and not be too low. The I2C specificiation is maximum 3 mA pulling of down current to get the signal low.
Everything that is connected to the I2C bus must have proper power supply. If one sensor has a power supply that fails, then that sensor will probably pull down the SCL and SDA signals.
A test with a breadboard might fail, due to bad contacts of the breadboard.

The Arduino Wire library is often used in a wrong way.
If one of the sensors is an Arduino board as a I2C slave, then the code for the slave must be done right, because there are many ways to do it wrong.
You could check the return value of every Wire.endTransmissions for an error, and check every return value of Wire.requestFrom for the amount of data that is received.

If you tell us everything about the sensors, the wires (with photos), the logic level converters, the sketch, and so on, then we can tell you what the problem is.

Not the answer you're looking for? Browse other questions tagged or ask your own question.