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

Bizarre eTape Sensor Behaviour

Home Forums Environmental Sensors Bizarre eTape Sensor Behaviour

Viewing 7 reply threads
  • Author
    Posts
    • #15274
      James_NZ
      Participant

        Hi all,

        I have been trying to calibrate an 80cm eTape sensor – standard linear resistance to voltage module (https://img1.wsimg.com/blobby/go/6e1bce17-f4fa-40c3-9d89-9bb7445697bb/downloads/0-5V%20Module%20Data%20Sheet.pdf).

        Everything seems normal and there is a nice relationship between depth and voltage until I reach 40cm.  At that point the voltage switches from a positive voltage to a negative voltage which subsequently increases with depth again.

        I think this might have something to do with the 3.3v on the ADC?  Any thoughts on how I should interpret this?  I could form two relationships and switch between them dependent on the -ve sign, however I wonder if there is a simpler way around this?

        Thanks for your help.  There is a chart included as an attachment below.

        James

         

         

         

         

        Attachments:
      • #15276
        Shannon Hicks
        Moderator

          You didn’t state what board you’re using, but if it’s an EnviroDIY Mayfly board or any other board with a processor operating voltage of 3.3v, then you’re not going to be able to read a 5v signal.  It’ll max out reading around 3.3v, and you’ll likely damage the ADC input if you run it for very long or exceed the absolute maximum voltage of the ADC input pin.  The easiest thing would be to use a voltage divider to cut your 0-5v signal into either half or 2/3, then just multiple the result by the ratio and you’ll get the full voltage.  On a related topic, are you taking multiple readings and then doing an average, either with the onboard ADS or a Mayrly’s ADS1115 ?  Because if you take lots of analog readings and declare the sum of the bits as an “int”, then strange things will happen when the sum is greater than 32,767 (it drops to negative -32768 and then continues until it approaches 0) so converting a really large number of bits into volts will generate a graph similar to what you posted.

        • #15277
          James_NZ
          Participant

            Hi Shannon,

            Yes using the Mayfly ver 0.5b.  I am using the ADS1115, and reading 50 ADS readings at 50us intervals and storing them in an array.  I am then taking the median of the array and multiplying by 3.3 before dividing the whole thing by 17585.0.

            I have the Mayfly jumper on the ADC section set to 5v rather than 3.3.
            It was my understanding that there is a voltage divider already built into the eTape.  Would I need to create another on top?

            Relevant code is attached.

            Thanks for your help.

            James

             

            </div>
            <div class=”adL”></div>

          • #15279
            Shannon Hicks
            Moderator

              No, there is not a built-in voltage divider on the Mayfly to protect either the 1284p’s 10-bit ADC or the auxiliary 16-bit ADS1115 ADC input.  The jumpers on the Mayfly that let you select the Switched 3.3 or Switched 5v only change the voltage that’s supplied to the Grove jack’s VCC pin.   There’s nothing to protect the Mayfly’s ADC inputs from overvoltage because there’s an infinite number of input voltages someone could attach to the Mayfly, so it’s up to the users to make sure they reduce their signal to keep it under 3.3v.  (A little history:  the Mayfly board was originally designed to work with a turbidity sensor that needed 5v excitation but produced a 0-2.5v output, so overvoltage was never a concern until the board started being used by a wider audience, and later once we started using other analog-output sensors with outputs like 0-5v.)

              From the link you provided, it doesn’t appear that there’s any sort of voltage divider included in that interface device.  It specifically says it’s a 0-5 volt module, so there doesn’t appear to be any way to force it to adjust its output voltage range.  It also says it needs 6-30v excitation, so I’m curious what you’re using to power it.  I’m guessing there are other resistance-to-voltage modules out there that would operate just fine on 3.3v excitation and have a 0-2.5v or 0-3.3v output, or even better – a digital output like I2C or SPI.  You can also have your Mayfly do the resistance to voltage measurement with just a little bit of hardware and some code.

              But if you want to continue using the 0-5v module, you’ll need to lower it to a safer range in order for the Mayfly to read it properly. When I have a sensor with a 0-5v output, I put two perfectly matched 100k resistors (check the resistance with a precision ohm-meter of about a dozen 10% precision resistors and you’ll find a couple that are the same) in series between the sensor output and ground, and then read the voltage in the middle of the two resistors and you’ll get exactly half.  So for a sensor with a 0-5v output, you’ll now get a range of 0-2.5v.  If you really wanted to maximize your resolution, you could use a 2/3 resistor divider to give it a range of 0-3.3v, but with the ADS1115, we’re already getting resolution finer than a fraction of a millivolt, so it’s doubtful you’d see much improvement between using a 1/2 divider when compared to a 2/3 divider.

              As for your code, I have a few suggestions.  Line 52 should be removed.  The Pin 2 you mentioned in that pinMode statement is actually the 1284p processor’s pin 2, which is the secondary UART RX pin, so if you were using something like a Bee module, that could cause problems.  In line 38, you declared the variable eTapePin was defined as 2, and because that’s the channel number of the aux ADS1115, there’s no reason to set the pinMode for it.  You only have to use the variable name when making the readADC statement like you did in line 64. And filling an array in order to find the median uses more memory and takes lots of complicated code when compared to a simple averaging loop, especially if you later want to increase the number of readings.

              Here’s a sketch I used recently for taking 100 readings (10ms apart) from the ADS1115 aux analog pin and then averaging them and displaying the result to the serial monitor.  If the signal you’re measuring is 3.3v or less, no change is necessary.  If you’re measuring a voltage like 5v, use a 50/50 voltage divider to cut the voltage in half and then use line 76 to calculate the average voltage instead of line 74.

               

            • #15306
              James_NZ
              Participant

                Hi all,

                Just an update. I sent an email to the tech support team at Millonetech, and we were able to confirm that the eTape sensor I am using is not a resistance to voltage module (as I suggested above), but contains a simple voltage divider. This version works fine with 5v VCC, so that is not a problem.

                I purchased some 100k resistors and will build a 1/2 voltage divider tonight. I will let you know if I am successful at eliminating the strange behavior.

                Thanks for your help.

                James

              • #15307
                James_NZ
                Participant

                  Hi everyone,

                  Just a quick update.  The 100k voltage divider worked perfectly. My new voltage water level relationship is below.

                  Thanks again for your help @shicks.

                  James
                  <h2 class=”user-nicename”></h2>

                  Attachments:
                • #15316
                  neilh20
                  Participant

                    Hi James,

                    If its the standard variable resistance then you should be able to just use the switched 3V. The ADS1115 is going to be more accurate.

                    FYI in case its of interest, I did some work with it and here is what I found out about the  eTape;  as I remember with the eTape, was that in calibration it wouldn’t register to the printed zero mark – and had an “actuation depth”, maybe it has changed.   The general issue with an “elemental sensor” is that the raw sensing (in this case resistance) needs to be transformed into measurable units  – in this case mm or inches, and for the eTape it is non-linear.

                    https://milonetech.com/products/standard-etape

                    They have linearizing modules, 0-5V and 4-20mA  –  though it requires a 6-24V stimulation

                    I did try the 4-20mA version, but burnt it out as it didn’t have reverse protection voltage in it.

                    https://img1.wsimg.com/blobby/go/6e1bce17-f4fa-40c3-9d89-9bb7445697bb/downloads/4-20mA%20Module%20Data%20Sheet.pdf

                     

                    Emails I sent, though maybe it has changed:

                    Subject: Configuring eTapes into a system?
                    Date: Thu, February 12, 2015 10:58 pm

                    Some issues coming up
                    1) ‘0’ depth marking on the eTape scaling can never relate to a 0
                    electronic reading.
                    The data sheet says Actuation Depth a nominal 1″ – it seems that most of
                    the eTapes start recoding pressure change at about 0.2″
                    So where does the linearity start and to how to design to meet it?
                    2) For the simple eTape interface circuits, do you have any recommended
                    formuleas/manufacturing algorithims that translate measured Vout to a
                    linear depth reading that can apply to any eTape received.
                    <div class=”moz-cite-prefix”>On 2/19/2015 10:23 AM, chris.milone@milonetech.com wrote:</div>

                    <div>Hi Neil,</div>
                    <div></div>
                    <div>Sorry for the delayed response.  Yes, a voltage divider output is a nonlinear function.  We are working with another customer who has written some Arduino code that he claims automatically linearizes the output but we haven’t been able to get this to work as of yet.</div>

                  • #15317
                    neilh20
                    Participant

                      Another low cost depth sensor, showing the problems with using “raw sensing”,  and the range is very small range 0-10cm and needs recalibrating evertime there is a power cycle. – https://www.vegetronix.com/Products/AquaPlumb/ – but my experiments have shown it has 

                      My comment

                      “Works pretty nicely, except after power off.
                      Can’t take power off while in water – then reads 0.
                      Seems as a capacitance based sensor, when powering up needs to baseline the capacitance – guessing on my part – that is needs to be out of the water. Once read a baseline capacitance, then it detects increase in capacitance, water crossing. If the baseline capacitiance could be read, and then programmed, maybe it could survive a power off. “

                       

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