Water level sensor w/ nichrome wire no, now capacitive

Hi all, I've been lurking around these forums looking for help and searching through which has helped me out a lot :slight_smile:

My background is basic electronics which I'm using to create a ROV which has bilge tanks to raise and lower it in the water. These bilge tanks are controlled with bilge pumps through motor controller; thats all working brilliantly. The whole thing is communicated with using an Ethernet shield and firing OSC commands down, with a PC in the way which then connects to an Xbox360 controller.

These bilge tanks are sealed, and I need to know the water level in them, at both ends (they are 1m long lengths of 110mm diameter drain pipes). I have acrylic rods which I intend to connect a nichrome wire loop to which - as far as I understand - is a length of wire with a known resistance per cm/m/inch whatever.

The nichrome wire I have is 42SWG (1Ohm per CM), and I'm hoping to connect 5V from the Arduino at the top, and then another lead to an AnalogIn pin and measure the voltage, with the hope that as the water goes up the acrylic rod the resistance of the loop will change as the water will create a short.

First, does any of this make sense (smartest way of doing it?) and is my Arduino going to suddenly blow up if I were to just connect the 5V through the nichrome wire to the GND on the board itself? I'm worried as to whether the nichrome takes as much current as possible and burn out the board, or if it will only use what its given (40ma?).

I typed this quick at lunch, but I'll be able to post a schematic later if needs be.

Can anyone help?

What I can tell you is that with a resistance that low you will indeed have to be careful not to put to much load to the Arduino (1 meter -> 100ohm -> current: 50mA at 5V).

I actually did not get how you want to do the level measuerement with the nichrome.
What would maybe work is to increase conductance by adding e.g. salt to the water then put an electrode connected to +5V at the bottom of the tank and one connected to an analog input at an object that swims on the water surface. With the water level the distance between the electrodes and therefore the resistance and the voltage varies.

