Program works only with USB connection

Hello,

i hope you can help me again :slight_smile:

My robot program is working realy well, but only if the USB cable is connected to my Computer.
If i plug it out from the arduino the Robot do only the half of the function. In this case the servo engine dont work.

If its nesseceray i can upload also the hole code.

Thank you.

best regards, Matthias

What is the power source you are using and how is it connected?

two 4,5V block batteries in a row (9V) brand new for the Ardumoto H brige.
& 4x1,5V for the board

but i also tested with my power supply

So you are connected to the barrel jack or Vin.

This is using the on-board regulator. Which means you are probably drawing a large amount of current, causing the on-board regulator to shut-down.

When it is "not working" measure the voltage at the Vin and 5V pin, what are they?

Also, make sure you are keeping Grounds connected.

9V are connected to the Vin of the Ardumoto and 6V are connected to the barrel jack

On the 5V pins i measured 5V
and on the Vin of the Ardumoto with 5,5V (only with the 6V barrel jack)

I also tried only to connect the 6V on the barrel jack, same problem without USB connection.

the grounds are all connected...

i also disconnected the last added IR sensor. --> now the servo is running but not perfect.
with USB connection everything works.

Matze_Ka:
9V are connected to the Vin of the Ardumoto and 6V are connected to the barrel jack

You can't connect sources to both Vin and the barrel jack. They are connected together on the board.

6V in either the barrel jack or Vin is not enough voltage for the board to operating correctly.

I thought the ardumoto H brige have even this advantage that you can put a higher voltage to run the engines, or i am wrong?

Anyway i plugged only the 9V to the Vin and its not working only if i connect also the USB cable.

By the way i use a Mega 2560 board, i forgot to wirte it in the first post.

Thank you for your time. I hope we can fix that.

Happy new year at all :slight_smile:

i fixed the problem. But its strange.
When i simulate the USB Voltage of 5V with batteries (4,5V) and use a batterie voltage of 9V for the barrel jack, everything is woking. :slight_smile:

Its not the best solution but i have not better idea.
Is it possible that the Arduino board have a bug?

Thanks.

best regards, Matthias

Don't forget, there is a jumper on the Motor Shield that needs to be cut if you provide a different voltage to Vin that to the barrel jack. There is discussion on this at the hardware page:

To avoid possible damage to the Arduino board on which the shield is mounted, we reccomend using an external power supply that provides a voltage between 7 and 12V. If your motor require more than 9V we recommend that you separate the power lines of the shield and the Arduino board on which the shield is mounted. This is possible by cutting the "Vin Connect" jumper placed on the back side of the shield. The absolute limit for the Vin at the screw terminals is 18V.

The power pins are as follows:
-Vin on the screw terminal block, is the input voltage to the motor connected to the shield. An external power supply connected to this pin also provide power to the Arduino board on which is mounted. By cutting the "Vin Connect" jumper you make this a dedicated power line for the motor.
-GND Ground on the screw terminal block.

The shield can supply 2 amperes per channel, for a total of 4 amperes maximum.

Thank you, yes you are right. I think that was the mistake...
I hope the board is not damaged becouse of that...