├── README.md
├── waterLevel.html
└── waterLevel.ino
/README.md:
--------------------------------------------------------------------------------
1 | # esp8266-waterLevel
2 | water level control system using ESP8266 and HC-SR04
3 | complete demonstration and setup details in this YouTube video: watch->like->subscribe-> https://youtu.be/KK4ebz8kvqs
4 |
5 | Instructions:
6 |
7 | Step 1:
8 |
9 | you need a cylindrical tank and measure its capacity in liters, may use this tool for that
10 | http://aqua.ucdavis.edu/Calculations/Volume_of_a_Cylindrical_Tank.htm
11 | if don't have cylidrical tank, then need to modify code accordingly.
12 |
13 | relay connected to water pump, nodemcu pin D4
14 |
15 | hc sr04 TRIG connected to D1 and Echo connected to D2 through a voltage divider, (1k,2k)
16 |
17 | Step 2:
18 |
19 | modify these two lines as per capacity in FusionCharts.ready() function
20 | "lowerLimit": "0",
21 | "upperLimit": "15",
22 |
23 | modify slider paramters as per capacity and default settings
24 | max: 16,
25 | min: 0,
26 | range: true,
27 | values: [3, 12],
28 |
29 | you can locate these settings inside $("#flat-slider-vertical-1").slider(
30 |
31 | html file is already included in Arduino sketch, you can modify these paramters inside arduino sketch.
32 |
33 | Step3:
34 |
35 | create new adafruit IO feed and name it as 'waterLevel'
36 |
37 | uncomment these two lines in sketch and write your wifi ssid/password
38 |
39 | /*const char* ssid = "ssid";
40 |
41 | const char* password = "password";*/
42 |
43 | also uncomment and write here your own adafruit IO username and key.
44 |
45 | //#define AIO_USERNAME "programmer5"//replace it with your username
46 |
47 | //#define AIO_KEY "6e5fd35c936743808ceae4e101f6cbd1"//replace it with your key
48 |
49 | uncomment these lines as well, write radius of tank and total height in units of inches,
50 |
51 | //#define RADIUS 5.5
52 |
53 | //#define MAX_HEIGHT 10
54 |
55 | modify this line if you have to connect relay to some pin other than D4
56 |
57 | #define MOTOR_CONTROL_PIN D4
58 |
59 | Connect trig of ultrasonic sensor at D1 and echo at D2, modify this line otherwise
60 |
61 | UltraSonicDistanceSensor distanceSensor(D1,D2); //D1 trig, D2=echo
62 |
63 | these are default water level limits, these values will be applied on reset until user sends new limits from webpage.
64 |
65 | int waterLevelLowerThreshold=3;
66 |
67 | int waterLevelUpperThreshold=12;
68 |
69 | Need to install this HCSR04 library: https://github.com/Martinsos/arduino-lib-hc-sr04
70 |
--------------------------------------------------------------------------------
/waterLevel.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | My first chart using FusionCharts Suite XT
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
50 |
65 |
66 |
110 |
111 |
112 |