24
\$\begingroup\$

I want to control a siren speaker (has a built-in driver) with an Arduino.

The siren needs 12V and consumes about 480mA. The Arduino output pin is 5V and can source 40mA maximum.

I would like to use a transistor to switch the siren on and off. Is this an OK application for a transistor? I'd rather not have to use a relay or a SSR because I don't have any on hand.

Based off of those numbers I calculated my load (siren) resistance to be 25 ohms using Ohms law, R=E/I. (I'm using Amps, Volts, and Ohms as units)

$$\frac{12V}{0.48A} = 25 \Omega$$

I have found various calculations to determine what kind of transistor I need and I'm not quite sure which is the best one. One of them is like this:

$$h_{FE(minimum)} = 5 \times \frac{Load\;Current}{Arduino\;Pin\;Max\;Current}$$

Which gives me a minimum \$h_{FE}\$ of 60.

$$5 \times \frac{0.48}{0.04} = 60$$

This is where I get a little confused. I have a few transistors and their datasheets but I'm not quite sure how to read them. I have read many resources and I am just as confused now as before.

I know I should probably use a NPN transistor but would it matter if I use a PNP instead? Do the same calculations apply? I understand that the circuit changes, active high instead of active low, but are there any drawbacks to PNP over NPN?

The NPN's I have are PN2222A, BC337, BC547B and a BC517 darlington.

The PNP's I have are PN2907, BC327 and a BC516 darlington.

How would I go about choosing the right transistor for the job? I don't want to overload the transistor.

\$\endgroup\$
  • 1
    \$\begingroup\$ FYI, in your situation, you CAN simplistically use NPN's to switch PNP's and get your desired effect. Probably a little late to matter, but there you go. :-) \$\endgroup\$ – AbeFM Jul 22 '13 at 17:50
29
\$\begingroup\$

When choosing the right transistor for this job, first I'll eliminate the PNP transistors. They're a bit more complicated to use in your case. As you said, for a PNP transistor, active high becomes active low, meaning the transistor will switch on when you apply 0V from your Arduino, but it won't switch off when you apply 5V from the Arduino. You'll need to apply 12V to the base of the PNP transistor to switch off (VEB = 0).

Leaving PNP's behind, looking at the NPN's that you have availabe, only the BC547B (Ic = 100mA) couldn't handle the 480mA current that your siren needs. From the remaining 3 transistors, I'd choose the one that can handle the most current, just to be on the safe side. That would be the BC517 darlington, which can handle a maximum of 1.2A, more than enough for your siren.

Only now you'll have to worry about the gain of the BC517. But, because BC517 is a darlington transistor, it has a huge gain (hFE = 30,000), so you can easily switch on the transistor with a very small base current. If you chose to drive the base of the transistor with a 1KOhm resistor, you'll have a 3.6mA base current, which is sufficient for your purposes.

So the winner would be the BC517.

NPN circuit

\$\endgroup\$
  • \$\begingroup\$ Ok that explains my question very well, thank you. I guess it's better to have a much higher hFE than a marginal one and to err on the safe side of current load rather than cut it too close. I think I will need to explore this further and potentially look into PNP transistors despite what you mentioned. My siren actually has two positive leads, one for a steady sound and another for "yelp" sound. They share a common ground. Would this mean that I need the PNP configuration to be able to switch both positive leads? (should this be it's own question?) \$\endgroup\$ – darkadept Mar 31 '12 at 15:09
  • \$\begingroup\$ Do you have a datasheet of your siren? or a diagram. \$\endgroup\$ – m.Alin Mar 31 '12 at 15:14
  • 1
    \$\begingroup\$ @m.Alin I proposed an edit but in case it's rejected... "apply 12V to the base of the NPN" in the first paragraph should say "PNP", right? \$\endgroup\$ – CupawnTae May 11 '15 at 20:39
  • 1
    \$\begingroup\$ @CupawnTae Of course, you're right. Thank you for the edit :-) \$\endgroup\$ – m.Alin May 11 '15 at 20:41
  • 4
    \$\begingroup\$ One side comment. 'hFE=30,000' is the DC current gain in "forward active" mode, not in saturation mode. The BC517's datasheet uses a saturation mode beta of 1000--i.e., hFE(sat)=1000--so this would be a good starting point for your design. If the collector current is 400mA, then IB(sat) must be 400mA/1000 = 400uA, which the microcontroller should be able to source without any problem. R1's value should then be (VOH(min)-VBE(sat))/400uA, where VOH(min) is the microcontroller's minimum output voltage for a logic HIGH output, and VBE(sat) is ~1.6V according to the datasheet. \$\endgroup\$ – Jim Fischer Jul 10 '16 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.