cheap water level indicator

Greetings guys.

I'm trying to install a cheap water level solution for my plant project.

The wires are soldered to stainless steel nails so I don't think corrosion issues will surface.

My problem is both LEDs are lighting up :(

Please advise how to improve my setup. Many thanks in advance. :)

int waterlevel1 = 0; //water level probe for Green led
int waterlevel2 = 0; // water level probe for Red led
int threshold = 200;

#define redLED  4
#define redLEDNeg  5
#define greenLED 7
#define greenLEDNeg 6

void setup() {

  pinMode(greenLED, OUTPUT);
  pinMode(greenLEDNeg, OUTPUT);
  digitalWrite(greenLEDNeg, LOW);
  pinMode(redLED, OUTPUT);
  pinMode(redLEDNeg, OUTPUT);
  digitalWrite(redLEDNeg, LOW);

void loop() {
  waterlevel1 = analogRead(A0);
  Serial.print("Water level Green:");
  waterlevel2 = analogRead(A1);
  Serial.print("Water level Red:");

  if (waterlevel1 > threshold) {
    digitalWrite(greenLED, HIGH);
  } else {
    digitalWrite(greenLED, LOW);

  if (waterlevel2 > threshold) {
    digitalWrite(redLED, HIGH);
  } else {
    digitalWrite(redLED, LOW);

Do they turn off when level,is below the probes?


weedpharma: Do they turn off when level,is below the probes?


dangg.. they did confused *head hits wall

just hit me! You need separate 10k resistors. One for each probe.