Connecting sensors

I am trying to connect two water level sensors which I bought here https://www.amazon.com/gp/product/B06XHDZ3Q4/ref=ox_sc_act_image_5?smid=A26ATEC08S9EFM&psc=1. I don't know how to connect them exactly since I tried using two breadboards, but it didn't work, so. Please Help.

Post a link to the boards schematics. If you didn't get the schematics, contact the vendor. If he can't provide schematics, you either have to reverse engineer the boards or simply throw them away and buy hardware with the necessary documentation.

That's a water presence sensor, not a water level sensor.

S = signal (it's an analog output), + and - are power.

I tried to code a program to make the servo motor turn 90 degrees and stop when the water touches the sensor and make it move back to its normal position when the water doesn’t touch the sensor. I used this base code to develop it and I don’t really get how to code it since five sensors are connected.

Here is the base code that I started with.

#include <Servo.h> //include servo library
Servo myservo; //define servo as servo
const int waterSens = A0;//set water sensor to A0
int pos = 0;//define servo position

void setup() {

Serial.begin(9600);
myservo.attach(9);//attach servo to pin 9

}

void loop() {
int sensorValue = analogRead(waterSens);//read the water sensor value

sensorValue = map(sensorValue, 0, 1023, 0, 180);
if (sensorValue >= 50) {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}

}

else{
myservo.write(0);
}

Serial.println(sensorValue);
delay(20);
}

Are you saying five sensors are connected to A0?

I attached an image of how I connected them.

OP's image, if you can make anything of it:

So what's the problem? What have you tried? What went wrong? What do you need?

Can someone help me to code the analog input and output for a project that includes connecting 5 water level sensors to one servo motor and make the servo motor to move 90 degrees when the water touches any of the 5 water level sensors. Then, when the water dries out, the servo motor has to move back to its normal position.

Didn’t we just do this exact thing? Are you the same person?

(deleted)

I thought this looked familiar. Why did you start a new thread on this?

@spencerkim

Do NOT CROSS POST as it simply wastes peoples time and efforts to help you.

TOPICS MERGED.

Please READ THIS before posting any further.

Bob.

I am trying to use this code to make the servo motor turn 90 degrees when the water touches the water sensor and stops. Then, make it come back to its original position or instant position when the water dries out. Also, how do I write it so that I connect multiple water sensors? Do I just write it under the first sensor?

#include <Servo.h> //include servo library
Servo myservo; //define servo as servo
const int waterSens = A0;//set water sensor to A0
int pos = 0;//define servo position

void setup() {

Serial.begin(9600);
myservo.attach(9);//attach servo to pin 9

}

void loop() {
int sensorValue = analogRead(waterSens);//read the water sensor value

sensorValue = map(sensorValue, 0, 1023, 0, 180);
if (sensorValue >= 50) {
for (pos = 0; pos <= 90; pos += 1) { // goes from 0 degrees to 90 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 90; pos >= 0; pos -= 1) { // goes from 90 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}

}

else{
myservo.write(0);
}

Serial.println(sensorValue);
delay(20);
}

This again?

Step one will be to go and find one of your old threads where we've already told you the answer.

@spencerkim

As you seem UNABLE to follow simple directions you are placed on a 48 hour BAN which is enough time to read the link I gave you previously.

Bob.

Topic now LOCKED.