Hi all,
I'm using the very simple sampling sequence below, which runs once per hour. The ADS1115 is sampling a 4-20mA component over a 250Ohm resistor, and moves the cursor of the LCD as a simple animation. When the ADS reading is within the 4mA and 20mA bounds, we speed up the reading (readyToReadCount += 10;), otherwise it progresses at a regular pace (readyToReadCount += 1;).
I have 9 PCBs running this sketch. After ~1 month, one of them froze with the cursor ~ halfway through the screen. I replaced the PCB and have had no problems since. I then added 3 more PCBs. 2 have been working fine for a month. The other froze after 2 days. I reset it, and it froze again after two days.
I'm wondering what you all think about this. I initially though I may have an issue with i2c communication, but it looks fine on the scope. It's a bit of a challenging problem to recreate given the rarity of occurrence.
Thanks for any advice!
Links:
ADS1115 Datasheet
LCD Datasheet
Serial.println(F("READING SENSOR------------"));
avgReading = 0.0;
readyToReadCount = 0;
while (readyToReadCount < 80)
{
avgReading = 0.0;
for (int i=0; i<5; i++)
{
adc0 = ads.readADC_SingleEnded(0);
avgReading += adc0/5.0;
delay(10);
}
delay(150);
lcd_set_cursor((readyToReadCount/4),3);
if(avgReading > 23544.0 || avgReading < 4000.0)
{
readyToReadCount += 1;
} else {
readyToReadCount += 10;
}
}
avgReading = 0.0;
for (int z=0; z<50; z++)
{
adc0 = ads.readADC_SingleEnded(0);
Serial.println(adc0);
avgReading += adc0/50.0;
delay(10);
}