Code not running without USB connection

Hello Everyone,

I have a problem, my code is running correctly with the usb connection with my laptop but when I use an external power supply ( 12V) it does not work.

Is there something wrong which can be blocking in my code ?

Thanks in advance for your help.

final2_benchtop_ADC_RMS.ino (2.29 KB)

What exactly do you mean by "it does not work"?

What other components are you powering off the Arduino?

Hello,

Sorry for the imprecision.

I store data from sensors and log it into a microSD-card.

I use different components:

  • an ADC (ADS1115) working with I2C communication
  • a PWM LED driver

And When I initialize them in the code it blocks.

But when I just store data it works so it does not come from the microSD-card code.

Thanks again.

When you power the Arduino via USB cable from your laptop the current is only limited by what the laptop will provide, maybe 500 mA. When you power the Arduino with the 12 V power supply the current is limited by what the voltage regulator can provide. That is the most common cause of the "works on USB but not on a power supply" problem. If you have some LEDs drawing a lot of current from your Arduino that's likely the problem. Try it without the high current components attached to see if the problem doesn't go away.

The problem is the same.

But there is something I have to add.

When I supply it with external power and just connect for 1 second the USB connector and then disconnect, the program is running well, such as if it required USB for initialization.

Try pressing and releasing the RESET button after powering up the Arduino. Does it start then?

No, it does the same thing, it starts but it blocks.