Measuring water level digitially (arduino)

Discussion in 'The Projects Forum' started by Mckayman, Jan 18, 2012.

  1. Mckayman

    Thread Starter Active Member

    Jun 22, 2009
    50
    0
    Hello everyone,

    Currently right now I am investigating a project where I will use my arduino micro. to measure the water level in a 40 cm^3 grad. cylinder.

    I am trying to keep the design as simple as possible, however cost is not an issue.

    I need to be able to detect when the water level is at 5 cm^3 and then again at 35 cm^3.

    My idea currently is to use two transistors with the gate and the emitter extending down to the specified level, and then have the collector connected to the arduino, therefore when the water shorts the gate and the emitter the transistor will go high.

    However, right now I have not a clue on what type of transistor or if this idea will even work at all. Any input would be greatly appreciated.

    PS. I am curious to know if measure the water level can be measured continually is that is at all possible.

    Thank you.
     
  2. wayneh

    Expert

    Sep 9, 2010
    12,154
    3,060
    The conductivity of rain water is very low and not predictable enough to allow using resistance of a water column as a surrogate for the height of that water column. You might be able to tell wet from dry as you've outlined, however I'd use op amps (or a comparator) instead of transistors, for the FAR higher impedance and adjustability of the op-amp.

    Can you use a float? Their are various ways to detect float position and convert that to level.

    [Oops, I was visualizing a rain gauge but I see you never mentioned the composition of the "water".]
     
    Last edited: Jan 18, 2012
  3. mcasale

    Member

    Jul 18, 2011
    210
    12
    Anything is possible - given enough time and money!

    Is the water clean and pure, or does it have stuff in it?

    There are commercial level sensors out in the world, but most are for big vats. That won't help you. There's probably several ways you can do this ...

    The one you mention is using a resistance change (water vs air) to sense the level. This assumes you have a reliable, worst case value for the water resistance and the air resistance. As you describe it, it won't work. The collector current also flows through the emitter. You might be better off with a bridge circuit with an amplifier and comparator, maybe. You still have to be able to adjust it to a null position.

    Other options are optical (LED sensing through the fluid) and capacitive (there's a difference between the permittivity (I think that's the thing) of dry air and water). The capacitive one is probably more tricky.
     
  4. davebee

    Well-Known Member

    Oct 22, 2008
    539
    46
    There's always ultrasonic level measuring sensors. The would do the job.
     
  5. Mckayman

    Thread Starter Active Member

    Jun 22, 2009
    50
    0
    I see, I see thanks for the information. I'm sorry I forgot to mention the water type. I am using distilled water for this project.

    I believe a float would be too big for this project. Since the volume is quiet small, unless there is a super small out there.

    wayneh: You coined what I should have said. I figured that just being able to tell dry from wet would be simple and efficient enough to be able to water level at 5 cm and 35 cm.

    Going the way of the dry from wet route, a friend of mine just suggested this...(see attachment)

    If I were to use the op-amp, how would I go about interfacing it with the Arduino?
     
    Last edited: Jan 18, 2012
  6. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,576
    231
    Grounding vs. open gate of a 2N7000 MOSFET is unreliable for switching. Adding a 10 or 22Meg resistor between the gate and V+ might make it work. It's switching will depend on the conductivity of the liquid...as wayneh and mcasale pointed out.

    Ken
     
  7. wayneh

    Expert

    Sep 9, 2010
    12,154
    3,060
    Here's an idea to get started. This circuit uses a comparator (specialized op-amp) to detect the presence of a load. It will detect a very small load, including just a human touching the two poles. Changing the value of R25, and the reference voltage applied to the "+" pin of the comparator, gives control over the sensitivity. If you need even higher impedance at the inputs, you might need to look for a different comparator or op-amp, but I suspect this circuit will work.

    The output is held high by the pull-up resistor when the comparator output goes open. (Oops, I see the pull-up is also labeled R25. Sorry about that.) The output goes low when the comparator output goes low. You should be able to feed that output directly into your data acquisition.

    [​IMG]
     
  8. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,576
    231
    Just tried it with a +5V supply, 2N7000, 10K drain load, 10M gate pullup, and tap water. Worked fine.

    Ken
     
  9. wayneh

    Expert

    Sep 9, 2010
    12,154
    3,060
    Tap water is ~4 orders of magnitude more conductive than "pure" water, something like 0.05 siemens versus 5µS. Versus 5S for sea water.
     
  10. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    Ultrasonic sensor from above as mentioned, or cheaper might be 2 capacitive sensors from the side (reading through the glass, not in the water).
     
  11. Mckayman

    Thread Starter Active Member

    Jun 22, 2009
    50
    0
    Wow I greatly appreciate all of the feed back. Thank you Wayneh for the schematic and KMoffett for looking in to what my friend drew up for me.

    As for the ultra sonic sensor that is also a neat idea, I would like to look further into one as well.

    Im going to let every cook for the back burner for the night.
     
  12. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,576
    231
    OOPS! missed the "distilled" water in the OP's second post.

    Ken
     
  13. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,576
    231
    OK, OOPs maybe, but I had to try it. The circuit works with tap water, DI water....and distilled (grocery store variety) water. No lab grade distilled available.

    Ken
     
  14. wayneh

    Expert

    Sep 9, 2010
    12,154
    3,060
    Cool. Nothing beats data.

    That circuit has the simplicity advantage. A quad comparator would be a bit more complex but could give you 4 level detectors in one package. You could place conductors at, say, 20, 40, 60, and 80% levels. Not exactly continuous but getting there.
     
Loading...