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?
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
common 5V battery/wall power -> transistor collector 1
common 5V battery/wall power -> transistor collector 2
common 5V battery/wall power -> transistor collector 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.)
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 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
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)
DC power supply for EtherMega
wires to go between EtherMega digital out pins to the 8-channel relay inputs
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.