need help with more power to output's ? ? ?

hi everyone... im pretty sure i have a million questions floating around here now lol.

my question/s is about supplying more power to the pwm (and the digital out's once i get them working). i currently want/need 12 relays to switch on and off.

the problem is it seems there is only enough juice from the board to power 4 sometimes 5 on at the same time. they are rated at 5v, 106.4 mA each. (im guessing this is because (i think) usb output is limited to 500mA )

if i get a external power supply will this allow all the relays to work by allowing more power to be sent out of the pwm and digi outs (so not reaching the limit of 500ma from the usb)?

and will a 2.5amp (eg. be enough or too much? i dont want to fry the board but am going to need to set up 12 led's to run aswell.

also i will still need to control the arduino from usb... will it auto select the external as the source of power or will it switch to the usb?

thanks for any help peeps.

First, you don't want to be driving relays with PWM.

Second, you don't mention driver transistors. This worries me, because the AVR pins will only drive 40mA each. You CANNOT drive 100mA relays direct from the AVR pins.

Twelve relays at 100mA each is 1.2 A, so a 2.5A supply will do nicely. You can't have "too much" (within reason!)

Just make sure you connect the grounds, and don't forget those snubber diodes.

well no ideally i would like to be using the digital out's... but i cant seem to get them to work with max msp. (it's a mega and have no idea how i am going to get the digi's to work... i gave up and set the pwm's to 0 or 1.)

driver transistors? are you meaning the ... erm something like 2n2222 ? i used these before (on a previous prototype) and they stopped the whole thing working!!!???? avr pins? (sorry im kind of new to arduino's and circuitry)

snubber diodes? ? er,..... ok well thing's are grounded well. :D

thanks for the help :D

OK, I know nothing about MAX/MSP.

First, drivers. Unless the drive current for the relays is considerably less than 40mA you MUST use some sort of driver transistor for every pin / relay. There is probably a per-package current limit for the processor too.

Snubber diodes are used on inductive loads like relays to absorb the high voltage induced in the relay coil when the relay is switched off, and so prevent damage to the rest of your circuit.

well here’s the relay’s (it’s the 5v one and there’s 12)

i followed this

before and it only allowed one relay to work (there was 4 separate 2n2222’s)… without them in place (the 2n2222’s) all four worked?!?

do i need the resistor in place before the transistor in the diagram?

also why does the diode bypass the coil? then go to the relay? i only want the arduino to power the switch coil. the current going through the gated part is from and external source and will not be going to or from the arduino.

thanks again for the help… at some point im sure all this electricity stuff will make alot more sense lol.

OK, the relay "spec" was pretty useless - it didn't give the coil resistance.

The resistor on the base of the transistor is to limit current.

The diode across the coil is the snubber diode. It doesn't bypass the coil, it is there to absorb the back EMF when you turn the relay off. When operating, the coil prodces a magnetic field which operates the relay contacts. When power is removed, the field collapses and induces a current in the coil in the reverse direction (back EMF) which could damage the circuit. The diode absorbs the spike.

I don't know why your circuit with transistors didn't work, but I certainly don't recommend trying to power a relay directly off the AVR, so I suggest you persist.

Have a look at my totorial pages to help you get things straight in your mind:-

and :-

I know it says motors but the first bit is about driving relays.

ok this may be because it's so early... but... looking at this:

do i need an additional 5v supply for the relays? ? ?

so the wiring should run 5v supply > relay (diode around the relay) > transistor > ground (arduino) and from the arduino > resistor > transistor > ground (arduino) so it could be considered 2 separate flows?

i'm guessing that the transistor is like a mini relay? is this correct? and the diode just stops a surge of power the wrong way? the resistor's just ... erm.... resist ... or regulate the amps going to the transistor?

i need to go do some stuff today but when i get back i will make a circuit diagram and post it. lol... better than my explanation.

also if someone could let me know what sort of resistors and transistors and diodes i need it would be great!

once again thanks for all the help :D

do i need an additional 5v supply for the relays? ? ?

There is usually enough power from the USB connection so you don't need and extra supply. It depends on how much the relays take, the USB can supply up to 500mA.

Resistors limit the flow of current into the base of the transistor to stop them from blowing up.

Diodes to short out the back EMF when the relays switch off.

Transistors, a bit like a really but think of it as a current leaver.

Parts not too critical. Transistor BC183 diode 1N400x (where x = 1 to 6), but lots of other parts will do.

will this work? (i should also mention that there will be 12 relays (coil activation at 5v 100 (and something)mA, but i only put 2 in diagram for reasons of laziness :D )

it's a bc183 transistor, with a 200 resistor (so it should limit to 200 mA right?) and the grounds are sent to the negative on the dc supply for the relay coils? (creating a loop) i would rather they went to that than the arduino.

the 200 means 200 ohms, so no its does NOT necessarily mean it will limit things to 200MA. Which, by the way would be 4 times the current that an Arduino pin can provide - meaning it will blow out the Arduino!

the formula for calculating the base current limiting resistor (which is what that is) is as follows:

R (in Kilohms) = (5-.7) / 30ma R = 4.7 / 30 R = .156 Kilohoms, which is 156 ohms. You can use the next larger standard size of 220 ohms to safely provide current limiting.

With 220 ohms, the current from the Arduino pin would be: I (in milliamps) = (5-.7) / .22K I = 4.7 / .22 I = 22 milliamps

Twelve relays driven with this transistor circuit would then draw I (total in milliamps) = 12 * 22 I (total) = 256 milliamps - which can be safely drawn from the USB port alone. BUT since the total current will be that PLUS the current needed to actually power the relays themselves, you are UNLIKELY to be able to power all that from the USB port. Thus you should use an external 5V support for the relays.

I hope that helps! Mark

By the way, I always push my students on this point - get in the habit of drawing and sharing COMPLETE schematics rather than excepts or snippets. Until you are more experienced with this you are likely to accidentally leave out an important detail!

On your most recent post you gave a partial schematic. On that one, the 200 resistors can be 200 ohms or as calculated above 220 ohms.

BUT you need to connect the - side of that 5V supply to the Arduino's ground to make the circuit actually work.

good luck!

I hope to see your completed project posted :) Mark

hi, here's the complete diagram. as in note's please ignore the rectangle over lapping it.

will grounding the extra to the arduino mess it up? or should i have it as in diagram and send the ground's from the transistors to the dc power supply (for the coils) AND the arduino? (im worried it will melt it or keep tripping the saftey on the laptop (or will it just take all the extra through usb? im guessing it would be best to ground it to the one for the power on the board)

once again thanks alot for all this help :D

im thinking of etching it as soon as i can get the parts and will post pic's up :D