Home › Forums › Mayfly Data Logger › Mayfly 16 bit ADC errors › Reply To: Mayfly 16 bit ADC errors
Finally got back to this project…
The 6AA battery pack is wired to the “Ext 4-12V” solder pads. The voltage divider consists of a 989K resistor soldered to the battery positive lead, connected to a 324K resistor, which is connected to Pin 20 (GND). The connection between the two resistors is connected to both Pins 2 and 7. I attached a schematic. When the 6AA pack is unplugged, Pins 2 and 7 are directly connected to each other, and connected to ground through the 324K resistor.
I commented out the multipliers so as to print the ADC counts directly. Output with battery pack disconnected:
17:31:05.868 -> Single-ended external battery voltage from AIN0 and A0
17:31:07.885 -> A0: 0.000 AIN0: 222.000
17:31:08.918 -> A0: 0.000 AIN0: 226.000
17:31:09.943 -> A0: 0.000 AIN0: 240.000
17:31:10.919 -> A0: 0.000 AIN0: 239.000
17:31:11.960 -> A0: 0.000 AIN0: 225.000
17:31:12.954 -> A0: 0.000 AIN0: 223.000
17:31:13.986 -> A0: 0.000 AIN0: 237.000
17:31:15.011 -> A0: 0.000 AIN0: 241.000
And output with the battery pack connected:
17:34:48.862 -> Single-ended external battery voltage from AIN0 and A0
17:34:49.886 -> A0: 741.000 AIN0: 18462.000
17:34:50.879 -> A0: 736.000 AIN0: 18449.000
17:34:51.904 -> A0: 736.000 AIN0: 18460.000
17:34:52.935 -> A0: 736.000 AIN0: 18468.000
17:34:53.919 -> A0: 736.000 AIN0: 18466.000
17:34:54.950 -> A0: 737.000 AIN0: 18458.000
17:34:55.973 -> A0: 737.000 AIN0: 18455.000
The blinky light blinks the same whether the board is powered by the USB port or by the 6AA battery pack.
It was my understanding that the ADS1115 outputs 0 to 2^15 ADC counts for 0 to 4.096 volts, but that the voltage in this application cannot exceed 3.3 volts without causing damage. That would explain your factor of 17,585 (32,768 / 17,585 X 3.3 = 6.149 volts).
I did not try to read Pin A6 after I had read the following:
On the Mayfly, analog pin A6 is connected to a resistor divider that measures the voltage of the battery connected to the LiPo jack.
NOTE: If the USB cable or an FTDI adapter is connected to the Mayfly (ie, to connect to the Serial Monitor) the measured voltage will be from the voltage from USB/FTDI cable (~5V) and not the voltage of the LiPo battery.
I could just apply an offset and calibration factor to the 16 bit results to force them to agree with the Fluke meter and the 10 bit ADC. The problem is that the discrepancy is outside the ADS1115 datasheet error specifications by more than a factor of ten. It is far preferable to find the root cause of the discrepancy.
This particular sketch is for the purpose of learning to use the Mayfly before I connect the real sensors. But first I need to get the 10 bit and 16 bit ADC’s to agree.