The Arduino Uno runs the code correctly when connected to the computer via USB. However, when I disconnect the USB and rely on the DC jack (9V, 700mA) for power, the code doesn't seem to execute. The Power LED remains on when connected to the DC jack. The "L" LED initially blinks (for about 10 seconds) and then turns off when powered by the DC jack. There is no flash from the TX/RX LEDs after disconnecting the USB. I have checked the DC jack connection, and all wires are secure. The Arduino board shows no visible damage or burnt components. The code works flawlessly when connected to the USB. I've tried resetting the board and uploading a simple "Blink" test, which works when connected to the USB but not with the DC jack. (I'm trying to build a automated plant watering system)
Here is the code:
** [code] **
int soilMositure = A0; //Sensor Pin
int relayPin = 7; //Relay Pin
void setup()
{
delay(1000);
Serial.begin(9600);
pinMode(soilMositure, INPUT);
pinMode(relayPin, OUTPUT);
}
void loop()
{
int soilMositure= analogRead(soilMositure);
Serial.print("Sensor_data:");
Serial.print(soilMositure);
Serial.print("\t | ");
if(soilMositure > 950)
{
Serial.println("No moisture, Soil is dry");
digitalWrite(relayPin, LOW);
}
else if(soilMositure >= 400 && soilMositure<= 950)
{
Serial.println("There is some moisture, Soil is medium");
digitalWrite(relayPin, HIGH);
}
else if(soilMositure < 400)
{
Serial.println("Soil is wet");
digitalWrite(relayPin, HIGH);
}
delay(100);
}
** [/code] **
8 posts - 4 participants