Introduction: How to Make a Water Level Alarm With Nano Board

Nowadays water tank has been widely used to store water for department. But there is one problem, how can we know there is no water or the bumping water overflows in time? It’s real inconvenient to check the state again and again. With some programming knowledge, I decide make this alarm to inform with beeping and light indicator. This can be applied to some water level invisible tank or tower.

Have a try!

Step 1: Prepare Materials

Picture of Prepare Materials

SunFounder Nano board - http://bit.ly/2fwJNnj

USB cable

Some jumper wires - http://bit.ly/2tXqPZN

4 LEDs (white, green, yellow, red)

Passive buzzer

Plastic bottle

Foam board

Drinking straw

Dielectric stick

Scissors

Electrical Tape

Color Pen

Step 2: Make a Water Tank

Picture of Make a Water Tank

Stab at the bottom of the bottle to get a hole, then thread the drinking stick across the hole, and seal with glue.

Step 3: Make Water Level Probe

Picture of Make Water Level Probe

Fasten a jumper wire’s one end to the bottom of the stick and the other end to +5V power. Fasten the four other wires evenly on the stick in the same way. (Adjust the interval distance according to your actual needs)

Step 4: Insert the LEDs and Buzzer

Picture of Insert the LEDs and Buzzer

Draw a whale (whatever other image you like) on a paper and paint with color, then paste this paper on the foam board. Insert the buzzer to the whale’s eye position, and four LED to the spout position in order. (Insert those components’ pins across the foam board, thus the wiring in later part will be easier.)

Step 5: Wiring

Picture of Wiring

Complete the wiring as shown:

Step 6: Upload the Code

#define uchar unsigned char
uchar flag = 4;
void setup()
{
  Serial.begin(9600);  // start serial port at 9600 bps:
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
}
void loop()
{
  int w = analogRead(A0); //read the value from analog pin AO
  int g = analogRead(A1);
  int y = analogRead(A2); 
  int r = analogRead(A3);
  Serial.println("w:");
  Serial.println(w);
  Serial.println("g:");
  Serial.println(g);
  Serial.println("y:");
  Serial.println(y);
  Serial.println("r:");
  Serial.println(r);
  if((w< 1000) && (g > 1000) && (y > 1000) && (r > 1000))                      //Stop when the car is picked up
   flag = 0; 
    else if ((w< 1000) && (g < 1000) && (y > 1000) && (r > 1000))                            //if read the value of the Tracking module data[0] is more than 100
    flag = 1;        
      else if((w< 1000) && (g < 1000) && (y < 1000) && (r > 1000))                              //if read the value of the Tracking module data[2] is more than 100
      flag = 2; 
        else if((w< 1000) && (g < 1000) && (y > 1000) && r< 1000)                           //if read the value of the Tracking module data[4] is more than 100
        flag = 3; 
        else 
        flag = 4;
  switch(flag)   //According to the relative position of the line and the car, adjust the front wheel steering angle to change the direction of the car to achieve inspection line.
  {
    case 0:
    digitalWrite(2,HIGH);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
    break;
    case 1: 
    digitalWrite(3,HIGH);
    digitalWrite(2, LOW);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
    break;
    case 2: 
    digitalWrite(4,HIGH);//turn the LED on
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(5, LOW);
    pinMode(9, OUTPUT); //set the pin 9 as an output
    tone(9, 3000, 100);
    delay(400);
    tone(9, 0, 10);
    delay(400);
    pinMode(9, INPUT); //set the pin 9 as an input
    break;
    case 3: 
      digitalWrite(5,HIGH);
      digitalWrite(2, LOW);
      digitalWrite(4, LOW);
      digitalWrite(3, LOW);
      pinMode(9, OUTPUT);
    tone(9, 3000, 100);
    delay(80);
    tone(9, 0, 10);
    delay(80);
    pinMode(9, INPUT); 
    break;
    case 4: 
    digitalWrite(3, LOW);
    digitalWrite(2, LOW);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW); 
    break;
  }
}

Step 7: Put the Stick in Water Tank

Picture of Put the Stick in Water Tank

Step 8: Water Level Indicator Done!

Picture of Water Level Indicator Done!

Clog the drinking straw on the tank, and add water to the tank until the water reaches the topmost probe.

Release the clogging, then observe the water level and the LED.

Comments

About This Instructable

741views

7favorites

License:

Bio: We're an ambitious team for developing STEM education by Arduino and Raspberry Pi learning kits as well as robots and aircraft models/drones. Happy ... More »
More by SunFounder Maker:Make a Reflex Measurement Device With SunFounder Nano Giraffe-Shaped Temperature-Controlled & Multi-level Desk Fan With NanoHow to Mount CC3D Flight Controller to Quadcopter (Assembly, Wiring, Software Configuration)
Add instructable to: