maximum number of relays with ethermega

At a high level, I want to be able to control each of my lights (50 or so) independently. I'm new to arduino and have been researching all week and think it would fill my need.
I'm specifically looking at the EtherMega since it has a micro SD for logging and an ethernet port for receiving commands. Plus it has over 50 digital outs and some analog outs that can be used as digital outs.

Each light is a 15W 120V LED, thus I figure I need a lot of solid state relays. I'm looking at getting several of these:

I saw on the spec for the relays that they require something like 20mA of power to turn on the load. If I have 50 of these, I could be drawing 50*20mA=1000mA. The EtherMega spec sheet said this, which alarmed me:

  • Current Per I/O Pin 40 mA maximum
  • Total Current For All I/O Pins 200mA maximum
  • Current At 3.3V 50mA maximum

Does that mean I could only have at most 10 relays on at a time (since the max for all I/O pins is 200mA?

How would I control 50 relays using one EtherMega?

How would I control 50 relays using one EtherMega?

You control the relays (often using transistors) from the arduino, not power the relays. Using latching multiplex chips, you could control hundreds of relays. A forum search for relay should produce much info.

You control the relays (often using transistors) from the arduino, not power the relays

My understanding is that the digital out would power an optically isolated solid state relay, but powering the led would inside the SSR is 5V@~20mA. Am I wrong?

Using latching multiplex chips, you could control hundreds of relays.

If I'm multiplexing, that often means (if I'm understanding it right, like with LED cube examples) I'm not actually able to address each relay individually and with any combination being on at the same time. Instead, relays would be turned on/off in the microsecond time frame. I want them to be either on or off, rather than cycling between on/off tens or hundreds of times per second. Thus I wanted to not have to go the multiplex route and having 50 pins on the EtherMega seemed to be closer to my desire.

Either way, am I reading the EtherMega spec sheet correctly? Only a subset of digital out pins can be on at a time to produce a maximum of 200mA combined?

One assumption I'm probably wrong on is that the specific relay board I'm looking at would be used like this:

arduino digital out x ---> wire ----> relay x input ---> led inside relay ---> resistor inside relay ---> relay output ---> wire ---> ground

If the resistor isn't in the relay, and instead is something I would have to put between relay output and ground, then perhaps I could actually use one resistor for all of the relay's led's?

Meaning
arduino digital out 1 ---> wire ----> relay 1 input ---> led inside relay ---> relay output ---> wire ---> common resistor 1 outside of relay ---> wire ---> ground
arduino digital out 2 ---> wire ----> relay 2 input ---> led inside relay ---> relay output ---> wire ---> common resistor 1 outside of relay ---> wire ---> ground
arduino digital out 3 ---> wire ----> relay 3 input ---> led inside relay ---> relay output ---> wire ---> common resistor 1 outside of relay ---> wire ---> ground
arduino digital out 4 ---> wire ----> relay 4 input ---> led inside relay ---> relay output ---> wire ---> common resistor 1 outside of relay ---> wire ---> ground

Or, am I thinking about parallel curcits wrong? It's been over 10 years since I took a related physics class in college.

Ok, so I've been searching for stuff about transistors for relays like you suggested. I just watched: Tutorial 05 for Arduino: Motors and Transistors - YouTube and read http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1255355062.

I'm now under the impression that I actually want something similar to the image on the video at 2 min 18 seconds. Where the motor is actually replaced by my relay and the 9V (5 in my case) is coming from a different AC/DC wall transformer (similar to the battery in his example).

Then the setup would look more like this:

arduino digital out 1 -> wire -> resistor -> transistor base 1
arduino digital out 2 -> wire -> resistor -> transistor base 2
arduino digital out 3 -> wire -> resistor -> transistor base 3
etc

common 5V battery/wall power -> transistor collector 1
common 5V battery/wall power -> transistor collector 2
common 5V battery/wall power -> transistor collector 3

transistor collector 1 -> relay 1
transistor collector 2 -> relay 2
transistor collector 3 -> relay 3

... something like that.

I'm then limited by the total resistance required to power the transistor bases, right?

transistor collector 1 -> relay 1
transistor collector 2 -> relay 2
transistor collector 3 -> relay 3

meant

transistor emitter 1 -> relay 1
transistor emmiter 2 -> relay 2
transistor emitter 3 -> relay 3

The example in the video is quite a bit more complex than what you need for two reasons:

  • You probably won't be doing any PWM (relays on 60Hz power lines wouldn't be able to switch fast enough for PWM dimming)
  • Your SSR relays need WAY less power than a motor and can be controlled without a transistor

When we talked offline, I suggested multiplexing, and although the term may be generally correct, I think I was misleading.

