I'm following this tutorial and have built it with the LED that turns on/off ...
... the LED turns on/off with the water, but I can't get the arduino to read the on/off signal.
I've tried wiring up to a digital pin where the LED goes, as well as an analog pin (with ground where the LED ground should be) but it doesn't read any distinguishable signal. Any ideas?
I see no reference in that "instructable" to Arduinox.
To sense water level with an Arduino, you do not need the transistor. In fact, you really need no component at all other than the Arduino. You just connect your electrodes to an Arduino input and ground and set the pin mode to INPUT_PULLUP.
For safety however, you should have at least a 10k resistor in series with the input, and reverse-biased diodes from the input to ground and Vcc. You may then want to have the adjustable (100k) resistor from the sensing electrode to Vcc.
mikgol:
I've already made the circuit, so want to use it. Any advice on how? All I can think of is putting a solid state relay in.
Well, if you must - just put a 10k resistor from the transistor collector to your 5 V (yes, 5 V) supply. Use a 220 ohm resistor for the LED, not a 47 ohm.
between the 330 ohm and led, you will have 12 volts, all the time. [the transistor is off ]
since the printed diagram shows 12v and the hand sketch shows 3, makes me wonder what LED you are using.
when the water is sensed, the voltage will drop to the circuit voltage with the LED.
since you cannot put 12 onto an arduino pin, you cannot just connnect one wire.
since you do not want to use a voltage divider to run all the time, it will kill the battery.
might I suggest you put that aside for another day ?
connect your sensor to 5v with a resistor
connect the other side of the sensor to an analog pin
then just measure the voltage,
look at this
connect your water sensor where the drawing show the LDR.
use the sketch example readAalogVoltage
my alternative would be to use an opto-isolator and use that in series with the LED. the output side could be used by the Arduino to detect the change up to a point.
the water test circuit appears to be a linear output, so the LED will dim as water changes the readings. that might be more dependant on the sensor.
Paul__B:
Well, if you must - just put a 10k resistor from the transistor collector to your 5 V (yes, 5 V) supply. Use a 220 ohm resistor for the LED, not a 47 ohm.
(BTW, you meant an opto-coupler, not a SSR.)
Thanks for your help Paul - I ended up just using a 10k resistor and analog pin, but thanks for explaining how I would get it to work with my circuit - I'm a littlebit better at electronics now. Cheers