Arduino MEGA current draw predicament

I would use 6 TPIC6B595 latch/drivers...

I was looking at those, but there were two problems I thought I may have with them.

First of all, I can't seem to find any decent tutorials for these 595s. They are fairly new to me and I would have to figure out how to convert a numerical value to a specific pattern of I/O to drive each of the relays. I also already have the code figured out for my original idea that didn't require these 595s.

Another issue I just thought of was that I'm using a ChronoDot for the time keeping, and it uses those same clock and latch pins that these 595s would otherwise seem to use and I'm not sure if they would like to share with the ChronoDot.

Relays can isolate mains from your device, but you need good quality or special relays to do it safely. Some relays are safe now but not after a month or a year(s).

There are driver chips for your problems. Like ULN2003 and so on, or 2N7000 is driver fet for making it easier for the CPU.

Hi, look at some existing relay boards that you could definitely drive from a MEGA:

Like these: http://goo.gl/3mXu0

Look at the schematic for one here: http://goo.gl/Nnt9g

These only need 2 to 3 ma per pin for the Arduino to "sink". They include an LED per channel so you can test easily.

NOTE: These are "Active low" controls, for good reasons. See the ArduinoInfo WIKI: http://arduinoinfo.info (Relay info here: http://arduino-info.wikispaces.com/ArduinoPower#4-8)

Information on Arduino Pin Issues here: http://arduino-info.wikispaces.com/ArduinoPinCurrent

The seconds display will change 86400 times a day. If this is going to run 24-7 for a long time, you may want to use Solid State Relays for the seconds digits (or at least the 1-second digit). Example here (but you could use smaller ones): http://goo.gl/QhgNO

Can you point to the lamps you will be using? Where can you get them?? Sounds cool...

Let us know who you are doing, feel free to ask more questions...

DISCLAIMER: Mentioned stuff from my own shop...

Mega can handle 800mA - 200mA per VCC or Gnd pin.

DC Current per I/O Pin ................................................ 40.0mA
DC Current VCC and GND Pins................................. 200.0mA

There are limits within any one port:

  1. 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:

ATmega640/1280/2560:
1.)The sum of all IOL, for ports J0-J7, A0-A7, G2 should not exceed 200mA.
2.)The sum of all IOL, for ports C0-C7, G0-G1, D0-D7, L0-L7 should not exceed 200mA.
3.)The sum of all IOL, for ports G3-G4, B0-B7, H0-B7 should not exceed 200mA.
4.)The sum of all IOL, for ports E0-E7, G5 should not exceed 100mA.
5.)The sum of all IOL, for ports F0-F7, K0-K7 should not exceed 100mA.
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.

  1. Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady
    state conditions (non-transient), the following must be observed:

ATmega640/1280/2560:
1)The sum of all IOH, for ports J0-J7, G2, A0-A7 should not exceed 200mA.
2)The sum of all IOH, for ports C0-C7, G0-G1, D0-D7, L0-L7 should not exceed 200mA.
3)The sum of all IOH, for ports G3-G4, B0-B7, H0-H7 should not exceed 200mA.
4)The sum of all IOH, for ports E0-E7, G5 should not exceed 100mA.
5)The sum of all IOH, for ports F0-F7, K0-K7 should not exceed 100mA.
If IOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current
greater than the listed test condition.

So if you have all 8 pins in a port sinking/sourcing 10mA, 80mA total you'd be fine.
Splitting your 320mA across four 200mA capable ports, you'd be fine.
etc.

I'd also consider replacing the bulbs with ultrabright LEDs instead. Using 15,000mcd whte LEDs drawing only 20mA each, arranged as strings of 3 or 6 or 9 per digit and driven from 12V with ULN2803 as the buffer, would be quite bright also and use less energy.

CrossRoads:
I'd also consider replacing the bulbs with ultrabright LEDs instead. Using 15,000mcd whte LEDs drawing only 20mA each, arranged as strings of 3 or 6 or 9 per digit and driven from 12V with ULN2803 as the buffer, would be quite bright also and use less energy.

This clock is more of a novelty. The incandescents and relays are a key part of the design.
Also, the input waveform for these frosted 130v 60Hz bulbs will be chopped thanks to some household light dimmer(s). This will maintain a comfortable brightness for a kind of warm look.

terryking228:
Can you point to the lamps you will be using? Where can you get them?? Sounds cool...

The bulbs I'm using are the 130V 20W frosted T6-1/2 w/ intermediate base (E17)s.
I found mine on Ebay.

I've seen LEDs in ping pong balls for similar effect.

Quick update,
Now that I have everything in hand, I decided to not include the planed seconds unit on this clock. I might instead replace it with a small pair of LED seven segment displays. If not that, then perhaps a single LED "ticker" that blinks every second.

Just to be sure, if I put a combined 580mA worth of LEDs and opto-isolators on the I/Os of the MEGA with less then 20mA each on each I/O pin, everything should be fine, right?

As long as you don't exceed the per-port current limits.

