I'm trying to make a simple water tank level sensor. I've read lots of pages and I like this simple circuit using the 7 channel Darlington array IC ULN 2004 (Or the ULN2803 that have 8 channels), probes and leds.
Link: http://electroschematics.com/5764/simple-water-level-indicator-2/
Probe A Bottom of tank
Probe B Upper position of tank
Probe C Middle position of tank
Probe D Lower position of tank
So I made it yesterday and works like a charm! but I don't know how to connect to my Arduino UNO.
I tried connecting to the digital input an analog but I don't realize where is the continuity to control into the arduino.
I would like that when the led bright, send the input data to the arduino, and viceversa.
You can connect the pins 14,15,16 to digital ins of the Arduino (assuming these outputs 5V - measure!- otherwise some level converter might be needed).
Do not forget to connect GND too
Or you place an LDR near each LED and sample those with analogRead()
Thanks robtillaart for your help
Yes, it's 5v from the arduino.
So do I have to connect the pins 14,15,16 to digital ins of Arduino, after the IC (before resistor) or after the led?
In Arduino I can use:
int inPin = 3;
int val = 0;
void setup()
{
pinMode(inPin, INPUT); // sets the digital pin 3 as input
}
void loop()
{
val = digitalRead(inPin); // read the input pin
}
Pins 14/15/16 will rise to 6 to 8V when the LEDs are off, so you mustn't connect them direct to the Arduino inputs. However, you can connect them via 100K resistors to Arduino inputs.
Connect the junction of the IC and the 100 ohm resistor to the Arduino input pin.
I tried it but not work for me So I tried with only one input, the HIGH meter.
I put in the junction of the IC and the 100ohm resistor but show me: level: 0 0 0.
When connecting in the junction of the Led and resistor... show me: level: 1 1 0.
Can you help me? do you know what can be the problem?
I presume that by 0 you mean LOW. Reading LOW from the pin is what you expect when the associated LED it lit. When the LED is off (water not reached the sensor), it will read HIGH.
I am reallyreally hoping that the red and black wires from the Uno 5v and Ground do not both go to the same rail on the breadboard and that that is a mistake in the pic.... 8)
As I said before, you need to connect the Arduino inputs to the other ends of the series resistors. I suggest you enable the Arduino internal pullup resistors too. The pins will read in reverse: HIGH = no water, LOW = water.