-3
\$\begingroup\$

***Technical question, not a wiring problem.

I am building a bicycle alarm system and I'm a little stuck on the alarm output. I wonder if I am approaching this problem wrong.

My alarm piezo technically is a 12 volt device but it works well on 9V.

My device is battery operated with a large 9 volt battery pack. The system is driven by a PIC32 microcontroller.

The kind it is is not important, but its a 3.3V device, so its GPIO pins can only output 3.3V and don't supply much current, so obviously you would not want to power the device using a gpio. HOWEVER I was thinking I could use the gpio to signal a transistor or a MOSFET to switch on the 9V supply. The alarm just needs a 9V power supply to emit a really loud sound.

I have worked very hard trying to achieve this.

First I tried some 2N3904 transistors and also some 2N3906s. The current requirements are just too high and they both got burned up.

Next I tried a MOSFET, the IRFZ44N specifically. I selected this MOSFET from DigiKey thinking it would be good because it can handle so much current.

HOWEVER I can't seem to get it to give more voltage than my gpio! My gpio is 3.3V and the MOSFET won't output more than 3.3V.

To be clear this is not a wiring issue! That is why I am not posting schematics. I am not concerned about wiring. What I really want to know though is whether this approach is flawed. Is it even possible to use a MOSFET or transistor to switch on a higher voltage using a smaller voltage as a signal? If so, then what is a good mosfet for this type of thing?

This is the speaker I'm using.

I don't know exactly what the current requirements are since there is no documentation on that but I would assume between 100 and 500 mA.

Also if you really want to know, my microcontroller is the PIC32MX795F512l all though I don't think that's really too important here.

If you guys need me to post any schematics, I will but I'm honestly just looking for general information here, not really a step by step guide on how to construct my circuit since I can definitely handle that part and most people wouldn't find that relevant to their own questions on this topic anyway.

\$\endgroup\$
9
  • \$\begingroup\$ first up, measure the required current for the piezo. Between 100mA and 500mA is pretty broad. Relay boards with transistors are fairly common - why not use on of these? As for a mosfet - there's zillions to choose from. You want one that is logic level and suitable for 3.3V on the gate. The IRFZ44 requires 10V on the gate to do anything useful - that's why it didn't work. The 2n3904 went up in smoke as you most likely exceeded it's current rating.. Which brings us back the the actual current the piezo requires. Engineers don't like to guess - hard numbers guide us. \$\endgroup\$
    – Kartman
    Commented Mar 18, 2021 at 12:20
  • \$\begingroup\$ Yeah that's probably a good point! I do have a dmm. I could try testing. \$\endgroup\$ Commented Mar 18, 2021 at 12:22
  • 2
    \$\begingroup\$ "To be clear this is not a wiring issue!" Perhaps but it may be a DESIGN issue. How is anyone here to know how you have this hooked up if you don't post your schematic? \$\endgroup\$
    – jwh20
    Commented Mar 18, 2021 at 12:45
  • 1
    \$\begingroup\$ There are right ways to use a transistor to switch a 9V supply using a 3.3V signal and there are (very) wrong ways to attempt to do that. We need to know which way(s) you tried in order to help you (although I'm almost certain that you're attempting 'high-side' switching with a single transistor, given your description of your results). Show us your schematic. \$\endgroup\$
    – brhans
    Commented Mar 18, 2021 at 12:48
  • 2
    \$\begingroup\$ @user3308807: A MOSFET is a transistor. It is right there in the name: metal oxide semiconductor field effect transistor. \$\endgroup\$
    – JRE
    Commented Mar 18, 2021 at 15:32

2 Answers 2

2
\$\begingroup\$

Yes, a BJT (bipolar junction transistor) or a MOSFET (metal oxide semiconductor field effect transistor) can be used to switch 9V from a 3.3V signal. It is done every day in approxiamtely 5 gazzilion devices. You just have to do it right.

From the descrption, you are doing something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

That circuit is known as a source follower. As you have found, the voltage at the source can never be higher than the voltage on the gate. That's why you can only get 3.3V to the buzzer.

What you need to do is this:

schematic

simulate this circuit

That is called a low side switch. It will work properly, and deliver nearly the full 9V to the buzzer - if the MOSFET is a logic level MOSFET that can work with 3.3V on the gate.

There are similar problems when using bipolar junction transistors (BJTs) - the things you are calling just "transistors."

If you have an NPN connected this way, then it is called an emitter follower, and like the source follower will not deliver more than the base voltage to the buzzer:

schematic

simulate this circuit

For the NPN transistor to work properly, you have to move it to the low side as well:

schematic

simulate this circuit

