Why arduino doesn't work with battery?

I used 4 1.5V battery for arduino instead of using USB, to make my design more sophisticated but, when I use the battery the arduino doesn’t work and it doesn’t run program proparely. If someone knows why and what should I do to solve this problem, I would really appreciate it, in below is the link of the program that I used and the video of Arduino which it worked with USB.

http://www.youtube.com/watch?v=vi1YLskQ9UE

pinMode(13,OUTPUT);

const int VAL_PROBE = 150; // Analog pin 0

const int MOISTURE_LEVEL = 0; // the value after the LED goes ON

void setup() {

Serial.begin(9600);

}

void LedState(int state) {

digitalWrite(13, state);

}

void loop() {

int moisture = analogRead(MOISTURE_LEVEL);

Serial.println(moisture);

if(moisture > VAL_PROBE) {

LedState(LOW);

} else {

LedState(HIGH);

}

delay(100);

}

To which pin on the Arduino board are you applying this 4x1.5v battery pack?

And which Arduino board are you using?

Thank You for your answer, I put the picture of my circuit here.

http://designchallenges.blogspot.com/20 … cting.html

Really hard to tell from your picture but the + from the battery pack should go to Vin and - should go to gnd. Verify that you are getting about +6V from the battery pack.

and you did get this all to work power from USB, right?

Yes, I got +6V from battery pack but it doesn’t work when the power source is Battery.

But, when I’m using the USB it works properly

Philba:
Really hard to tell from your picture but the + from the battery pack should go to Vin and - should go to gnd. Verify that you are getting about +6V from the battery pack.

and you did get this all to work power from USB, right?

Thank you the battery wire didn’t install in proper place, thank you for helping, now it works.

chamaz:
Thank you the battery wire didn’t install in proper place, thank you for helping, now it works.

No problem. You have to be vigilant because those pesky wires don’t install themselves properly.