Go Down

### Topic: Help with circuit - why does this work? (Read 1 time)previous topic - next topic

#### shmish

##### Feb 14, 2016, 07:54 am
Hello,
I'm implementing this schematic:

It's from here

I'm trying to figure out why this works such that when the bottom level probe and a sensor probe are both in the water, the associated pin will go low.  For example, if there is a decent amount of water in the tank, PIN 8 will read LOW.  My understanding is when there is water, a small current should flow to the base, and a an amplified current will flow from the collector to the emitter.  Why does this prevent current from flowing from the +5V pin through the 470 Ohm resistor and into pin 8?  Is this because pin 8 has some resistance after it (on the arduino board), and the current will prefer to short to ground through the transistor?

thanks

#### olf2012

#1
##### Feb 14, 2016, 09:41 am
You got it right: the current "prefers" to flow to ground through the transistor. Almost NO current flows into the pin because it has a very high resistance.
Viewed another way: the current through the transistor produces a large voltage drop over the 470 Ohm resistor, so at the "bottom" side of the resistor there is not much voltage left.
Yet another view: the resistor and the transistor form a voltage divider where the lower part (the transistor) is of variable resistance. When conducting the transistor has a low resistance hence leading to a low voltage at the middle point of the divider

#### Koepel

#2
##### Feb 14, 2016, 09:57 am
The Arduino can detect a voltage without a current going into the pin. It is almost as if the Arduino smells the voltage at the pin without touching it. That high is the input resistance of an Arduino.

I don't care of the circuit works, I don't like it
A current is going through the water, that will cause a little electrolysis on the probes (the metal pins in the water). After a long time those probes will get corroded and will not work well anymore.

#3
##### Feb 14, 2016, 10:10 am
Current is "lazy" . It will rather go through the easy way. You could add a resistor before the transistor to allow more current to flow both ways

#### DrAzzy

#4
##### Feb 14, 2016, 10:25 am
Yeah - the electrolytic corrosion will be a problem here. The negative side is fine - the electrical potential is actually going to prevent it from corroding - but on the positive side, you can't use a non-noble metal. Carbon holds up well, and of course, platinum or gold are excellent.

But yeah, I hate that design too, I wouldn't do it. I wonder if you could make a capacitive touch/proximity sensor detect the water level through the side of the container. I bet you could.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

#### aarg

#5
##### Feb 14, 2016, 11:29 am
Or a cheap ultrasonic distance sensor.
... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

#### Grumpy_Mike

#6
##### Feb 14, 2016, 05:43 pm
Not sure how deep the tank is but I would use one of these:-
https://www.sparkfun.com/products/10221

#### gpsmikey

#7
##### Feb 14, 2016, 06:42 pm
One other thing to keep in mind with the level sensors that rely on conduction (as the original diagram shows) - people think of water as a conductor.  In reality, it is a very poor conductor - it is the impurities in it that make it conduct.  If you fill that with distilled water, it probably will not read it.
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3

#### shmish

#8
##### Feb 14, 2016, 07:27 pm
OK, makes sense. I wasn't sure if the pins had high internal resistance or not.

Yes, there is a problem with corrosion.  The idea is to have this in my small water tank for my espresso machine.  There is no room for a float or ultrasound sensor without me starting to hack into plastic parts of the enclosure.  I was thinking I could turn on the sensor for 5 seconds every now and then to check the water level.  The manual way of checking water level is to move the espresso machine and lift out the water tank.

Anyways, this is mostly for fun and learning. I'll keep looking at captive sensors, and maybe consider designing a top port to accept an ultrasound sensor, although I'm guessing humidity won't be kind.

cheers

#### Koepel

#9
##### Feb 14, 2016, 07:36 pmLast Edit: Feb 14, 2016, 07:43 pm by Koepel
Capacitive sensors are the best when you want to put something in the water.
This is a very nice painted (for isolation) capacitive sensor : https://www.youtube.com/watch?v=C6PTT4_v9Uo

At the moment I am using alternating sensing voltage with copper/nickel strips. That is not capacitive, but measuring the conductivity. I use three Arduino pins. Two for the alternating voltage, one to measure.

#### gpsmikey

#10
##### Feb 14, 2016, 07:42 pm
There is another way of sensing water level you might want to check out - basically, you use a clear plastic rod with the end cut with two 45 degree bevels polished (looks like a wedge) and you have an led/opto sensor at the top.  The LED sends light down the rod - when in air, the two surfaces reflect the light back up again while in water (or other liquid), the two faces don't reflect so there is no signal back again.  I have not played with them, but I have seen the design before.  That method does not have any conductors or anything in the liquid.
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3

#### shmish

#11
##### Feb 18, 2016, 03:15 pm
Capacitive sensors are the best when you want to put something in the water.
This is a very nice painted (for isolation) capacitive sensor : https://www.youtube.com/watch?v=C6PTT4_v9Uo

At the moment I am using alternating sensing voltage with copper/nickel strips. That is not capacitive, but measuring the conductivity. I use three Arduino pins. Two for the alternating voltage, one to measure.

That dfrobot product looks interesting. Any idea on how it is sensing water level?

Quote
There is another way of sensing water level you might want to check out - basically, you use a clear plastic rod with the end cut with two 45 degree bevels polished (looks like a wedge) and you have an led/opto sensor at the top.  The LED sends light down the rod - when in air, the two surfaces reflect the light back up again while in water (or other liquid), the two faces don't reflect so there is no signal back again.  I have not played with them, but I have seen the design before.  That method does not have any conductors or anything in the liquid.
The circuit I'm building is hitting a roadblock. I had most everything on the prototype board and it was working and then I added the LED warning lights and now it always reads empty.  Super frustrating.

#### gpsmikey

#12
##### Feb 18, 2016, 06:27 pm
Adding the LED's should not affect the rest of the circuit unless there is a wiring error.  One issue I do see as a potential problem - it is configured so if only the bottom one is in the water then it is "LOW" - the problem is that if the water drops below the bottom one, none of them will turn on - the software in the sketch should be configured such that if none of them are turning on it gives a warning.  As far as the LED's go, try disconnecting one at a time and see if it is just one of them causing the problem or if they all are.  There is also a potential problem depending on exactly how the probe coming from the supply through the 22k resistor is set up.  Those are bipolar transistors and the way they are configured, the base can only be pulled up to about 0,7 volts and the transistor turns ON due to the current through the base emitter junction.  If the water in the tank is very conductive or the "supply" probe is not placed right, the other transistors my not get enough current through them to turn on.  Something to consider.  I think I would have used FET's (although if I show my age, I would have used vacuum tubes with the sensors connected to the grids of dual triodes ... )
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3

#### polymorph

#13
##### Feb 18, 2016, 09:12 pm
Capacitive. You can measure it simply by taking two wires and placing them in the tank.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8