Milone etape liquid level sensor help

Hi,
I am an undergraduate working in a lab to build a liquid level sensor using the etape set up sold here:

I am not an EE major, so I am quite the beginner with this kind of thing. The housing cap of my model contains a precalibrated 0-5 V module, so I've wired the black pin directly to the ground of the arduino, the red pin to the 5 V arduino power supply, and the white to the first analog input.

(Black)-----(Arduino Gnd)
(Red)---- (Arduino 5 V power supply)
(White)----(A1)

When I execute the following code, the etape senses resistance changes above a certain value, which it tends to reach when about half full, but any more water released will not result in resistance changes beyond this point.

#define SERIES_RESISTOR     750    // Value of the series resistor in ohms.    
#define SENSOR_PIN          0 // Analog pin which is connected to the sensor. 

// The following are calibration values you can fill in to compute the volume of measured liquid.
// To find these values first start with no liquid present and record the resistance as the
// ZERO_VOLUME_RESISTANCE value.  Next fill the container with a known volume of liquid and record
// the sensor resistance (in ohms) as the CALIBRATION_RESISTANCE value, and the volume (which you've
// measured ahead of time) as CALIBRATION_VOLUME.
#define ZERO_VOLUME_RESISTANCE  12000  // Resistance value (in ohms) when no liquid is present.
#define CALIBRATION_RESISTANCE   7666.67  //nce value (in ohms) when liquid is at max line.
#define CALIBRATION_VOLUME        80 // Volume (in any units) when liquid is at max line.

void setup(void) {
 Serial.begin(9600);
}

void loop(void) {
 // Measure sensor resistance.
 float resistance = readResistance(SENSOR_PIN, SERIES_RESISTOR);
 Serial.print("Resistance: "); 
 Serial.print(resistance);
 Serial.println(" ohms");
 // Map resistance to volume. 
 float volume = resistanceToVolume(resistance, ZERO_VOLUME_RESISTANCE, CALIBRATION_RESISTANCE, CALIBRATION_VOLUME);
 Serial.print("Calculated volume: ");
 Serial.println(volume, 5);
 // Delay for a second.
 delay(1000);
}

float readResistance(int pin, int seriesResistance) {
 // Get ADC value.
 float resistance = analogRead(pin);
 // Convert ADC reading to resistance.
 resistance = (1023.0 / resistance) - 1.0;
 resistance = seriesResistance / resistance;
 return resistance;
}

float resistanceToVolume(float resistance, float zeroResistance, float calResistance, float calVolume) {
 if (resistance > zeroResistance || (zeroResistance - calResistance) == 0.0) {
   // Stop if the value is above the zero threshold, or no max resistance is set (would be divide by zero).
   return 0.0;
 }
 // Compute scale factor by mapping resistance to 0...1.0+ range relative to maxResistance value.
 float scale = (zeroResistance - resistance) / (zeroResistance - calResistance);
 // Scale maxVolume based on computed scale factor.
 return calVolume * scale;
}

Essentially, the value for resistance seems to "max out" about halfway down its length. I believe this has to do with the fact that my code expects a resistance reading, but this model of etape measures voltage instead. Since my etape comes with a built in voltage divider in the housing cap, I think I have to accommodate for this problem in the code. Does anyone have an arduino code for this type of etape? Or could someone offer some suggestions about how to approach my problem? I appreciate the help, I am very inexperienced.

It's not clear whether you have the 0-5v module or whether you are connecting the sensor directly to your Arduino.

Please post a diagram showing all your connections with clear labels.

To make it easy for people to help you please modify your post and use the code button </>
codeButton.png

so your code 
looks like this

and is easy to copy to a text editor. See How to use the Forum

...R

Thank you, I have modified the post. Let me know if there is any more information you could use to help me.

corykittleman:
Thank you, I have modified the post.

Please don't do that. I have no idea what you have changed. Can you put your Original Post back to its original condition and put the new information in your next Reply?

At least tell me what changes you made.

In general don't make changes to existing Posts apart from correcting typos - especially after someone has commented on the original

...R

The changes I made were as follows:

  1. I explained that I am using a 0-5 V module, but it is already built into the housing cap for the etape
  2. Diagrammed my wiring:
    (etape black)----(Arduino Gnd)
    (etape red)-----(Arduino 5 V)
    (etape white)----(Arduino A0)
    These are all direct connections that I confirmed with Milone over the phone.

Here is a link to information on the 0-5V module:

The last page of this document refers specifically to my model, but gives little information.

I am more interested in a link to what your etape is and how it works.

Have you done the calibration as described in the PDF?

Paul

That etape looks like a “dressed up” force sensing resistor.

What Arduino?

How exactly are you powering the Arduino?

Have you tested your power supply with DMM and oscilloscope to make sure it’s regulated 5volts?

Have you tried skipping the Arduino and direct wiring the sensor to a tested 5volt power supply and measuring voltage with a DMM as you change fluid levels?

And for the real elephant in the room.. That sensor requires 6-30volt source and you claimed your running it off the 5volt pin, how could that possibly work right?