Board humming sound when sharing power source with solenoid

Hello everyone,

I just wanted to get some feedback and understand a little better what is causing my Leonardo board to make a humming sound after a solenoid is actuated via a relay from a digital pin. The only way to make the sound go away is to power everything down. The sound comes back as soon as the solenoid is actuated again. I even to say that the board may seem to get a little warmer?

This happens only when I am powering the arduino from the same power source I am powering the solenoid. The solenoid shares the same ground as the arduino as well as 12v.

However if I power the arduino via USB or another power source, the humming sound never happens and everything works as expected.

ideally I would prefer not to have to run two power sources but would like to understand what could be happening and if I will eventually burn my board.

Thank you

The Arduino cannot directly drive a relay, use a resistor - power transistor

google images: arduino relay

to get a schema how its done.

Relay and solenoid should have a separate power supply , GND's connected !

Thanks for the input. I'm driving the relay via a board made to work w the arduino so I don't think that is problem.

In the code I did have to set the pinmode to output to get enough current to drive the board which from what I understand is the correct thing to do.

You mention that the relay and solenoid needs it's own power source and cannot be shared w the arduino. Can you please explain why? What is causing the buzzing?

I want to understand what the problem is so I can learn a little more.

Thank you in advance.

I wanted to add that I am using a 13v 20 amp power supply.