# What kind of transistor do I need to amplify an Arduino's PWM outputs?

I'm planning on having 30 incandescent lightbulbs be controlled by my arduino uno on 3 channels (10 bulbs to a channel in parallel). I've used the arduino before to control a number of red, green and blue LEDs - I used a simple schematic using three transistors. I'm just not sure which transistors to get this time considering I'm running the bulbs from 120vAC and not a smaller DC power supply.

Here's a schematic for what I want to do - http://i.imgur.com/BzhM3.png

I've tried controlling just one incandescent bulb with an MJE3055T transistor but all I was able to do was slightly dim the bulb, not turn it off completely. I doubt the power rating was enough, so I tried wiring two transistors together in a Darlington configuration without any luck, nothing happened at all.

I know I should use more than one AC supply to run this - does that mean I'll also need more than 3 transistors?

Do I just need a transistor with a higher power rating? Would this be the right one?

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&itemSeq=106696146&uq=634559326654518595

Thanks!!!

Dennis

• Neither link works for me. Also, if you are using AC to power the lamps, a simple transistor switch may not yield the best solution. – B Pete Nov 4 '11 at 1:34
• A safer/simpler approach would be to use some bright LEDs. Eg. thingm.com/products/blinkm-maxm.html – Toby Jaffey Nov 4 '11 at 15:55
• Can you provide an update on what you have learned so far so we can help you to achieve what you want to. There are good answers (apart from "Use LEDS" etc). We can help. we need to know which way you are going so far. Just pouring information into the void is not very productive. eg it IS possible to switch the lamp load that you specify using an Arduino and to do it safely and moderately cheaply. What are the lights going to be used to do? – Russell McMahon Nov 6 '11 at 19:02
• What is the maximum rate that you wish to turn things on & off at? eg is this to follow the beat of music or Disco or will no more than mains cycle time switching be OK? This answer makes a major difference to which solutions are potentially suitable. – Russell McMahon Nov 7 '11 at 16:24
• The lights are going to be used in conjunction with an LED array I'm building in a live musical performance next spring. – whataniceguitar Nov 7 '11 at 16:35

STOP

Your enthusiasm is commendable but you are trying to do something that is potentially lethal. Before you use 120 (or) 110 VAC you need to understand what you are doing.

The transistors need DC to operate. As Oli says, a TRIAC will work for AC and isolation is "a good idea" at least.

1. What voltage are you actually using so far?
2. Are you using AC or DC at present?

If you are using 120 VAC with a 2N3055 as you now state, and no rectification (which you may be doing but have not mentioned) then your promises are worse than useless. 120 VAC ~= 160 V peak is far above a 2N3055's rated voltage.

Konsalik's solution is a good one. It is not the only way but it is a useful solution, the cost is relatively low and it provides proper isolation.

• This diagram is copied directly from @Konsalik 's answer.
It provides a good electronic solution with

• isolation,
• ability to handle substantial power and
• ability to be driven well and safely by an Arduino or general purpose microcontroller.

While he shows it as switching only 12 VAC it is suitable with almost no changes for operation of 110 VAC or 230 VAC.

His suggested MOC3023M TRIAC driver is available from Digikey for under $1 in 1's. This is a "random phase" TRIAC driver which means it will turn on the load as soon as it receives a turnon signal. You can also get "zero crossing" drivers which turn on the load when the mains voltage is at the zero voltage point. This decreases electrical interfenece from switching the load BUT means you can only get integral mutiples of a half wavelength turn on period. Which sort is best depends on your application. In many cases zero crossing switching is OK and is preferred if switching at zero crossing points is an acceptable limitation. "Random phase" switching is useful for fastest possible turn on control. The MOC3023 driver requires 5 mA drive current, the lowest in its "family" of members, making it a good choice for driving with most microcontrollers. The MOC3023 driver has a 400 VAC output rating, making it suitable for both 100 VAC and 230 VAC operation. Example only: A potentially good TRIAC is the ST2050H TRIAC costing under$1 at Digikey.
It is rated for 600 V peak operation, 20 A continuous operation.
It requires 50 mA gate drive which is 'a bit heavy' but accommodated OK by the driver.
There are less well rated TRIACS at a somewhat lower price that would 'do he job,' but this one appears to be more robust and capable than many at an OK price.

