Arduino Mega

I am wanting to build a project with 50 or so 5VDC Relays. Doesn't have to be 50 but I would like to do as many as I can with the Mega.

I am new to the forum, programming and Arduino. I have a question about the Arduino Mega. If I wanted to control 54 relays @ 5VDC, would the Arduino Mega allow me to control all 54 Relays? If I added an ethernet shield to the Mega, does that take away 4 of the 54 usable pins? If that is true, then could I control 50 Relays?

With the power source, how many milliamps power supply would I need in order to operate close to 50 5VDC relays?

I appreciate anyone's help in getting me started.



I think you'd want to use opto-isolated relay boards; you can't build that many relays and driver transistors for the price..

What are you going to control with the relays?

A 5100-based Ethernet module/shield uses 4 pins. See THIS PAGE See the Mega pinout. A module means you don't need to fit a shield with other shields on the Mega..

To make it easy to CONNECT those 50 relays, consider the Mega "Sensor" shield which has individual, marked pins for every I/O. See THIS PAGE

See THIS PAGE about relays. You'll need a separate 5V power supply for the relays.

What are you trying to accomplish?

Why optoisolated?
You can do as many as you want - do the coils need much current? 10s of mA maybe?
I have a board with 96 150mA drivers, wire up all the relays you want.
Program the onboard '328P it just like an Uno, use 4 pins to control 12 daisy chained shift registers.

ULN 2803A chips could be another option- capable of .5amp@50V. For $7.70 + tax & shipping, they could operate 56 relays. No additional pins needed; output of arduino connect directly to 2803; output of 2803 connects directly to relay.