Problems with my local Power Supply! Need help!

Hello everybody,
Im new here and in electronics.

I've bought a Startet Kit from Elegoo from Amazon. Almost everything seems to be fine with all this stuff.
But if i build some stuff on the Breadboard and Power the Board through USB(Arduino) or with a seperat Power Supply for Breadbords, my Arduino and/or IC's go crazy! If i disconnect any connection to our local Power, running on Battery Power from my Laptop or a 9V Battery, everything works just Fine... If i connect my Laptop to the Grid, it goes Crazy to!

Going Crazy means, if i come close to the arduino or the IC's, it seems like i am able to trigger some connections. An Example is if i just take the Arduino and program pin 3 as an Input and 13 as an Output, nothing else except for Power is connected, if i put my finger just 5 cm above the Arduino, the pin13 LED turns on, if i remove my finger, the LED turns off...

Does somebody has an Idea for me what i can do?
Im in Germany:
Local Power Grid: 230V - 50Hz

And sorry for my bad english :wink:

Do you have a pullup resistor on the input pin?

You can also use the Arduino internal pullup resistors as such:
pinMode(3, INPUT_PULLUP);
Note that a pin with pullup is always 1, and you connect it to GND to make it read 0.

An input pin without a pullup or pulldown resistor has very high resistance, so it can be affected by very small currents. When you connect your equipment to the mains, he entire earth practically becomes one place of a capacitor, you (or any electrically insulated mass) becomes the other, as well as an antenna, and when you come near the arduino you pull tiny charges from the earth towards yourself.
(I’m sure someone else can explain this better)

Thank you for your Help! I didnt know this stuff. After adding resistors everything works fine. It was kind of crazy for me, that i could change the behaviour of the circuit only by my presence :smiley:

But one question. Why does this not happen, if it is just powered by battery?

It can still happen, if you design the circuit (in)correctly. But when the circuit is small and completely insulated from the ground, it has a much smaller capacitance.
It's comparable to a bird sitting on a high voltage wire - the bird is okay because it's small, but a human would be stung even is insulated, and fatally hurt if grounded.

People actually work on live high voltage lines using helicopters. They will connect the helicopter to the line, so the voltage of the helicopter and the line is the same, and the workers will wear metal wire clothing so that the current flowing through own capacitance won't sting them.

"Flowing" through insulation due to capacitive coupling is one of the many peculiarities of AC current.