// Circuit Pin Connection description:
// Soil Sensor connection:
// D0 -------------------->>>> Digital Pin - 6
// GND ------------------->>>> GND Arduino
// Vcc -------------------->>>> Vin Arduino
// Relay
// IN ------------------------>>>> Digital Pin - 3
// GND ---------------------->>>> GND Arduino
// Vcc ----------------------->>>> 3.3V
// Relay Screw-Driver
// 1 Pin ----------------------------->>>> Motor +ve
// 2 Pin(Middle) ------------------>>>> Battery +ve
// Motor -ve ---------------------->>>> Battery -ve
// Programming of given project:
int water; //random variable
void setup() {
pinMode(3,OUTPUT); //output pin for relay board, this will sent signal to the relay
pinMode(6,INPUT); //input pin coming from soil sensor
}
void loop() {
water = digitalRead(6); // reading the coming signal from the soil sensor
if(water == HIGH) // if water level is full then cut the relay
{
digitalWrite(3,LOW); // low is to cut the relay
}
else
{
digitalWrite(3,HIGH); //high to continue proving signal and water supply
}
delay(400);
}
// Project :- 2 : In the same project you can use Rain sensor module
// Problem/Troublesooting
// If relay’s green LED not glowing then change the Arduino.
// Change 1st wire on screw driver side.
// Servo door lock using Bluetooth : code
// void loop() {
// if (Serial.available() > 0) {
// char command = Serial.read(); // Read the incoming command from Bluetooth
// // Adjust the positions of the servo motors based on the received command
// if (command == 'L') {
// pos1 = constrain(pos1 - 90, MIN_ANGLE, MAX_ANGLE); // Move motor 1 left
// pos2 = constrain(pos2 - 90, MIN_ANGLE, MAX_ANGLE); // Move motor 2 left
// pos3 = constrain(pos3 - 90, MIN_ANGLE, MAX_ANGLE); // Move motor 3 left
// } else if (command == 'R') {
// pos1 = constrain(pos1 + 90, MIN_ANGLE, MAX_ANGLE); // Move motor 1 right
// pos2 = constrain(pos2 + 90, MIN_ANGLE, MAX_ANGLE); // Move motor 2 right
// pos3 = constrain(pos3 + 90, MIN_ANGLE, MAX_ANGLE); // Move motor 3 right
// }
// // Set the new positions of the servo motors
// servo1.write(pos1);
// servo2.write(pos2);
// servo3.write(pos3);
// // Print the current positions to the Serial Monitor
// Serial.print("Servo 1 Position: ");
// Serial.println(pos1);
// Serial.print("Servo 2 Position: ");
// Serial.println(pos2);
// Serial.print("Servo 3 Position: ");
// Serial.println(pos3);
// }
// }
No comments:
Post a Comment