Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, an initiative of Stroud Water Research Center designed to help people advance knowledge and stewardship of fresh water.
New to EnviroDIY? Start here

Reply To: Mayfly v1.1 technical questions forum thread

Home Forums Mayfly Data Logger Mayfly v1.1 technical questions forum thread Reply To: Mayfly v1.1 technical questions forum thread

Shannon Hicks

    The ADC example I linked above from Sparkfun applies only to the onboard 10-bit ADC of the ATmega1284 processor.  For the ADS1115 auxiliary ADC on the Mayfly board, the formula on the Sparkfun page does not apply, because the ADS1115 is a dedicated ADC chip and works differently.  The operational specs of the chip are outlined in the TI datasheet (found here), and specifically page 17 talks about the resolution of the readings at different gain settings.  The default gain of the ADS1115 is two-thirds (also listed as 6.144v FSR), so therefore the LSB (least significant bit) as shown in Table 3 is 187.5 uV, or 0.1875 mV.

    You can also see a breakdown of the sensitivity of the chip at different gain settings in the beginning of most example sketches for the ADS1x15.  Like here:  https://github.com/adafruit/Adafruit_ADS1X15/blob/master/examples/singleended/singleended.ino

    Note that there are 2 popular varieties of the ADS1x15 chip that Adafruit sells, so their example sketches usually are written for one or the other, but usually mention both and it’s up to the user to edit the code to use the correct version.  ADS1015 is the 12-bit (not on the Mayfly), and ADS1115 is the 16-bit (what’s on the Mayfly).  So in that Adafruit example on Github above, to work on a Mayfly you’d need to change the example code to comment out line 4, and un-comment line 3, so that the code uses the correct settings for the ADS1115.  The comments in line 20-25 show the table for the different gain settings that’s the same table as shown in the TI datasheet.  The default gain setting for the ADS1115 is the two-thirds gain, so we usually just use that as-is.  If for some reason a user needed better resolution than 0.1875mV, they could adjust their code to use a different gain setting, but we’ve found for most purposes, the default gain is sufficient and using a different gain setting just introduces more noise into the measurement unless certain precautions are taken.  Usually just taking multiple readings in close succession at the default gain setting and then averaging them will be adequate.