Hi I'm a 4th year ece student, and we have this project due on monday, its an automatic plant watering system, but even though the moisture is already high the motor is still running but its suppose to stop, can you please help me? I don't know what to do in the codes, I'm new to this type of project thank you in advanced
here is the code i'm using
const int VAL_PROBE = 0; //Analog pin 0
const int MOISTURE_LEVEL = 250; // the value after the LED goes on
No that’s not the problem with analogRead, you can pass the number of the analog input pin to read from (0 to 5 on most boards, 0 to 7 on the Mini and Nano, 0 to 15 on the Mega)
—-
Describe what is connected where and how is the motor powered (what type of motor)
See an example of how to control soil moisture. Uses 3 status indicators. The pump is switched on when the ground is dry and switched off when it is wet.
i used the program you posted but still the motor keeps running when the soil is very wet, I don't know where the problem is, its our first time doing this kind of project
Would suggest you read how to properly drive an inductive load (your pump) from an arduino and what flyback diodes are for (here is an example of what to read and there are plenty more like this too)
Your transistor may be dead by now and I’m not sure how much current your pump needs but driving that current through your arduino board through Vin is probably not a good idea in general. Power things separately, your arduino from usb since your use Serial I suppose you are connected to your computer anyway and use the 12v power supply only for the motor (joining grounds of course)