Strange behaviour with Arduino Mega and Relay board when using external power

I have an Arduino Mega 2560 controlling an 8-channel relay board. There is an ethernet shield on the Arduino, and I send UDP messages in order to turn on/off individual relays on the relay board. The relay board has the Vcc-JDVcc jumper in place, meaning that the 5V coming from the Arduino powers both the chips on the board and the relays.

When the Arduino is powered by an external 12V 1.5A power supply, I can turn on the relays but they will turn themselves off again after 10-15 seconds. Note that I don't have anything plugged into the relays at the moment - they are unloaded. Both of my relays (I'm controlling 2) shut off together, and the communication LEDs on the Ethernet Shield momentarily turn off as well. Maybe the board is resetting? I'm not sure how to test that.

When the Arduino is powered by USB, there is no problem. The relays stay on until I turn them off.

I need to be able to power the board via an external supply. Does anyone have any ideas what might be going on, or suggestions on what I can do to fix this? Thanks so much.

Try connecting a regulated 7-8V power supply to the barrel jack, or regulated 5V to the Vcc (5V) pin instead. The on board voltage regulator may be overheating.

If you leave a println("setup complete") in setup() which will print each time the setup() is complete you can tell you have a reset.

Though I think the issue is power. Are you by any chance, using a bread board?

Can you take a picture of your project and post it so 'we' can see the project?

Do you have another power supply you can use that has a bit more meat to it?

How about a schematic?

Your relays have coils which are being energized, that is the load to your current project. Thus your project does have a load.

Have you tried only connecting one relay to the project and use the power supply to see if it drops out?

Just some random questions.

Thanks so much to both of you for your quick responses. Yes, it looks like the input voltage was too high. I'm drawing 0.38A at 12V, and the board is resetting after a few seconds (that's with both of the relays energized, but it will reset with only one relay as well). When I drop the input power to 9V, I draw 0.39A but there is no reset.

There is also no reset when I power the relay solenoids separately through the JDVcc pin on the relay board.

For my application I'll go with powering the relay board from a dedicated 5V source. It's easier for me to get a 5V source than a 9V, and in the end I'm going to be using 2 relay boards and all 16 relays.

Thanks again for the help.

You should not use the on board regulator to supply external loads - it is not intended for that .