Or you want something precise, then a capacative method would maybe be the right thing. (eg.http://mechanical.poly.edu/faculty/vkapila/ME3484/Readings/NV27-Measuring%20Water%20Level.pdf)

That's just what came to my mind. I can't tell if it works and there might be much better methods.

Cheers frsc.

I'm trying to make this: http://lifeboat.co.nz/arduino-water-level-gauge/ but using a continous length of nichrome so that it'll have a higher accuracy? That was the idea at least.

I would end up using probably 80cm overal, 20cm per probe. I guess if I throw a resistor in there it'll increase the resistance and lower the current draw?

The capacitive route looked good, but to make an accurate sensor for cheap didn't really work out. Baring in mind that this will be underwater, just the wires from the sensor back to the Arduino (which would be submerged) would have changed the reading on a capacitive setup.

Keep in mind that you cannot measure resistance by connecting the 5v-carrying nichrome wire straight to the arduino ADC. You need to pair the wire with another resistor to create a voltage divider, and then measure that voltage.

What i see on the page you linked is that there is a series of resistors on the tube and not only the wire.
My guess is that the water more or less shorts the resistors so that a linear measurement is possible.

My advise, is to follow their building methode and experiment with that, and ask Dave what the actual function of the wire is.
It could be that it is eg. corrosion resistant.

Yes the basic idea will work but there are two things you have to watch out for:-

  1. Nicrome wire will not solder, you have to use crimped connections.
  2. Prolonged exposure to DC produces small bubbles in the water that stick to the surface and so reduce the amount by which it is shorted. So the resistance reading will gradually increase. You can get round this by exciting it with AC, one way is a H-bridge that keeps switching the polarity of the applied voltage.

Best of luck

I've seen people use two digital pins to get ac - with a soil moisture sensor.

here's an example

that same page also shows an H-bridge circuit

I don't think you will get consistent results trying to use nichrome wire - the reading will vary too much depending on how much salt or adic there is in the water and how clean the wires are. I'd use capacitive sensing instead.

First up, thanks for all the responses, you've all been a great help.

dc42 brought up a good point with the quality of the liquid I'll be dumping this thing into. I made an example 'probe' with the nichrome wire, but its thinner than a human hair and royal pain in the ass to work with. Here is my attempt:

I'm gonna ditch that plan, mainly because I can't get a decent and re-creatable manufacturing method. And secondly because the results from the Arduino are poor.

dc42 you bring up the idea of capacitive sensors. Any link for how to make one? I've checked loads of tutorials and can't find one that suits my purpose.

Is there anything I can buy (about £10 each, I need 4) that will do what I want?

I'm not aware of anything you can buy, but I think you could make your own capacitive sensor. See the image for the arrangement I would try. R in the diagram is an insulated metal rod, e.g. a rod with heat-shrink sleeving on it and epoxy to seal the bottom, or maybe a rod enclosed in a thin plastic sleeve, or possibly a rod painted with 2 or 3 layers of epoxy. S is a metal cylinder, or if the water is conductive enough, don't bother with it and just stick a metal electrode at the bottom of the ballast tank, or use the ballast tank itself as the ground connection if it is metallic. This effectively gives you a capacitor in series with a resistor between connections C and GND. The capacitor is formed by the rod R and the water surrounding its insulation. The resistor is formed by the water between the outside of the insulated rod and the cylinder S. Note this will not work if the rod it not fully insulated and the water can reach it, because in this case the water effectively shorts the capacitor.

To measure the capacitance, either use the circuit in the link you gave in your original post, or use the [untested] circuit I have given in the image based on a 555 timer chip. Use a CMOS verson of the 555 because the capacitance will be low, so you need R1 to be quite high (perhaps several megohms) to get a the 555 to oscillate at a sufficiently low frequency that you can measure it on the Arduino. Also you need R1 to be much greater than the effective series resistance of the sensor. To get a larger capacitance, make the diameter of the rod bigger and the rod insulation thinner.

The frequency of the 555 output should be inversely proportional to (L0 + water_level), where L0 is a constant. I suggest you feed the 555 output to an Arduino input that supports interrupts, so that you can count pulses in the interrupt service routine. Time a number of pulses and calculate the average interval, which should be propertonal to L0 + water_level.

I'm not aware of anything you can buy,



I'm not aware of anything you can buy,


Those are capacitive proximity switches, not liquid level sensors. OTOH there are some liquid level sensors at http://uk.farnell.com/level - but all the ones I looked at are for sensing whether the liquid is above or below a certain level, not for measuring the level.

Wow, thanks dc42 :slight_smile:

I'm gonna lurk around ebay and hopefully grab some aluminium tube or copper pipe for the outer section (S) in your drawing, and find some thin-ish rod (2-3mm diameter) and coat it with some kind of paint for (R) as you said.

I think the hardest part will be keeping the middle rod in the middle of the tube, as I can't use a washer or anything in the middle of the tube (it would stop the water running up the tube). I'm thinking that it'll be held at the top by a rubber grommet with small holes drilled in it, effectively slowing the filling and emptying of the sensor smoothing out the readings slightly.

The water will be nasty canal water (any large bits will be filtered by the pumps) so there will be gunk in it (read: not just water). I guess I'll have to calibrate the sensors on the day they are to be used.

Thanks again guys, I'll post a tutorial if I get this working :slight_smile:

I think the hardest part will be keeping the middle rod in the middle of the tube, as I can't use a washer or anything in the middle of the tube (it would stop the water running up the tube). I'm thinking that it'll be held at the top by a rubber grommet with small holes drilled in it, effectively slowing the filling and emptying of the sensor smoothing out the readings slightly.

You could use plastic washers in the middle of the tube and drill holes in them (or just cut the corners out) to let the water through. Or you could drill holes in the outer tube, or even have a slot running along its length. If the water is conductive enough, you might get away with replacing the outer tube by a second, un-insulated rod parallel to the first.

However you do it, I suggest making it removable so you can clean it if it gets clogged up or algae growing on it. I recall that the British navy used to copper-bottom its ships to prevent stuff growing on them, so a copper tube sounds like a good idea.

Excellent ideas.

Just to clarify your drawing, I found this on Wiki:

I'll google around for more information on it and how to use it.

Sounds like a really interesting project, twenty questions;

  • How deep do you intend to go ?

  • Will you be pressurising the compartment containing the electronics or will it be sealed it so that it remains at 1 atmosphere?

  • How many balast tanks are there?

  • You want to measure the level at both ends of the tank, does this mean the tanks are normally horizontal then, as the ROV dives,
    they tilt so the water level in one end becomes shallow and the other deep?

  • What is the maximum dive angle?

  • Is what you are really interested in the volume of water in the tank?

  • Will the ROV be autonomous and how will you communicate with it?

I got sufficiently interested in this that I decided to try it out. I made the sensor by wrapping about 20 turns of insulated wire end-to-end over a piece of stripboard, loosely. I connected the copper strips together to form the ground electrode. This isn't ideal because it allows water to cling between the wire and the stripboard.

My 555 circuit used the sensor as timing capacitor (pins 2/6 to ground), a 100k resistor between pins 2/6 and 7, and a 1M resistor between pin 7 and Vcc. I connected the output pin 3 of the 555 to pin 2 of my Arduino Uno so that I could attach interrupt 0 to it.

Here is the sketch I used:

volatile unsigned long count;

void setup()
  pinMode(2, INPUT);
  attachInterrupt(0, isr, RISING);

void isr()

void loop()
  count = 0;
  unsigned long freq = count;
  Serial.write(' ');  
  float interval = 1000.0/(float)freq;
  Serial.print(interval, 4);
  Serial.write(' ');  
  float level = (interval - 0.1200)/(0.9025 - 0.1200);

The first value sent to the serial port is the frequency in Hz, the second is the interval in ms, and the third is the water level. The figures 0.1200 and 0.9025 in the calculation are the intervals I recorded with the sensor out of the water (but still a bit wet) and fully immersed, respectively.

It works! The level displayed goes from 0.0 when the sensor is out of the water to 1.0 when fully immersed, linearly as far as I can tell. The only snag is that with the sensor out of the water, the reading can be a little higher than 0.0 or slightly negative, depending on how much water is clinging between the wires and the board at the bottom of the sensor. When building your sensor, I suggest making sure that the wires or insulated rod are separated from other things (particularly the ground electrode), to prevent water clinging to them. Using water-repellent insulation (PTFE?) might also help.

It works!

For the moment, there is still the problem that the electrodes have DC across them and so will tend to generate electrolysis which will affect the capacitance. So in about a month it will probably not work or at best need recalibrating or cleaning.


It works!

For the moment, there is still the problem that the electrodes have DC across them and so will tend to generate electrolysis which will affect the capacitance. So in about a month it will probably not work or at best need recalibrating or cleaning.

The non-ground electrode is insulated from the water, therefore there is no DC current and no electrolysis.

I tried dumping a load of salt in the water to see if the conductivity of the water had any effect. It didn't. Then I tried using hot water. This had a very marked effect: the 'level' now reads 1.42 when the sensor is fully immersed! Somehow the capacitance is increased when the sensor is hot. So the sensor needs to be temperature-compensated, unless you can build one that is it less sensitive to temperature.