I have a dedicated 12 volt input.
This 12 volts input is then dropped down to 5 volts using a buck.
All Voltage shows fine and seems to be working no voltage is pulled from the board itself.
5volts into vin and ground into ground.
only two other wires come from the board a signal wire for the relay and a signal wire on A0
#define pump 13
const int AirValue = 576; //you need to replace this value with Value_1
const int WaterValue = 368; //you need to replace this value with Value_2
int intervals = (AirValue - WaterValue)/3;
int soilMoistureValue = 0;
void setup() {
//Serial.begin(9600); // open serial port, set the baud rate to 9600 bps
pinMode(pump, OUTPUT);
pinMode(A0, INPUT);
digitalWrite(pump,LOW);
delay(2000);
}
void loop() {
soilMoistureValue = analogRead(0); //put Sensor insert into soil
if(soilMoistureValue > WaterValue && soilMoistureValue < (WaterValue + intervals))
{
//Serial.println("Very Wet");
delay(1);
digitalWrite(pump, LOW);
}
else if(soilMoistureValue > (WaterValue + intervals) && soilMoistureValue < (AirValue - intervals))
{
//Serial.println("Wet");
delay(1);
digitalWrite(pump, LOW);
}
else if(soilMoistureValue < AirValue && soilMoistureValue > (AirValue - intervals))
{
//Serial.println("Dry");
delay(1);
digitalWrite(pump, HIGH);
}
delay(1000);
}
So I don't understand why it only works when the USB is plugged in looking for any advice.