Simple diode and transistor circuit

Discussion in 'General Electronics Chat' started by jegues, Feb 1, 2014.

  1. jegues

    Thread Starter Well-Known Member

    Sep 13, 2010
    735
    43
    Evening gents,

    Please see the schematic attached!

    Attached I've posted a sketch of a simple diode, photodiode and BJT circuit we have in at the input of our gate driver circuitry.

    Essentially, our microcontroller outputs a 20kHz square wave at some duty cycle, and this waveform is passed to the gate driver IC via a optoisolator in order to drive a motor.

    The problem with our current setup is that if our microcontroller dies or hangs, the output is pulled high and the motor will be operating at 100% duty cycle.

    Is there a simple solution to this problem such that when our microcontroller dies the output is pulled low instead of high?

    Note that I would be able to easily invert our square wave in software if that will make any given solution easier to implement.

    I look forward to hearing any suggestions, comments and thoughts you may have for me!

    Thanks again!
     
  2. redplaya

    Member

    Jan 26, 2014
    30
    1
    Not really thinking too hard you could switch the uC from sinking (your current image confuses me, are you using the internal impendence of the uC for your current limiting? not good) to sourcing; therefore when off -> IO low essentially is an inversion.

    Or you could just add another inverter (common source amplifier in this case is easiest) at any stage.

    Essentially your answer is invert your current solution, right?
     
  3. crutschow

    Expert

    Mar 14, 2008
    13,028
    3,238
    Just add an inverter stage at either the input or output. Invert the signal polarity from the μC to compensate.
     
  4. inwo

    Well-Known Member

    Nov 7, 2013
    2,433
    315
    Does μC failure always go low?

    I'm thinking, missing pulse detector, to shut down or go to limp mode.
     
  5. redplaya

    Member

    Jan 26, 2014
    30
    1
    Most AVR's and ST's have registers to set internal pull ups but upon reset they will go low/float (therefore just add another pull down to the output of the IC at the gate of the first BJT). Whatever he has seems to be displaying the same behavior.

    If cost of parts isn't an issue than INWO has an overkill alternative, ha.
     
    Last edited: Feb 1, 2014
  6. #12

    Expert

    Nov 30, 2010
    16,324
    6,818
    How about this?
     
  7. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    What part of the circuit is the "output" ??? It is not indicated on your schematic.

    To monitor the micro hanging the only part you cannot use is the micro: it's hung when this happens, right? But you can build an external watchdog timer with a retriggerable monostable triggered off the micro pin controlling the PWM: if PWM signals cease then the micro will time out and disable the motor.

    HOW the motor is disabled is unknown as it cannot be determined using the miniscule schematic presented has any relation to your unit.
     
  8. inwo

    Well-Known Member

    Nov 7, 2013
    2,433
    315
    Deleted the schematic with obvious errors.:p
    I'll try again and possibly do the same.
    Really need to learn simulation to prevent embarrassment.:(
     
  9. Jony130

    AAC Fanatic!

    Feb 17, 2009
    3,959
    1,097
    I don't see any path for C2 discharge current.
     
    inwo likes this.
  10. redplaya

    Member

    Jan 26, 2014
    30
    1
    inwo likes this.
  11. inwo

    Well-Known Member

    Nov 7, 2013
    2,433
    315
    Thanks for looking, and not dismissing out of hand.
    Can you help me out?

    The idea is to keep C1 discharged with pulses from microcontroller.

    Pull up between R2 and C2 maybe?
     
  12. inwo

    Well-Known Member

    Nov 7, 2013
    2,433
    315
  13. #12

    Expert

    Nov 30, 2010
    16,324
    6,818
    inwo, tell me about your intent with that drawing. I'm having difficulty with lack of sleep today. Help me figure it out.
     
    Last edited: Feb 2, 2014
  14. inwo

    Well-Known Member

    Nov 7, 2013
    2,433
    315
    The pwm source, 200ohm, and optic isolator are from OP.

    Q1 and C3 form a supply from +5 that can be turned off with failure.

    Q1 is turned on initially, base thru R3 and C1 to gnd.

    The positive going pulse from R1, thru R2 and C2, keeps C1 discharged.
    Which keeps C1 from charging above +5 minus one base emitter junction, and turning Q1 off.

    If pulses stop, cap will charge and Q1 will turn off.

    I'm sure it needs some fine tuning, like another diode drop in Q1 base circuit.
    But that's what I'm thinking!

    Don't have time to proof read. Have to run.:eek:
     
  15. #12

    Expert

    Nov 30, 2010
    16,324
    6,818
    It looks like it will work, but C3 seems irrelevant, and my circuit is simpler. Will my circuit work?

    This took a very long time to do. ANYBODY IS INVITED...NO...REQUESTED TO CHECK MY WORK!
     
  16. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    If just for a circuit then there is nothing wrong with your circuit, but if considering what the OP need then it could be a problem, you can thinking that why the OP using a photodiode, and what relationship with Vcc and GND in a photodiode circuit?
     
  17. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    You using the Q1 bjt as as switch, but the output pin as a input, what the output will be happening when the input is feedback?
     
  18. #12

    Expert

    Nov 30, 2010
    16,324
    6,818
    He's using an opto-coupler. He asked for a way to have it fail in the off condition if the Uc output got stuck, "low". I considered that he wanted those two things and made a simple circuit that would do it.
     
  19. inwo

    Well-Known Member

    Nov 7, 2013
    2,433
    315
    I will return the favor and ask for an explanation.:)
    Seems same as OP version except inverted (NOT-inverted by emitter follower).
    Surely the simplest method. Requires reprogramming to invert μP output. Correct?

    In the OP's circuit, a low μa pin = low to his driver circuit = 100% speed. IMO
    In your circuit, μP output failure (floating or stuck high) or opto failure = low output from top of emitter resistor = 100% speed. :confused:

    Returning to your critique:
    Yes C3 is an after thought. I didn't know how Q1 would act if circuit had glitches or noise. No real reason for it. Good catch.

    Ir won't work for sure if duty cycle goes too near or to 100%. ie. μP output held low.

    Or 00% for that matter.:)

    Then there is the matter of a previous question about discharge path for C2. :confused:

    There may also be the need for an integration capacitor after C2. That's over my head without experimentation, and may not even be possible.:eek:
     
  20. inwo

    Well-Known Member

    Nov 7, 2013
    2,433
    315
    Thank you for looking and the question.

    I'm sorry, being self taught, I often have trouble following others explanations and questions.:p

    Possibly, a more detailed description would get thru to me.
    Or maybe #12 can help me out.:confused:
     
Loading...