• As soon as I read your response I stopped experimenting with the one bulb. I realize that using mains is potentially lethal in any case, and while proceeding I used gloves, a serious pair of goggles and a remote switch. I may be inexperienced, but I am not stupid. I'm currently in the process of drawing up a new schematic employing triacs/relays, proper grounding, better safety precautions, etc. I appreciate everyone's comments, and have followed up with my own research into mentioned components so as to come back with something that hopefully won't prompt any arguments about etiquette. – whataniceguitar Nov 7 '11 at 16:32
• @kortuk - my TRIAC related answer is simply an expansion and comment on what Konsalik posted initially. His solution is an extremely good one in the circumstances. Would you please transfer the 100 bonus to him. – Russell McMahon Nov 8 '11 at 14:53
• @whataniceguitar - I'm pleased that you are still alive and that you took notice in the way that you did. (really). It's good that you seem to be doing this well and responsibly and that we are now all "on the same channel". I usually don't have too many complaints about etiquette and I'm usually the one trying to stick up for the little guy (as you may or my not have noticed in recent answers). Trying to get dead little (or large) guys to take notice is such hard work that some yelling seemed in order. Now all is well you should find me useful and not too hard to deal with :-). – Russell McMahon Nov 8 '11 at 14:59
• @RussellMcMahon, the 100 bonus was to account for the error that happened when I incorrectly used the flagging system. It has nothing to do with validity of answers. Bounties cannot be changed in any condition. I did note to you in chat that I would be doing this a day ago. – Kortuk Nov 8 '11 at 19:43
• @RussellMcMahon, I wasn't able to find the triac you suggested but found this on digikey which is comparable - would it be suitable? search.digikey.com/us/en/products/BT137X-600,127/568-3662-ND/… – whataniceguitar Nov 10 '11 at 4:58

Playing around with the mains is a good way to get killed. That's why there are numerous regulatory agencies that dictate what one can and cannot do with mains voltages. Wiring directly to low-voltage controllers using underrated transistors would not be kindly looked upon by UL (or any other regulatory body) for that matter.

You clearly don't have the technical skill to safely design primary-side circuits, so DON'T.

Get rid of your transistors and replace them with safety-certified solid-state relays.

Part number 84137000 is rated for up to 240VAC, 10A per relay, and can be controlled from 3-32VDC. Isolation is inherent (4000V).

Make sure each string has a fuse! (A 5A slow-blow would be a good starting point).

PWM-ing regular light bulbs isn't going to give you much effect. There's quite a bit of latency in the tungsten filament, so the bulbs will always fade in and out slowly (compared with LEDs).

If you want finer control of the lights, consider the 84137200 (which doesn't wait for zero crossings to fire) - same data sheet.

• Doesn't wait for zero crossings, when I sleep I will have nightmares about the EMI. – Kortuk Nov 4 '11 at 19:11
• As will I. I have no idea what OP is trying to achieve, mind you. The zero-crossing 84137000 works beautifully in my lab. – Adam Lawrence Nov 4 '11 at 20:44

We used the following circuit for electrical design last semester:

Note that this is for a 12VAC supply as our professors were concerned about safet (As should you).

The "R?" values were for us to calculate.

The circuit has an opto-coupled triac (MOC3023) to privide isolation from the MCU.

• Nice solution. The opto isolator happens to be a good one - low drive current needed and good output voltage rating so it can be used for 110 VAC or 230 VAC systems. Optocoupler is "random phase" so allow fastest turn-on response tme. Using a correctly rated TRIAC and changing a few value allows this to work well on "Mains" loads. – Russell McMahon Nov 9 '11 at 10:48

There is no regulatory authority in the world that would allow this circuit to be used.

• Mains is connected via a low impedance load to semiconductor device that breaks down under reverse voltage in a non-guaranteed manner. The device is rated at 60/>160 = less than 40% of the peak forward voltage that will be experience.

• ** This is NOT a potentially lethal design.
It IS a lethal design as it stands.

• There is an easily achieved and probable high current failure path via a semiconductor device from mains to a low voltage controller (Arduino).

• The switching component being used is fundamentally unsuitable for the task and can be expected to be destroyed at any moment when operating.

• If one transistor failed it could cause all others to fail - by sending mains via the (by now a smoking ruin).

A bipolar transistor is not intended for use with AC.

• A bipolar transistor can never be used successfully as an AC switch.

• A 2N3055 is a bipolar transistor.

Even if a suitable type of switching component was being used in this circuit it would need to be *properly voltage rated.*

• A 2N3055 is massively under-rated for mains use - even after rectification to DC.

• Rating a component to withstand slightly more than mains peak voltage will result in a marginal device which will fail in a short period of operation.

• Mains rated components need to withstand surge voltages and substantial voltage spikes. A minimimum of mains peak + 50% woud be wise - and that does not deal with noise spikes.

• A 2N3055 has 0V AC rating ie it is not rated for AC switching at all.

• A 2N3055 is rated at 60 DC

• 120 VAC =~160+ V peak. A component rated at 240 DC would be wise. More ie better. So

• Even if mains was rectified to DC for switching, a 2N3055 is underrated voltage wise by a factor of about 4:1.

• The reason I posted this was to make sure it WAS safe. I may not be the most experienced when it comes to electronics, but I'm not going to mess around with mains without circuits that have been properly critiqued by my peers. I've spent my time since making this post doing research into using mains, relays, traics, and several other components that are relevant to my project. Above is a PROPOSED SCHEMATIC, not a picture of me trying to kill someone and or myself. Your comments have been helpful, but also extremely rude and patronizing. There is no need for that, it helps no one. – whataniceguitar Nov 7 '11 at 16:13
• @whataniceguitar - my aim was to keep you alive. If that's alive and annoyed instead of dead then so be it. There wasn't enough dialog happening fast enough to be sure youwere listening - and your answers specifically stated that you HAD been connecting mains as shown and that you were sure you were not going to kill anyone. Rather than let Murphy prove you wrong, stronger efforts to get your attention seemed the best approach. Now we all seem to be on the same wavelength we can help you do what you want with a reasonable hope of you being alive to benefit from our efforts :-). – Russell McMahon Nov 7 '11 at 16:22
• Fair enough. I'm here to listen. – whataniceguitar Nov 7 '11 at 18:15

