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


Home Forums Mayfly Data Logger AREF

Viewing 3 reply threads
  • Author
    • #12643

        Just wondering if AREF connects to a voltage source.? Looking at the rev0.5B and IC1 pin 29 labeled AREF I can’t find how AREF connects to 3.3V – but its probably I’m missing something. If it was an annotated PDF I could search for AREF.
        The code suggests AREF is connected to 3.3V.
        If it does connect to 3.3V, can it be disconnected, leaving C19 on the AREF, and then specify the 1V internal VREF?
        The purpose would be greater accuracy in monitoring A6 for when powered from V_BATT and its reaching the lower part of LiIon range.

        many thanks,


      • #12646
        Shannon Hicks

          The AREF pin of the micro on the Mayfly is not tied to anything (except through a capacitor to ground as suggested in the ATmega datasheet), so when you use the standard analogRead(0) command, it uses the default 3.3v reference setting. If a user is more advanced and wants to use an internal reference by using certain commands, or by connecting an external reference to the AREF pin of the lefthand 20-pin header, then those options are available. However, it is extremely dangerous to adjust the AREF voltage either externally or internally if you can’t make sure that the analog pin won’t see a voltage exceeding the new reference voltage, otherwise permanent damage to the microprocessor will occur. See the Arduino page for example commands and warnings about how to do it safely. https://www.arduino.cc/reference/en/language/functions/analog-io/analogreference/

          I can’t imagine needed a finer resolution on the battery measurement though, it’s already pretty fine scale as-is on the default setting and is accurate enough to know your general battery health, plus the LiPo batteries we use have internal low-voltage cutoff protection so they will stop supplying power to the Mayfly if their voltage drops too low.

        • #12647

            Hello Shannon/@shicks – thanks for the detail.I missed that it was an internal connection on the mega1284 to the 3.3V
            The issue with the 3.3V, is that it is connected to the LiIon through the regulator SPX3819.
            The regulator has a dropout that is variable depending on the load, temperature etc – so from the datasheet at load of 500mA it could be a potentially max of 700mv under some extreme conditions, but more likely to be the typical 340mV.
            So assuming that the LiIon V is measured before any load is applied ie less than 50mA, the max regulator dropout is 250mV, but more likely to be 125mV…
            So I am reading the datasheet, (and sometimes let out the smoke for getting it wrong 🙂 )…

            Taking worst case analysis – measurement of the LiIon V with std settings, below 3.5V could be distorted.

            Practically speaking I’m seeing a distortion of LiIon V when it drops below 4.1V, measured by BattV compared to an ExtVolt with 100K/100K. Still investigating – I’m probably got something wrong, but trying different options.

          • #12652

              I’ve put a discussion of measuring LiIon voltage https://github.com/EnviroDIY/ModularSensors/issues/196
              I’m seeing a divergence in between two different sources of measuring LiIon from V_Batt and ExtVolt/ADS1115.

          Viewing 3 reply threads
          • You must be logged in to reply to this topic.