Simple diode and transistor circuit

Thread Starter

jegues

Joined Sep 13, 2010
733
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!
 

Attachments

redplaya

Joined Jan 26, 2014
30
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?
 

inwo

Joined Nov 7, 2013
2,419
Does μC failure always go low?

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

redplaya

Joined Jan 26, 2014
30
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:

ErnieM

Joined Apr 24, 2011
8,041
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.
 

inwo

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

Attachments

#12

Joined Nov 30, 2010
18,210
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:

inwo

Joined Nov 7, 2013
2,419
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:
 

#12

Joined Nov 30, 2010
18,210
The pwm source, 200ohm, and optic isolator are from OP.

10) Q1 and C3 form a supply from +5 that can be turned off with failure, if you are right.

20) When power arrives, Q1 is turned on initially, base thru R3 and C1 to gnd and that charges C3 to about 4.4V in 1/2 second.

30) If the pulse signal is low, opto = on for up to 1/2 second.

40) The positive going pulse through R1, R2, and C2, will turn on Q2 which will then discharge C1 to about one Vce from ground. (1 or 2 tenths of a volt)

50) This keeps C1 from charging above 1 or 2 tenths of a volt, and turns Q1 on.

60) Therefore, pulse positive charges C3 but stops the opto from turning on.

70) WHEN positive pulse stops, Q2 will go off, C1 will charge for up to 1/2 second or until the next positive pulse arrives, Q1 will conduct for up to 1/2 second, and opto will be on for up to 1/2 second by conducting through R1.

80) If next positive pulse arrives, Go to 40.
Otherwise,

90) C1 will get full in about 1/2 second and Q1 will turn off.

100) During that half second, Q1 current will go through the opto and R1, then the opto will go off and wait for the next positive pulse for as long as it takes.

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:
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!
 

ScottWang

Joined Aug 23, 2012
6,893
How about this?
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?
 

ScottWang

Joined Aug 23, 2012
6,893
Deleted the schematic with obvious errors.:p
I'll try again and possibly do the same.
Really need to learn simulation to prevent embarrassment.:(
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?
 

#12

Joined Nov 30, 2010
18,210
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.
 

inwo

Joined Nov 7, 2013
2,419
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!
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:
 

inwo

Joined Nov 7, 2013
2,419
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?
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:
 
Top