Have a problem regarding the automatic plant watering project

i have a problem, please help me

Found it: The three-way solder job between PP3 and pump.

The pump does not follow instructions from the sensor

  • Do not use a 9v PP3 battery to power a motor.

  • Always show us a good schematic of your proposed circuit. Show us good images of your ‘actual’ wiring.
    Give links to components.

  • In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.
    Use the < CODE / > icon from the ‘posting menu’ to attach the copied sketch.

1 Like
type or paste code here



```cpp
#include <LiquidCrystal_I2C.h>
int soilMoisturePin = 4;
int waterPump = 13;
int sensorOutput = 0;
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  lcd.init();
  lcd.backlight();
  lcd.clear();
  pinMode(soilMoisturePin, INPUT);
  lcd.setCursor(0, 0);
  lcd.print("Soil Moisture:");
}

void loop() {
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  sensorOutput = digitalRead(soilMoisturePin);
  lcd.setCursor(0, 1);
  if (sensorOutput == HIGH) {
    lcd.print("kering");
  } else {
    lcd.print("baseh");
  }
}

@dimas130926

I'm not sure if you're joking (as a continuation of another topic with exactly the same title) or if you really have a problem in which case you should not have posted in the Website and Forum section of the forum.

If you indeed have a problem with your project, please

  1. Edit the title of your topic to reflect the problem that you're experiencing.
  2. Give a proper description of the problem.
  3. Move your topic to a more appropriate category of the forum (or flag your topic and ask a moderator to do so).

void loop() {
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  sensorOutput = digitalRead(soilMoisturePin);
  lcd.setCursor(0, 1);
  if (sensorOutput == HIGH) {
    lcd.print("kering");
  } else {
    lcd.print("baseh");
  }
}

  • Where in this code are you controlling the pump/motor ?

doesn't seem to exist

[image]
Can you help me solve this coding? :pensive:

  • The code is between your ears.



https://docs.arduino.cc/language-reference/en/functions/digital-io/digitalwrite/

1 Like

Looks like I need all the coding

i2c LCD:
GND VCC To 5V
SCL To A5
SDA To A4

Moisture:
AO To 4
(RELAY with water Pump)

[image]

:sob:

help😣

Why did you mark your post #10 as the solution if you still need help?

Please provide a proper drawing of all your wiring (photo of pencil/paper drawing is fine); it should also show all GND and power connections.

Assuming your relay is controlled from pin 13, the following code will activate the relay for 3 seconds, deactivate for 3 seconds and that cycle will be repeated.

const uint8_t relayPin = 13;

void setup()
{
  pinMode(relayPin, OUTPUT);
}

void loop()
{
  digitalWrite(relayPin, HIGH);
  delay(3000);
  digitalWrite(relayPin, LOW);
  delay(3000);
}

Note that the pinMode() statement is in setup() and not in loop().

Once you have that working as expected, you can integrate it in your sketch.

What following code?

OOPS

Updated the earlier post, thanks :+1:

2 Likes

type or paste code here

If the circuit is like this, what is the coding? Please help me with my final semester assignment :sob:

using i2c lcd
No LED and buzzer

You really like that Solution button, don't you? :upside_down_face:

1 Like

hehehe, because on the 2nd it must be finished. so can you help me? :grinning:

That solution button isn't like a whip for the horse.. here's one reason:

Perhaps you could uncheck that box?

1 Like

ok, and so?

Thank you for being compliant. Whenever Solution is set, that Topic has been solved always greets new posts. For an obvious reason.

You can code this and be on time. Some pointers:

  • Concentrate on your Arduino and the sensor. Make a sketch with only that sensor in mind. Send output over Serial monitor.
  • Then add pump. About the pump, I doubt that 9 V battery will power the pump properly. Check the specs for the pump, and find another power source.
  • Get on it!!!!