0
\$\begingroup\$

I have a 24 vac motor that is partially controlled by a limit switch, which shuts down the motor when the payload has reached its maximum distance. Using a Raspberry Pi, I'm trying to detect when the limit switch has been triggered. I've come up with the following solution, but am having trouble deciding if it's safe to run the 24 V directly into the base of the transistor or not. The two datasheets I've found for the 2n2222a transistor (one, two) do not have specific information regarding the maximum voltage or current allowed on the base of the transistor. Note that after the diode, in theory, the voltage is actually \$24\sqrt{2} = 33.9\text{ V}\$. In practice I've actually seen the voltage be 42 V. I think this is due to the motor and 120 µF capacitor, but not sure. At any rate, using 42 V and 100k ohms, we can calculate the current at the base should be about 0.42 milliamps.

Specifically then, what is the maximum voltage or current that can be applied to the base of the transistor in this circuit? Is this circuit safe and/or is there a better way?

  • The 10 µF capacitor is 50 V.
  • The 120 µF capacitor is 100 V.

enter image description here

\$\endgroup\$
13
  • \$\begingroup\$ You seem to be talking about a single phase AC motor. \$\endgroup\$ Commented Sep 30, 2021 at 21:55
  • 1
    \$\begingroup\$ Your circuit does not have "24 V directly into the base of the transistor". How quickly do you want the Pi to detect when the limit switch has opened? \$\endgroup\$ Commented Sep 30, 2021 at 22:09
  • \$\begingroup\$ Detection speed is not critical since the limit switch is instantly disabling the motor. The pi just needs to “catch up” with the event, preferably in under a second. \$\endgroup\$
    – wryan
    Commented Sep 30, 2021 at 22:19
  • \$\begingroup\$ I would suggest adding a resistor maybe in the 10K range across the 10uF cap, to guarantee the transistor turns off and stays that way during noise bursts. This resistor will decrease the transistor turn off time. \$\endgroup\$
    – Gil
    Commented Sep 30, 2021 at 22:22
  • 1
    \$\begingroup\$ @wryan If the motor has a run capacitor, it is single phase, not 3-phase. I suggest playing around with this circuit in a SPICE simulator (LTspice is free) so you can see how fast the transistor will turn off (motor stop condition). The 10uF capacitor and 100k base resistor combination will cause a transistor turnoff time of around 5 seconds. Gil's suggestion ensures the transistor turns off. \$\endgroup\$
    – qrk
    Commented Sep 30, 2021 at 22:37

2 Answers 2

2
\$\begingroup\$

Base to emitter junction behaves as a diode, so when you apply a current to it, it will limit voltage to the usual "about 0.6V".

The value you're looking for is "maximum base current" in the datasheet.

However in this case you want the transistor to be saturated, with very low Vce, so it draws 3.3V/1k = 3.3mA collector current and sets voltage on the microcontroller's input close enough to 0V. When it is saturated, you can assume hFe around 10, so that would need 330µA base current. Your 100k resistor value is about right, it will result in a safe base current, much lower than the maximum allowed value.

However the 10µF cap is a bit large, so there will be a delay between the limit switch acting and the microcontroller registering the corresponding level on its pin.

\$\endgroup\$
2
  • \$\begingroup\$ Using audio and visual cues, I can hear the motor shut down and see on the putty session when the microcontroller (mc) has detected the limit switch action. The delay appears to be definitely less than 1/2 second and maybe even under 1/4 second. The voltage only needs to drop to 0.6 (right?) for the transistor to switch. For our purposes, this is plenty fast enough because the limit switch is protecting the motor (shutting it down), and the mc just needs to “catch” up with the event. \$\endgroup\$
    – wryan
    Commented Oct 1, 2021 at 14:47
  • \$\begingroup\$ If it's fast enough, then no problem! For output level to change, ie reach half of 3V3, transistor needs to have Ic of half of 3.3V/1k, so 1.65mA, at this point it is not saturated, so if hFe is 100-200 that's 8-16µA in the 100k resistor, so 0.8-1.6V on top of Vbe and the FR107 diode, so you can round that to "a few volts". \$\endgroup\$
    – bobflux
    Commented Oct 1, 2021 at 14:54
0
\$\begingroup\$

I think I found the answer I was looking by talking to my Dad and also referencing the equation on https://www.electronics-tutorials.ws/transistor/tran_2.html. Once you have determined ß (Hfe) and found Ic in the datasheet, then you can calculate max base current.

enter image description here

From the datasheet, the 2n2222 Ic has max current of 600 mAdc. Because our transistor is acting as a switch, we want our base to be saturated, so ß = 100. Therefore the max base current can only be 6 mAdc. [600/100=6]

Since I've observed as much as 43 volts on the 100k resistor (between the diode and resistor), we know that no more than 0.43 mAdc will flow through the base.

Therefore this circuit is safe to use as is, at least from the current on the base of the transmitter.

\$\endgroup\$
7
  • \$\begingroup\$ No, this is not the maximum base current. This is the value of base current that will cause a given amount of collector current to flow. The true maximum base current is the amount of current that would cause damage to the transistor. But your result may be good enough for your purposes. \$\endgroup\$ Commented Oct 9, 2021 at 16:33
  • \$\begingroup\$ Beta is used when a transistor is an amplifier that always has plenty of Vce. When a transistor is a saturated switch then you want Vce to be very low then beta is not used. The datasheet shows a base current that is 1/10th the collector current when the transistor is saturated. \$\endgroup\$
    – Audioguru
    Commented Oct 9, 2021 at 17:20
  • \$\begingroup\$ @ElliotAlderson - Understood, but look at the value I used for Ic. According to the datasheet, 600ma is the maximum current that the collector can handle, therefore in this circuit, if you put more than 6ma on the base, would you not damage the transistor? I guess that depends on the collector’s source voltage and amperage capabilities. At any rate, if you know how to calculate the maximum base current, I’m all ears. The Phillips datasheet on electoschematics.com shows maximum dissipation of 500mW. Does that have anything to do with calculating max base current? \$\endgroup\$
    – wryan
    Commented Oct 10, 2021 at 18:16
  • \$\begingroup\$ electroschematics.com/wp-content/uploads/2009/04/… \$\endgroup\$
    – wryan
    Commented Oct 10, 2021 at 18:16
  • \$\begingroup\$ No, putting more than 6mA into the base would not necessarily harm the transistor. Suppose the circuitry connected to the collector could not possibly provide more than 500mA, or imagine that the collector was left unconnected. What damage would occur if you passed 7mA through the base? None. \$\endgroup\$ Commented Oct 10, 2021 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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