Relay and Pomp

Hello, I try to drive a pump with an arduino 2560, a relay and a pump. Everything works perfectly by connecting the arduino in USB with the PC, on the other hand with a 9V battery, the arduino lights up, the pump goes off 1/2 seconds and everything stops. Can you help me?

I use this schema (see the image file)

For the allimentation

  • Arduino is connecting to a 9V batterie
  • My pump with a 7V batterie.

Can you help me?

Your description suggests that you have separate power for the arduino and the pump. Your diagram shows that they're sharing it - which is it?

I suspect that they're sharing and the voltage drop when the motor starts causes the Arduino to reset. In any event, the problem is clearly power related - you need a stronger power supply.

Yes, in the reality i separate the alimentation of the Arduino and the Pump

I try another thing. It's to plug the Relay VCC to the + of the 9v batterie.
Then the pump always On
It doesn't work because in the code i program only 3 minutes for the pump

void setup() {
pinMode(13,OUTPUT); //signale a l arduino que la connexion 10 doit pouvoir envoyer du courant


void loop() {
delay (180000);

It's always on because when you set the output low, it's at the end of loop and microseconds later loop runs again and sets it high again. You need another delay after you set it low.

I put this
delay (86220000);
After the low instruction.
It works with USB alimentation but not with batterie.

If by 9V battery you mean the kind that go in a smoke detector, they're pretty much useless for anything to do with an Arduino - as you have discovered. Get yourself a better supply. LiPo or a bunch of AAs.

Ok i will buy A 12v batterie.
Can you mak a suggestion?