I need some help with a simple transistor switch circuit design  - Page 1
Forum section: electronics / projects

author: kolonelkadat
author_rank: Regular Contributor
timestamp: February 24, 2013, 05:28:45 am
content: I am using the parallel port on my PC to emulate tact switch presses on some remotes. This is all very easy, but for one major problem. On boot, my PC sets the data pins on the parallel port to high ( they go low again when OS begins to boot). Since I am using a High pulse to open both my garage and front door, this is a major security concern should the PC ever reboot without my knowledge (power failure).Is there a way I can make it ignore the first pulse it receives, or even ignore all input for say 5 minutes?Here is the circuit im using:

author: gnif
author_rank: Unknown
timestamp: February 24, 2013, 05:38:59 am
content: Well, this would concern me also, but I am not sure how you would do it without implementing more complex logic as when your computer restarts due to a crash, etc... how will your circuit know to enable it's time out?Personally I would drop the LPT port completely and program a cheap MCU to do what you want, and talk to it over UART, then there is no chance of false triggering if your PC screws up.

author: c4757p
author_rank: Super Contributor
timestamp: February 24, 2013, 05:46:24 am
content: Definitely. I'm usually the last one to say "throw a microcontroller in there", but if you have to be absolutely sure you won't get any false triggers, you should use a microcontroller and require the computer to transmit some code that can't be transmitted accidentally.If you really don't want to use an MCU, perhaps you could use one of the pins as an active-low enable for the entire circuit, so that when all the data pins go high, nothing happens.

author: gnif
author_rank: Unknown
timestamp: February 24, 2013, 05:53:51 am
content: Just a follow up thought... If you are using windows... what about when it tries to probe for printers for PNP?I once built a similar type program once before, the early prototype was a hardware watchdog for the PC using the LPT port, which if it didn't get data from the PC after X minutes it would trigger the hard reset. This worked mostly, but if windows tried to probe the port, it would reset the PC. I quickly moved to a PIC16F84 and bit-banged the RS232 protocol (this was about 12 years ago).

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 24, 2013, 06:58:07 am
content: I'm like c4757p, in that I hate the "just use a MCU" answer but this sounds like a great Arduino project.Having said that, here's what you can do if you want to stick with the parallel port...Dedicate one of the pins to a 'signal' that your software explicitly sets high and keeps high when it is running. Use this for any type of RC timer circuit to generate the 5 minute lockout period. Just don't draw too much current from the pin.Use a diode and small resistor (to limit current) parallel to the charging resistor to ensure the capacitor discharges quickly when the PC loses power.

author: Kremmen
author_rank: Super Contributor
timestamp: February 24, 2013, 08:30:19 am
content: Or do what the CNC crowd does - use a charge pump. In that scheme, one of the parallel port pins is dedicated to produce a pulse train that is pumped using a diode cascade, into a capacitor that then turns on a MOSFET. This is a quite secure and above all, quick way to control the port state. Should th ePC crash for instance, it takes just milliseconds to disable the ports.So you need to arrange the circuit so that your logic output does not go directly to the FET paralleling the tact switch. Instead there should be another FET or something between, taking its power from the charge pump and its control from the logic output.In the attached circuit the "enable" signal into C4 is a ~10kHz square wave from the CNC control software. It is pumped into C6, turning on Q3. That in turn discharges C5 and allows Q1 to conduct, enabling the 12 V aux supply. Q15 is there to enable the 5 V logic supply which is a separate circuit.

author: qno
author_rank: Frequent Contributor
timestamp: February 24, 2013, 09:26:30 am
content: if all lines go high at a reset I would use another line of the LPT to disable the transistor.This line has to be low for the transistor to open on a high.

author: Unknown
author_rank: Unknown
timestamp: February 24, 2013, 10:28:54 am
content: What about if you added a charging cap at the input of the transistor, so instead of sending a short signal to turn on the RF Tx, you would need to hold it high for say 3 seconds; that way any short boot-up signals wouldn't be on long enough to turn on the Tx?

author: kolonelkadat
author_rank: Regular Contributor
timestamp: February 24, 2013, 03:59:16 pm
content: Thanks so much for your input guys. Ive only really started messing with electronics a few days ago, so I pretty much have no idea what im doing. but now I have a bunch of great ideas to get me going in the right direction. You guys rock!FWIW, my biggest aversion to using a µC is cost. If I buy an arduino, thats 20-30 bucks. If I buy just some atmega328s then I need to spend $50 on a programmer. I know it isnt much, I just cant justify that cost right now.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 25, 2013, 12:57:36 am
content: Since you're new to electronics let me warn you now: it's not a cheap hobby.Your original schematic shouldn't even work as you've shown it. There's no common ground between the PC and the 9V supply. You are also pushing your luck by drawing that much current from the parallel port pin. You might consider using something like the schematic I've attached to drive the load.This still doesn't address the PC reset issue, though.

author: GEuser
author_rank: Frequent Contributor
timestamp: February 25, 2013, 04:33:03 am
content: Only going from memory OP , so you'll have to look it up .Its a software thing , there is a fix for it in the registry to stop that data on being sent at all (or just on start-up) , i carnt remember anything else but that .It has be a issue in the past with Receiver computer control (shortwave/ham etcetera) in where the radio would tx if it was on and then fired up the computer , quite a long time ago so no memory of how/why...edit> just recalled a bit? , the computer sends that data to see if anything is there and maybe set it up/load drivers/ if there is and if it responds , or whatever , it can be turned off .

author: KuchateK
author_rank: Regular Contributor
timestamp: February 25, 2013, 05:15:20 am
content: To cheaply start with Arduino get ATmega programmed with Arduino bootloader and USB to TTL serial adapter. That should be less than $10 from ebay.I recommend usb to rs232 module with FTDI chip. It allows bit banging and Arduino crowd uses this mode to program blank ATmegas.With one working Arduino you can program spare chips.

author: kolonelkadat
author_rank: Regular Contributor
timestamp: February 25, 2013, 05:17:19 am
content: Quote from: TerminalJack505 on February 25, 2013, 12:57:36 amindeed, I forgot to draw the ground. I also labeled the transistor wrong... its a TIP120. I will update the schematic in a moment.I wonder though, because I know very very little, why you suggest using a 2n3904 to drive the darlington transistor. I was under the impression that a darlington style transistor did basically what you suggest: use two transistors to increase forward current gain so that it takes a miniscule (<20mA) to switch a high current load (5A max for the tip120). PLEASE correct me if im wrong. Id hate to ruin my parallel port. and my ammeter appears to not work, not that I would trust it anyways. got it a yard sale for $1.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 25, 2013, 05:56:37 am
content: I thought you were using a PNP transistor so that's why I suggested to use the 2n3904. You'll be fine with just the TIP120 hooked-up as shown in your new schematic.Edit: You might swap the battery and the load, however, in your schematic. This way, the battery's negative terminal is at the same potential as your system ground.