<> Explanation of common sensors IV – Water level sensor (water sensor)

<> Specific explanation

The sensor operates by using a series of five bare wires connected to system ground . Insert a sense trace alternately between each two ground traces , Five ground traces and a total of five sense traces . The sensing cable is connected to a 1 Megohm pull-up resistance . The sensing trace is pulled high , Until a drop of water or a level surface grounds the sensing trace . theoretically , This sensor will output 0-1024 Analog signal between , But with PCB Increase of routing length on , I found that the available range is 480 to 〜710 between . The sensor is not designed to be completely immersed in water , Please install carefully , So that only PCB Exposed wiring on the will come into contact with water . The output voltage of the sensor is 0-4.2
V, So if only low / High indication , You can use it as a digital input .

The analog output value corresponds to the following distance from the bottom of the sensor ( Approximate value ):

480 = 0 millimeter

530 = 5 millimeter

615 = 10 millimeter

660 = 15 millimeter

680 = 20 millimeter

690 = 25 millimeter

700 = 30 millimeter

705 = 35 millimeter

710 = 40 millimeter

The sensor resolution decreases with the increase of water level .

== install
1. Upload sketches to your Arduino.

2. Assemble the circuit using the schematic diagram attached to the project .

** LED:LED The resistor must be installed between circuit ground and LED between . If your LED One branch of is longer than the other , Longer branches need to be connected to the supply voltage (Arduino of D2).

* be careful : The length of the sensor wire I use is about 2.5 foot ,LED The length of the thread is 2 foot . This allows me to Arduino Keep away from water , And will LED Route to the end of the branch to improve visibility .

3. Follow the calibration instructions below ( Also included in the sketch ):

********* calibration / set up *********

a) take Arduino connection to IDE And turn on the serial monitor .

b) Insert the depth sensor into the water , Until you think it is the minimum depth required to trigger the full indicator . Note the value indicated in the serial monitor , To be used as full level .

* Any greater than or equal to = The value of will trigger the corresponding full flashing code .

c) Repeat step 2, Make sure you assign to LOW Value of value .

* Above but below FULL Any value of the value will trigger the corresponding INTERMEDIATE Flashing code .

* Any value below this value triggers the corresponding LOW Flashing code .

d) Will step 2 and 3 The values determined in are inserted into the sketch const int FULL and LOW In value .

e) Upload sketches with updated values , The sensor is now calibrated .

4. take Arduino Put it on some kind of shell , In case of water stop , Moving parts or short circuit damage .

5. Install the system into your application .

Number part name part number quantity

R1 1k 1/4 W resistance TE Con​​nectivity CFR16J1K0( Or similar products )1

L1 LED CREE C503B-RAN-CZ0C0AA2( Or similar products )1

S1 sensor Solu SL067 1

IC1 Arduino nanometer A000005 1

PS Power supply you can choose 5 Vdc(> = 300mA)1

<> Circuit connection

<> Implementation code
const int full = 575; const int low = 490; int depthSensor = 0; //Set
depthSensor input pin to Analog 0. int lastValue = 0; char printBuffer[128]; /*
The following line sets the LED pin to the corresponding digital pin of the
Arduino. You can set these to any digital pin as needed */ const int whiteLED =
2; void setup() { Serial.begin(9600); // Begin serial communication to obtain
sensor values during calibration. pinMode(whiteLED, OUTPUT); // Set LED pin to
OUTPUT mode. } void loop() { int value = analogRead(depthSensor); // Read the
sensor values. if(((lastValue >= value) && ((lastValue - value) > 10)) || (
lastValue= 10)) /* If the delta between last and current value is > 10, display
the current value. */ { // Displays depth sensor value to serial port. sprintf(
printBuffer, "ADC%d level is %d\n", depthSensor, value); Serial.print(
printBuffer); Serial.println(); //Serial.println(value); //Serial.println(); //
Set last value to current value for next loop. lastValue - value; } if(value >=
full) { // FULL for(int x = 0; x < 3; x++){ digitalWrite(whiteLED, HIGH); delay(
800); digitalWrite(whiteLED, LOW); delay(800); } } else if((value < full) && (
value>= low)) { // INTERMEDIATE for(int x = 0; x < 2; x++){ digitalWrite(
whiteLED, HIGH); delay(1000); } } else { //LOW for(int x = 0; x < 4; x++){
digitalWrite(whiteLED, HIGH); delay(100); digitalWrite(whiteLED, LOW); delay(100
); } } delay(3000); // Read current sensor value every three seconds. }

Technology
©2019-2020 Toolsou All rights reserved,
C++ of string of compare usage Python Study notes ( one )evo Tool usage problems ——Degenerate covariance rank, Umeyama alignment is not possibleRISC-V_GD32VF103-TIMER0 timer interrupt java Array subscript variable _Java Basic grammar : array be based on stm32 Control four-wheel trolley motor drive ( one ) be based on redis Design of liking function Software engineering career planning mysql Query random data by conditions _MySQL Random query of several qualified records centos7 install RabbitMq