Advice needed on Limits...

Ok, I have an Arduino Mega 2560 Revision 3, with the Ethernet Shield (with the MicroSD card slot)

I have built a simple website to control the state of 32 relays, and thus 32 different computers. (future-proofing)
On the hardware side of things I'm only going to start with 8 relays. I bought an 8 Channel 5V Arduino Relay Shield Module (Shield info: http://www.tjskl.org.cn/products-search/cz5093382/8_channel_5v_arduino_relay_shield_module-pz5389815.html) from a different website. however I am thinking I may need to get an 8 channel relay board with Optical Isolation. I am planning on powering each Relay shield with a different power supply. My pins to control the relays are currently set to pins 18-50.

My code is VERY incomplete and I am constantly modifying it.

code to do list:
change web server ON state to hardware pin LOW, as it is still reversed.
Pin 13 is added on there for test purposes, as I do not have the relays yet.
The button to Update the Machine labels is not functioning yet.
I am planning on saving the Machine labels and States to the EEPROM.
Create Authentication to protect the web server.
I would like to (eventually) interface the SD card to output a log of device changes.

I have attached my code as I was unable to embed it. (too long)

My Questions:

  • Will I have over-current issues when I turn multiple machines off (thus pins are HIGH)?
  • Will I have over-current issues with the ground with all pins set to low?
  • What should I use to power the relay boards?
  • I would like to unsolder the power connector on the Arduino and solder the wires directly. Will I have any issues introducing heat to the board?
  • Does anyone have any recommendations as far as adding authentication to the board? I have not researched this part yet, it may be a simple answer
  • Any other recommendations for this project?

This is indeed my first Arduino project, so I'm sure I have made some noob mistakes along the way.

PS: mods, if I placed this in the wrong section I apologize.

Thank you for taking the time to read this.

Managed_Power_Strip.ino (8.93 KB)

This is from the webpage you referenced...

  • Each one needs 15-20mA Driver Current

20mA * 8 = 160mA. The absolute maximum for the processor is 200mA. With some good luck and careful planning you may be able to drive 13 relays. There are various other limits that will likely restrict the number of relays to something less than 13.

The goal is 32 relays. 32 * 15mA = 480mA. There is a very high probability that 480 mA will severely damge your board.

I may need to get an 8 channel relay board with Optical Isolation

That is not necessary. But, given your goals, a transistor between the board and the relay is necessary.

Were I in your shoes, I would look for a better relay board.

So using transistors I can trigger each relay using only about 6.25 mA (x32=200 mA) on each pin? I apologize as I am terrible with transistors (I am trying to learn). Also I thought transistors only effected volts, not amps.

Arduino Mega 2560 Revision 3
has total IO current capability of 800mA, not 200mA.
Its limited to 200mA per Vcc & Gnd pin, and there are 4 each of those.

See the notes in section 30 of the data sheet for how that current must be spread between ports.
Here are the notes on sinking current, sourcing current is similar:

Notes: 1. "Max" means the highest value where the pin is guaranteed to be read as low.
2. "Min" means the lowest value where the pin is guaranteed to be read as high.
3. Although each I/O port can sink more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state
conditions (non-transient), the following must be observed:
ATmega1281/2561:
1.)The sum of all IOL, for ports A0-A7, G2, C4-C7 should not exceed 100 mA.
2.)The sum of all IOL, for ports C0-C3, G0-G1, D0-D7 should not exceed 100 mA.
3.)The sum of all IOL, for ports G3-G5, B0-B7, E0-E7 should not exceed 100 mA.
4.)The sum of all IOL, for ports F0-F7 should not exceed 100 mA.
ATmega640/1280/2560:
1.)The sum of all IOL, for ports J0-J7, A0-A7, G2 should not exceed 200 mA.
2.)The sum of all IOL, for ports C0-C7, G0-G1, D0-D7, L0-L7 should not exceed 200 mA.
3.)The sum of all IOL, for ports G3-G4, B0-B7, H0-B7 should not exceed 200 mA.
4.)The sum of all IOL, for ports E0-E7, G5 should not exceed 100 mA.
5.)The sum of all IOL, for ports F0-F7, K0-K7 should not exceed 100 mA.
If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater
than the listed test condition.

Someone else here posted that a similar relay board (maybe even this same one) wasn't taking anywhere close to 20mA, but was quite a bit less than that.
You may want to measure yours & confirm.

CrossRoads:
...has total IO current capability of 800mA, not 200mA...

Ouch. Sorry about that. I may have to reconsider my moniker.

After staring at a lot of numbers for the past two hours, I believe I am golden if I degrade from 32 Outlets, down to 31 outlets, using digital pins: 0-3, 5-9, 11-29, 38-39, and 42 rather than 18-49.

I realize I could use the analog pins for outputs to help cover my current constrains, however I opted not to as that would affect my string handling while retrieving the get commands from the buttons, and I can live with one less outlet.

If I use the pins above, I believe I avoid all other pins used by the Ethernet Shield. With the pins above, if I have all my outlets turned on, and they are actually drawing 20mA (vs 15) The test conditions #2 & #4 that CrossRoads mentioned will be at exactly 200mA. As the documentation states "[...]should not exceed[...]" I should be fine. If anyone can confirm that using these pins (0-3, 5-9, 11-29, 38-39, and 42) should allow everything to work properly, I would greatly appreciate it.

I would love to test the board that I bought to see if it actually draws 15-20mA, however it hasn't been delivered yet.

I'm not gonna stare at them, you could make a simple excel spreadsheet & put everything in total it up easy enough.

I've spent the last few hours trying to find out why some MAX7219's were not driving a display - finally dawned on me that power & ground had only gone to 1 of 4 chips. Must have got distracted at some point & stopped wirewrapping 6 wires too early...

CrossRoads:
Must have got distracted at some point & stopped wirewrapping 6 wires too early...

You too? Not too long ago I got distracted and failed to connect all the grounds. The most annoying part was, because the stupid thing was semi-functional, I was convinced the problem was software.

CrossRoads:
you could make a simple excel spreadsheet & put everything in total it up easy enough.

That is how I came up with the pins that I did, but after 2 hours of working on it, I could have easily made a mistake along the way... I'll just review the pins in a day or two after I lose my thought process.

Thank you for all your help, I'll keep updating this to see how it went. After all the other parts get delivered.

I also plan on setting up an additional LED in between the relay board and the Arduino board (one led per relay) to place on the project enclosure to display the status of the outlet in the server rack. Will wiring up an LED in series add any current to the pin? I don't believe this will add anything, but I would like to confirm before I blow the circuit.

Depends how you wire up the LED.
If in series, no current addition, but you do lose voltage. If you put a red LED in series, for example, and are sinking current, then you will end up presenting a low of ~2V to the card. Will that generate enough current thru the relay's optoisolator or whatever it uses to turn on?
Insuffucient data is available on the relay card to say if that would be an inpact.
On the other hand, adding a high brightness (the 5000+ mcd variety) LED in parallel, they would need only a few mA to turn on & provide indication of being on.