I would use 6 TPIC6B595 latch/drivers...
I was looking at those, but there were two problems I thought I may have with them.
First of all, I can't seem to find any decent tutorials for these 595s. They are fairly new to me and I would have to figure out how to convert a numerical value to a specific pattern of I/O to drive each of the relays. I also already have the code figured out for my original idea that didn't require these 595s.
Another issue I just thought of was that I'm using a ChronoDot for the time keeping, and it uses those same clock and latch pins that these 595s would otherwise seem to use and I'm not sure if they would like to share with the ChronoDot.

The TPIC6B595 is the same as a 595 serial register, but has a built in LED/relay driver ( like a ULN2003 )

You can use any 3 pins to drive them, using Shiftout, and to set up the segment pattern I define a lookup table ( before the setup ) which looks like this for the pin connections I use from the TPIC to the segment :-

#define latchPin 11  // rck  the pin you choose to go to the latch input of the TPIC
#define clockPin 10  // sck   the pin you choose to go to the clock input of the TPIC
#define dataPin 13  // ser in   the pin you choose to go to the serial  input of the TPIC

const byte digitTable [10] = { // the patterns of segments for numbers 0 to 9  
 B11101110, B00101000, B10110110, B10111100, B01111000,  
 B11011100, B11011110, B10101000, B11111110, B11111100};

// and then at the end of the sketch when you want to display the data you just send something like :-

 digitalWrite(latchPin, LOW);  
 delay ( 50 ); 

  shiftOut(dataPin, clockPin, MSBFIRST, digitTable [ mintens ] );  // you can also have seconds if you like, 
  shiftOut(dataPin, clockPin, MSBFIRST, digitTable [ minunits ] );
  shiftOut(dataPin, clockPin, MSBFIRST, digitTable [ hourtens ] );
 shiftOut(dataPin, clockPin, MSBFIRST, digitTable [ hourunits ] );

 digitalWrite(latchPin, HIGH);
  delay ( 50 );

The TPIC has a latch, so you dont have to refresh the display ( and you can take a video of the display without the scrolling bands moving down )

Ok, slight problem.
I just finished all the main circuitry for the build with only the incandescents left to wire up.
I've been running my example sketch throughout the build, it ran through each segment's output one at a time with no problems.
Now here's the problem I was worried about, I edited the sketch to turn on each output one at a time with an interval of about 200ms. After a very brief time with all 28 I/Os on, the 5v regulator overheats and shuts down. :frowning:

I figured that the problem could very well be because I'm running the poor thing off Arduino's maximum rated voltage of 12 volts. So I swapped the 12v supply for a 9v one. Results were better this time in that it did not overheat as quickly, however I shut it down after I clocked the PCB temperature underneath the regulator at a blistering 185F (85C). I don't really have any wall power supplies under 9v, nor would I like to use a second one next to the already necessary 12v one, so I'm now wondering if there might be an alternative regulator I could use that would accept the 12v input.

On the other hand, the ATmega2560 seems to accept the LED and opto load just fine.

Edit:
I just found myself a regulated 5v power supply. I paired it up with the 5v rails on the Arduino and everything seems to be getting along just fine... For now. :grin:

Yes, 5V wallwarts are nice!

I have some 7.5V, 1000mA wallwarts for the times I want to use the barrel jack connector.
Not sure where I got them from tho, I don't see them at the site I expected.

Final update:

I got everything wired up and it all seems to work well. All I need to do now is add a bit of wood putty along with a few other touch ups, and its on to programming! :grin:

Thanks everyone for the assistance. I've attached a quick photo of the project in its latest state.

That looks cool, and very retro, it would look good in a juke box type case , well done

I remember old glowing wire 7-segment displays. They did look good, but in use they burnt out their segments, so I hope you can easily change your lamps/segments when they burn out.

CrossRoads:
Yes, 5V wallwarts are nice!

I have some 7.5V, 1000mA wallwarts for the times I want to use the barrel jack connector.
Not sure where I got them from tho, I don't see them at the site I expected.

A bit off topic, but I have had some success getting more unusual AC adaptors from surplus stores. For example, American Science & Surplus usually has a number of odd ball wall warts on offer.

I don't get the impression these are switcing supplies. They are generally very low current too. I'll bookmark the page, but I don't expect to purchase much there.

True most AC adaptors currently on offer probably won't be switching type, although there have been times when a number were. However, I know the one marked as such, 40812 which is 12 VDC upto 2 A, is an actual switching power supply for $7.95. There's also an inline switching AC adaptor with the same ratings, for the same price.

There are also some larger regulated or switching power supplies (the first three listed on the linked page). An upto 2 A power supply with six voltage levels from 3 VDC to 12 VDC , that I use in my workshop (the 7.5 VDC setting works well with Arduinos). A 12 VDC 4.16 A rated switching power supply on clearance for only $10.00. Although it does need an IEC-60320-C7 cord, but those aren't too hard to get. Finally there's a 12 VDC switching power supply that can supply a maximum of 4 A with four pre-made cables. It's a little different in that the connections are configured as four distinct outputs each limited to up 1 A, but they of course can be tied together on a terminal strip or what have you.

I've been patronizing this store since I was a kid. Although not primarily for electronics; mostly for laboratory equipment, hand tools, miltary surplus, and just interesting and unusual stuff. While the product descriptions can be quirky and pun-laden, they are truthful about what they sell including being up-front about defects that caused a given item to be surplused. Also note, some of their inventory isn't surplus but those prices tend to be competative as well.