What you would probably want to do is use some shift registers so that your arduino can just send out a number where each bit indicates a relay (and hence a light bulb) that should be on. If you use latching shift registers, there should not be any flickering as the values that are high will stay high across clock cycles unless the latch value is raised (someone please correct me if I am wrong here.) (that's another issue we can talk about separately and a library will handle most of it for you anyway.)

Shift registers are pretty cheap. I've ordered mine from Search results for: 'm74hc595b1r 74hc595 74595 8 bit shift register ic' because their prices are low ($0.23 per 8 bit register) and their shipping is $1.00.

I'll make a diagram of how it goes together for you, but it may be later this evening by the time I can get it to you.

Although, I just had the thought that if you just want to minimize complexity of design and you don't mind using all your dOut ports, you can do it like you described.

Oh, looks like it's even easier.

I looked closer at the 8-relay board you linked on Amazon and it looks like it already handles the power issues you are talking about using the transistors for.

Notice that in addition to the control lines it has VCC and Ground. Presumably, these would be connected to your power source that you are running the ethermega off of. That way it can pull the power it needs without overloading the arduino when all the relays are on at the same time.

I'm completely fine with using all of the digital out pins, as the ethermega would fit the bill for me on the number of d-outs.

I did see a VCC and ground, and now that you mention it, I'm assuming that it goes to the wall adapter for power.

Would that mean that it already has the built in resistor/transistor pair and I can go straight from dout x-> relay control in?

How can I tell how much power is going to be consumed via d-out to relay control on this relay board?

It does say on amazon:

Standard interface that can be controlled directly by microcontroller

MockObject:
I'm completely fine with using all of the digital out pins, as the ethermega would fit the bill for me on the number of d-outs.

I did see a VCC and ground, and now that you mention it, I'm assuming that it goes to the wall adapter for power.

Would that mean that it already has the built in resistor/transistor pair and I can go straight from dout x-> relay control in?

How can I tell how much power is going to be consumed via d-out to relay control on this relay board?

Per image 6 on there product page OMRON 2/4/8-Ch 5V Solid State Relay | SainSmart – SainSmart.com each input pin is wired to a 10k resister in series towards the transistor with a 10k pull down. You should be able to just wire it directly to the micro and it will have very little power draw.

This seems to suggest that each control has 100mOhm of resistance.

ShallowJuly 12
For the 16 CH 12V Relay module, does the output currency mean that we could run 5VDC, 12VDC or 24VDC through the relay? What ever current we input will be the output current, correct?

MovingforwardJuly 20
For your first question, yes, you can use the relay to drive anything below 30VDC, 10A.
For your second question, yes, the rated contact resistance of the relay is 100mOhm.

That would mean .05mA per relay, not 20mA I got somewhere that was likely from looking at similar relays.

Per image 6 on there product page http://www.sainsmart.com/module/8-channel-5v-solid-state-relay-module-board-omron-ssr-4-pic-arm-avr-dsp-arduino.html# each input pin is wired to a 10k resister in series towards the transistor with a 10k pull down. You should be able to just wire it directly to the micro and it will have very little power draw.

Sorry, we were both typing at the same time.

So is my math right?

5V/10,000Ohm = 0.0005A pulled from each digital out per relay?

Seems like I could easily run 50 relays with one EtherMega with this board with only needing wires as my additional parts.

Why use high voltage LED module? Low voltage LEDs are much simpler to drive (and I would imagine are cheaper).

Why use high voltage LED module? Low voltage LEDs are much simpler to drive (and I would imagine are cheaper).

I got 50 6" can LED’s from directledsolutions.com back in January. While I might power, and have more control with low voltage LED’s, I’m already sunk into what I’ve got.

Can someone verify my understanding of this. silasmoeckel speculated that

Per image 6 on there product page OMRON 2/4/8-Ch 5V Solid State Relay | SainSmart – SainSmart.com each input pin is wired to a 10k resister in series towards the transistor with a 10k pull down. You should be able to just wire it directly to the micro and it will have very little power draw.

I think silasmoeckel meant input pins are wired in parallel to 10k resistors toward the transistor and have a 10k pull down.

If I'm understanding things right, I'd then have a draw per transistor of
5V/10,000Ohm = 0.0005A

Total for 48 relays would be 0.0005A*48=0.024A or 24mA. This is way under the 200mA max total for all digital outs on the EtherMega.

All I would need is the

  1. EtherMeaga
  2. a few DC power supplies at 5V with 160mA minimum per 8-channel relay (likely go with double that from what I've been reading to be on the safe side)
  3. DC power supply for EtherMega
  4. wires to go between EtherMega digital out pins to the 8-channel relay inputs
  5. wires for grounding EtherMega ground pin to the 8-channel relay ground

I don't think I need any transistors or resistors or anything like that from the looks of it.

FWIW,
I found this project post in the Home Automation forum using a similar 8-channel relay (not solid state).

Here's a link to his arduino uno powering 8 relays. - YouTube
And a video of it switching the relays on/off. http://www.anotheroldgamer.com/

MockObject:
Can someone verify my understanding of this. silasmoeckel speculated that

Per image 6 on there product page OMRON 2/4/8-Ch 5V Solid State Relay | SainSmart – SainSmart.com each input pin is wired to a 10k resister in series towards the transistor with a 10k pull down. You should be able to just wire it directly to the micro and it will have very little power draw.

I think silasmoeckel meant input pins are wired in parallel to 10k resistors toward the transistor and have a 10k pull down.

If I'm understanding things right, I'd then have a draw per transistor of
5V/10,000Ohm = 0.0005A

Total for 48 relays would be 0.0005A*48=0.024A or 24mA. This is way under the 200mA max total for all digital outs on the EtherMega.

All I would need is the

  1. EtherMeaga
  2. a few DC power supplies at 5V with 160mA minimum per 8-channel relay (likely go with double that from what I've been reading to be on the safe side)
  3. DC power supply for EtherMega
  4. wires to go between EtherMega digital out pins to the 8-channel relay inputs
  5. wires for grounding EtherMega ground pin to the 8-channel relay ground

I don't think I need any transistors or resistors or anything like that from the looks of it.

R1 is in series between the output pin and the transistor and R7 is a pulldown. All your assumptions look correct, you can simplify the power by connecting a single 5v supply to the vin port and ground as it's easy to find 2a or larger power supplies.

Thanks a lot silasmoeckel. I'll give this a try.