\$\endgroup\$
2
  • \$\begingroup\$ Good presentation!. Rule of Thumb = Always Invert with high current switch that is open loop. High Side switches always need to consider level shifting switch (CE) and again inverting, with overall non-inverting with 2 stages. Emitter or Source followers only work well with Op Amp negative feedback and Vcc higher than your output. \$\endgroup\$
    – D.A.S.
    Commented Mar 18, 2021 at 17:35
  • \$\begingroup\$ Thank you so much for this. So it was my mosfet. I had the wrong specs and your assessment that I was doing an emitter follower was correct which i know is ironic. I really wasn't looking for somebody to help me debug the design but I do appreciate everyone's insistence upon doing so because it DID help. :/ \$\endgroup\$ Commented Apr 20, 2021 at 19:27
0
\$\begingroup\$

schematic

simulate this circuit – Schematic created using CircuitLab

Why not a 2N3904?

  • beginners think hFE the linear current gain will work also as a switch but this is false. So degrade the hFE 80 to 90% or use 20% or preferably 10% of hFE and the 2N2904 has good speed but not as much hFE as the PN2222A
  • too large Rb is the biggest failure and Vce becomes too large then Ic*Vce=Pd burns up at 220'C/W the thermal resistance value for Rja
  • too large a load current for Rce = Vce(sat)/Ic (@ Ic= 10x Ib)
    • 2N2904 = 0.4V / 50mA = 8 Ohms
    • PN2222A is 4 Ohms? = (let me double-check datasheet) Nope it's 2 Ohms when driven properly.
      • Vce(sat)/Ic=Rce= 0.3V/150mA= 2.0 Ohms
        • and Rce = 1.0V/500mA = 2.0 Ohms at Ib=50 mA
        • from Fig 4 in onsemi specs if Ic/Ib= 100, Vce(sat)[nom]= 300mV/150mA = 2 Ohms [nom] but 4 Ohms worst case
        • also Rce= 1.0V/500mA = 2 @ Ib= 10 mA or Ic/Ib=50 and Pd = 500 mW burning up but if Ic/Ib=10 then at 500mA ,
          • Rce= 210 mV/500mA = 420 mOhms [nom] and Pd= 105 mW runs OK but warm at at 220'C/W x 105 mW= 23 'C rise above ambient.

The bottom line for small TO92 transistors

  • For a 9V battery always choose the PN2222A with the A suffix for a 2 Ohms switch that drops to 420 mOhms ([nom] not worst-case or use a 1 Ohm FET and not the lowly 2N7000 which might work but is 1.9 Ohm nom and 9 Ohms max. - Or choose a lower RdsOn FET with logic Level thresholds ~ 1V if using a 3.3V uC to drive it.
  • why is the PN2222A better? Its a slightly bigger chip with higher hFE and when used as a switch ALL transistors work best when using about 10% of the maximum hFE for Ic/Ib.
  • SOME more expensive transistors have superbeta or hFE > 500 and thus can be used with 10% or hFE(sat)=50 or Ic/Ib=50.

- so for high(ish) switching currents on BJT's always use 10% of the maximum hFE for Ic/Ib

I am pretty sure Jim Williams would agree.

This becomes a trivial switching problem for “logic-level power FETs”.
However, the ones you chose are not, nor are the NPN's and your base R was probably too high.

Vgs must be at least 2x Vgs(th)or Vt max to enable low RdsOn.

Yours is the standard FET Vtv 2 to 4 V thus needs 8V min. So choose one with Vgs(th) << 1.5V

Consult with DK tech support if unsure how to pick in SMT for better options.

Regarding Vbat resistance, this depends on quality and condition. A new alkaline 9V battery may have a pulsed short circuit current of > 1A or < 9 Ohms but this quickly rises as the state of charge drops and ends up being 10 x this amount while still useful but almost depleted at 8V.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ The OP's note that "My gpio is 3.3v and the mosfet wont output more than 3.3v" to me looks like a dead giveaway that they're attempting to high-side switch without an appropriate driver. Even a logic-level power FET won't help there... \$\endgroup\$
    – brhans
    Commented Mar 18, 2021 at 14:02
  • \$\begingroup\$ correction @brhans the FET specified is a low side switch Nch . Perhaps he is using a low side switch incorrectly on the high side which will never work. \$\endgroup\$
    – D.A.S.
    Commented Mar 18, 2021 at 14:21
  • 1
    \$\begingroup\$ @TonyStewartSunnyskyguyEE75: From the description, that's exactly the problem: trying to use a low side switch on the high side. \$\endgroup\$
    – JRE
    Commented Mar 18, 2021 at 15:33

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.