You cannot use a 3055 bipolar transistor to control mains AC. As mentioned, this is not safe at all.

I would really recommend either using lower voltage bulbs, or buying some pre-built module that can do what you want.
Here is what looks like quite a well built/documented/priced isolated 8-channel Solid State Relay module that can switch up to 2A per channel (I would keep it to 2 bulbs/1A per channel though, as 2A is absolute maximum) and can be driven from your Arduino.
I would go for this option and have far less worry about nasty things happening.

I will leave this info below in place for reference:
You would have to use something suitable, e.g. a triac like the BT139 or similar. Also if you are using mains AC you need isolation, an optotriac like the MOC3011 (or similar) can be used to drive the base of the larger triac from an Arduino pin.
Isolation is very important, for safety of yourself and the Arduino - do not use the circuit shown in your question (the AC will swing negative and forward bias the transistor base collector junctions)

For PWM equivalent of AC you will need a zero crossing detector, and time the triggering of the triac according to how much of the cycle you want to be turned on.

Edit - I just noticed you want 10 bulbs in parallel on each channel. You will need to make sure the triac you choose can handle the current required. 60W at 120V = 0.5A for each bulb, giving 5A per channel. IIRC the BTB139 handles up to 16A, but you would need a heatsink as it would be dissipating a fair bit (check datasheet for graphs) You could also split the channels into e.g. 5 bulb lots.
Also, I get 1800W for 30 * 60W bulbs. How do you get 7200W? Are there more bulbs not shown on the schematic?

• That was pretty much over my head - I've been looking up what triacs actually are and I think I get the gist, although I looked at the datasheet for the BTB08 and was just totally confused, it's too mathy for me and I'm not experienced enough with electronic terminology to really understand it. Zero crossing detectors and optotriacs I've never heard of as well, but are trying to understand the principles of. Could you be more specific as to how to wire them together in place of transistors? – whataniceguitar Nov 4 '11 at 2:19
• As Russell says, you must understand this before proceeding. I would probably advise putting this one on hold till later. However if you want to give it a go still we can try to help as much as possible. Is there any reason you can't use, e.g. some lower voltage bulbs? (LED bulb, halogen, etc) – Oli Glaser Nov 4 '11 at 3:07
• You're right about the math being wrong - it would only be 1800W for the bulbs. Are you suggesting cutting the groups down to 5 bulbs per channel and having six triacs instead of 3? And yes, I definitely want to give it a shot - but in the safest way possible, which is why I came here. Thanks a lot for your help, both of you. – whataniceguitar Nov 4 '11 at 14:41
• @whataniceguitar - see edited answer, I think buying a prebuilt module or using low voltage bulbs is a good idea. – Oli Glaser Nov 4 '11 at 17:11