iot1Nick PangHamza WaheedSteven Sek
Published

Multi-Purpose Water Level Sensor

This once in a lifetime product can be purchased today for any of your water level monitoring needs!

IntermediateFull instructions provided3 hours917
Multi-Purpose Water Level Sensor

Things used in this project

Hardware components

Argon
Particle Argon
×3
Breadboard (generic)
Breadboard (generic)
×2
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Standard LCD - 16x2 White on Blue
Adafruit Standard LCD - 16x2 White on Blue
×1
Single Turn Potentiometer- 10k ohms
Single Turn Potentiometer- 10k ohms
×1
Jumper wires (generic)
Jumper wires (generic)
×26
Elegoo water level sensor
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
ThingSpeak API
ThingSpeak API
Maker service
IFTTT Maker service

Story

Read more

Schematics

WATER SENSOR

This is Argon number one.

LCD Screen

This is Argon number two and how it was setup. (The program used only had a Photon BUT WE USED A PARTICLE ARGON)

LED

This is Argon number three. We used D7 on the Argon as our LED to blink. (The program used only had Photons, BUT WE USED A PARTICLE ARGON)

Code

watelevelsensor

C/C++
int waterSens = A0; //define water sensor
int led = D7;//define led to pin 9
int waterVal; //define the water sensor value



void setup() {
pinMode(led, OUTPUT); //set led as an output
pinMode(waterSens, INPUT);//set water sensor as an input

}

void loop() {


  waterVal = analogRead(waterSens); //read the water sensor
  delay(1000);

String level = String(waterVal);
  Particle.publish("Water_level_value", level, PRIVATE);
  delay(1000);

if (waterVal>0 && waterVal<=300){
    Particle.publish("Water_Level_iot1", "LOW   ",PRIVATE);
    
}
else if (waterVal>300 && waterVal<=600){
    Particle.publish("Water_Level_iot1","MEDIUM",PRIVATE);

}
else if (waterVal>600){
    Particle.publish("Water_Level_iot1", "HIGH  ",PRIVATE );

}

}

lcdscreen

C/C++
// This #include statement was automatically added by the Particle IDE.
#include <LiquidCrystal.h>

LiquidCrystal lcd(5, 4, 3, 2, 1, 0);


void setup() {

    lcd.clear();
    lcd.begin(16, 2);
    lcd.setCursor(0,0);
    lcd.print("Water Level"); //Print line 1: Water Level 
    Particle.subscribe("Water_Level_iot1", Level, "LOW   ");
    Particle.subscribe("Water_Level_iot1", Level, "MEDIUM");
    Particle.subscribe("Water_Level_iot1", Level, "HIGH  ");


}

void loop() {

}

void Level(const char *event, const char *data) {


    lcd.setCursor(0,1);
    lcd.print(data);          //Print line 2: LOW, MEDIUM, or HIGH
}

ledlight

C/C++
int waterVal;
int led = D7;
void setup() {
    
pinMode(led, OUTPUT);

Particle.subscribe("Water_Level_iot1", Level, "LOW    ");


}

void loop() {
    
}

void Level(const char *event, const char *data) {
    
        digitalWrite(led, HIGH);
        delay(1000);
        digitalWrite(led, LOW);
        delay(1000);
        digitalWrite(led, HIGH);
        delay(1000);
        digitalWrite(led, LOW);
        delay(1000);
        digitalWrite(led, HIGH);
        delay(1000);
        digitalWrite(led, LOW);
        delay(1000);
        digitalWrite(led, HIGH);
        delay(1000);
        digitalWrite(led, LOW);
        delay(1000);
        digitalWrite(led, HIGH);
        delay(1000);
        digitalWrite(led, LOW);
        delay(1000);
        digitalWrite(led, HIGH);
        delay(1000);
        digitalWrite(led, LOW);
        delay(1000);
        digitalWrite(led, HIGH);
        delay(1000);
        digitalWrite(led, LOW);
        delay(1000);
        digitalWrite(led, HIGH);
        delay(1000);
        digitalWrite(led, LOW);
        delay(1000);
        digitalWrite(led, HIGH);
        delay(1000);
        digitalWrite(led, LOW);
        delay(1000);
        digitalWrite(led, HIGH);
        delay(1000);
      

//Blinking: Water level low
//Solid: Water level high

    
  }

Credits

iot1

iot1

1 project • 0 followers
Nick Pang

Nick Pang

1 project • 0 followers
Hamza Waheed

Hamza Waheed

0 projects • 0 followers
Steven Sek

Steven Sek

0 projects • 0 followers

Comments