Arduino power(ing) issue

Hi! I am having a problem that lies with the power supply of my project (I think).

The project is supposed to run with an external power supply which I attached to the Vin of the arduino. While debugging my code, I had both this external supply and the USB cable attached (USB to my computer). Now the code is clean, I want the project to run on the external supply only. But, when I disconnect the usb cable the project stops working (also after resetting the arduino).
The servos just start moving back and forth randomly. If I then reconnect the usb and reset the arduino everything is fine again.

I tried the wiring as shown in the attached drawings, both ways only work when both USB and external power are connected. The supply voltage is 7,2V when the servos are connected directly to the power supply and 9V when the servos are powered by the 5V output of the arduino.

I used two different arduinos to test (UNO and UNO rev3)
I've had arduinos working with servos and an external power supply before and have no idea why this is not working, I think the code is fine as it is working perfectly when both the USB and the external power supply are connected.

Thanks for reading, I hope you can help :slight_smile:

The USB cable provides a fairly good ground that a battery won't. Perhaps some of your inputs are floating and you are getting more noise without the Ground.

johnwasser:
The USB cable provides a fairly good ground that a battery won't. Perhaps some of your inputs are floating and you are getting more noise without the Ground.

I am using an external DC power supply (that is converting from 230AC).. I guess this has a good ground?

I just tried different code (simple servo sweep, both servos at the same time) and the same problem arised (so I am shure it's not the code)...

Hi,
try powering your servos with 4 AA batteries and power the arduino with your current power supply. see the links in my signature for why this should work and let us know if it does or doesn't.

Duane B