View Full Version : Using an OR gate to drive a fan speed control transisitor with PWM

Farmer Scott
01-31-2008, 02:11 AM
The more I think about this, the more it seems like a bad idea, but was looking for some more opinions.

I'd like to very simply drive a fan using PWM output through a transistor. However, I'm wondering what would happen if I put an OR gate between the output PIN and the transistor? The reasoning for the gate would be so that should the microcontroller fail or for any reason not enable the fan, another logic device (such as the Tout pin on a DS1631A) could trigger the fan.

Okay...so tell me...is this really a bad thing to try? I can forsee a couple of problems...gate not switching as fast as the PWM, and erratic output from the gate? Possibly damage to the gate from a long duty cycle? I have no experience using logic gates...so I really don't know what it will do.

I was considering something like a TI SN54AC32 OR gate.

01-31-2008, 02:43 AM
I would just use a diode on each of the driving voltages (forward biased).

Pin ---|>|----+---/\/\/\---- to base of transistor
Tout ---|>|---|


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.iElectronicDesigns.com (http://www.iElectronicDesigns.com)

01-31-2008, 03:26 AM
If we consider this as a "fail safe" situation, you can use a "pull-up" for the transistor base. The Propeller will drive it low actively. In case of a failure it should go tri-state and thus enable the fan. It the current involved is too high, an OR-gate will be fine, maybe even one with open collector/drain. Note that a CMOS OR gate input might also need a pull-up or a pull-down

Farmer Scott
01-31-2008, 03:52 AM

I like that idea...would it be of any concern though, if the Propeller was holding the pin low, and failed? I'm thinking in terms of a software failure...


01-31-2008, 04:08 AM
"Failure analysis" is a very strange area... You have ALWAYS to ask what EXACTLY is the hazard you are fighting. In this case it is "non functioning of the Propeller".

In case it is "an arbitrary software issue", you are definitely helpless

In serious cases you would encapsulate the "pin" in a driver (a COG). When this driver sets it HIGH, no one else can set it LOW. This a good thing.

When the driver is not working correctly - i.e. setting DIRA but not OUTA - you have to analyse the reason. As said a GENERAL software failure cannot be compensated for (except in special triple redundancy systems), but only a SPECIFIC failure.

In some systems this is "hung-up in an endless loop or having jumped to a strange place". The solution for this situation is "watch dog".
A software watch dog can be realized by another (part of a ) program regularly asking some response from the pin driving COG, in case of a missing response it will restart that COG. This will AT LEAST lead to a tri-state output for the pin fan, thus enabling the pull-up merchanism.

Doing such analyses is a high-payed job, so I better stop now http://forums.parallax.com/images/smilies/smile.gif

Post Edited (deSilva) : 1/30/2008 9:16:45 PM GMT

Farmer Scott
01-31-2008, 04:13 AM

Thanks for the info...very much appreciated.