Problems with powering arduino using DC power supply

Hi, I wrote simple code that triggers the relay after pushing the button. I'am also using build-in led for debugging.

// C++ code
//
int bumper_touch = 0;

void setup()
{
  pinMode(7, OUTPUT);
  pinMode(4, INPUT);
  pinMode(LED_BUILTIN, OUTPUT);

  digitalWrite(7, HIGH);
  digitalWrite(LED_BUILTIN, LOW);
}

void loop()
{
  bumper_touch = digitalRead(4);
  if (bumper_touch == HIGH) {
    digitalWrite(7, LOW);
    digitalWrite(LED_BUILTIN, HIGH);
    delay(1200); // Wait for 1200 millisecond(s)
    digitalWrite(LED_BUILTIN, LOW);
    digitalWrite(7, HIGH);
  }
}

Everything works fine when the Arduino is powered via USB. However, after connecting it to a power supply in my project, the built-in LED turns off, and the relay switch behaves ein strange way. I replaced the 12V power supply with a different one, and the problem disappeared. I'm really curious why the old power supply didn't work with my Arduino.

This is just a guess, but the first power supply may not deliver adequate current.

1 Like

It can deliver up to 16a

But is it able to do so? You may have a faulty power supply.

1 Like

Post an annotated schematic with links to the hardware items. Be sure to show all connections.

It is broken?

Hi, @nomysz10

Do you have a DMM? Digital MultiMeter?

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.