Issue with PIC controlling Transistor.

Discussion in 'The Projects Forum' started by SirGr3mlin, Jun 13, 2018.

  1. SirGr3mlin

    Thread Starter New Member

    Jun 13, 2018
    7
    0
    Hi there guys, im still wrapping my head around electronics and transistors and such.
    I have a project im working on.
    I prototyped it on a breadboard and it worked perfectly. but.. i did a rookie move and didnt test with the LM78L05 in circuit.
    I want to drive a 12v buzzer in a project.
    In the example below, the pic is turning RA0 on and off. when its off my plan was to have the transistor turn on.
    then when its on turn the transistor off again. But i found once i put the LM78L05 in circuit the transistor would only stay on.
    I feel i might be missing something.. I did try using a PNP transistor in which then switches the NPN on and off and that worked. but is there a better way than having 2 transistors?

    Thanks for the help.
     
    • how.png
      how.png
      File size:
      6.4 KB
      Views:
      21
  2. ericgibbs

    Moderator

    Jan 29, 2010
    5,984
    1,131
    hi SG,
    Welcome to AAC.
    A BC557 is a PNP transistor, it requires a negative collector voltage.

    E
    A NPN transistor is required, connect the Base via a 470R resistor to the MCU output pin.
    Emitter to 0V and the Collector to your load.

    EDIT:
    Option.
    how.png
     
    Last edited: Jun 13, 2018
  3. SirGr3mlin

    Thread Starter New Member

    Jun 13, 2018
    7
    0
    Hi E, thanks for the reply and the welcome, and not calling me and idiot ;-)
    so wait what?... ... everytime i think in understand transistors i find them confusing me again. so... Nope im lost.
     
  4. ericgibbs

    Moderator

    Jan 29, 2010
    5,984
    1,131
    hi SG,
    Which bit do you have a problem with, we are here to help.
    Ask questions, but always give as much background info as possible. eg: details of the buzzer, voltage etc. value of the +v supply.
    E
     
  5. MaxHeadRoom

    Expert

    Jul 18, 2013
    16,222
    4,760
    I would look at logic level mosfet for interfacing with μp starting with the 2n7000
    Max.
     
  6. SirGr3mlin

    Thread Starter New Member

    Jun 13, 2018
    7
    0
    The supply is 12v, I didnt see your edit and pic before i replied, the buzzer has an LED indicator that is switched on separately. the are linked together via Negative, meaning i have to switch the positive going to the buzzer and led separately.
     
  7. ericgibbs

    Moderator

    Jan 29, 2010
    5,984
    1,131
    hi,
    Is it an old style electro-mechanical buzzer or the more common 'beeper' type buzzer.
    Even though one end of the buzzer and LED are linked, you could still use the simple circuit I posted.
    Do you have a circuit diagram showing the LED and buzzer.?

    E
    EDIT: Modify this drawing to suit your components
    ESP1 13-Jun-18 14.28.gif
     
    Last edited: Jun 13, 2018
  8. MrChips

    Moderator

    Oct 2, 2009
    17,123
    5,294
    What you need to know is the difference between a low-side switch and a high-side switch.

    upload_2018-6-13_9-29-27.jpeg

    Generally, when we think of controlling the power to a device, we immediately think of a high-side switch, i.e. we switch the power line going to the load. The switching transistor can go in either position, on the low-side or on the high-side.

    [​IMG]

    In the example shown, an N-channel MOSFET is used as a low-side switch, while a P-channel MOSFET is on the high-side. Because of the way the circuit performs, the control signals at the gate of the MOSFET are not the same in the two cases. One difference to note here is that a logic-high is required to turn ON the low-side driver.

    To keep this discussion short, it is less problematic to put the transistor on the low side. This is the most common method used.
     
    SirGr3mlin likes this.
  9. SirGr3mlin

    Thread Starter New Member

    Jun 13, 2018
    7
    0
    Hey all thanks for your help, i ended up just chucking a BC547 that goes out to a 2N4403, im going to revisit the circuit at a later date. but apart from a stray wire burning out the PIC everything seems to work with this configuration. I set it up on a breadboard first and tested it but, let me know if you see anything wrong with this:
    [​IMG]
    [​IMG]
     
  10. ericgibbs

    Moderator

    Jan 29, 2010
    5,984
    1,131
    hi SG,
    Did you intend posting an image.?
    E
     
    SirGr3mlin likes this.
  11. SirGr3mlin

    Thread Starter New Member

    Jun 13, 2018
    7
    0
    i did try.. lol i edited and tried again.
     
  12. Bordodynov

    Well-Known Member

    May 20, 2015
    1,924
    580
    There is an alternative way of containing only one item - a control gate driver. It can be controlled by TTL levels. Choosing inverting or non-inverting, you can connect the zoomer to the supply voltage or earth. There are small drivers.
     
    SirGr3mlin likes this.
  13. ericgibbs

    Moderator

    Jan 29, 2010
    5,984
    1,131
    hi,
    This is your circuit in simulation, looks OK
    Do you more details of X1 X2 load, resistance .. etc.??
    E
    Corrected my drawing error!
     
    SirGr3mlin likes this.
  14. SirGr3mlin

    Thread Starter New Member

    Jun 13, 2018
    7
    0
    I have ordered some p-Channel mosfets to
    I have done a bit of googling, is there a link you can share because im getting all sorts of hits here.
     
  15. SirGr3mlin

    Thread Starter New Member

    Jun 13, 2018
    7
    0
    load between x1 and x2 is 30ma max. there wasnt much data on the load but it looks to be around 25-30ma
     
  16. MrChips

    Moderator

    Oct 2, 2009
    17,123
    5,294
    As I said, it is more common to use an N-channel MOSFET. The N-channel MOSFET or NPN transistor switch goes on the low-side.
     
  17. Bordodynov

    Well-Known Member

    May 20, 2015
    1,924
    580
    See
    2018-06-15_08-51-04.png
     
Loading...