Transistor switch to turn on/off USB hub.

Thread Starter

cpqfe29

Joined Jan 30, 2010
26
I tried my best to Google the information that I needed but I have a good understanding of the basic theory (I think). I have a book on order (MAKE: Electronics: Learning Through Discovery) and will be getting a breadboard but I would like to see if I am even on the right track with this project.

I have a device that I can turn on and off. Attached to the device is a powered USB hub (and hard drive). I have to unplug the hub's power when I am done with the device.

I would like to use a 5v power point on the device to help power down the HUB/drive. I would like to do this without a relay (if possible) so that I can fit it in the device's case. I would also like to use different wall warts to power the hub (in case the original one broke or was lost). I have a handle on that part (project box with voltage regulator + reverse polarity protection, power plugs, etc.).

From my research I would need a NPN BJT transistor, or a N-channel mosfet, or a logic-level mosfet.

I stopped by R. Shack and found a IRF510 mosfet but after researching I found someone who had problems because he was trying to switch power using 5v which was to low to 'fully open the gate'. I am trying to figure out the basics but I can not find a guide on syntax such as Vdss and Vgs (th) and others and how they relate to each other. I also found a 2N4401, a MPF102, and a TIP31 transistor at the same place but it would appear that either the power that I may need is too low or the 5v 'gate' is not strong enough. At least for what I found.

My simple need is that I want to disconnect/connect the power that I have to the hub via the device's power switch.


I figure that I would not realistically need more that 1 amp of power (if that) at 5 volts. I read about transistor voltage drop/loss and I can easily add a voltage regulated box inline between that wart (or any unregulated wall wart 1-2amps -- 5-12v). If the voltage drop is about .7v then it may be helpful to use an adjustable voltage regulator and send power in at 5.7v or so to help compensate for this loss. Is that foolish?

Pictures below may help. First one shows my setup now. Second picture shows what I would like to do at a minimum. The third shows what I would like to do as a complete project. The fourth shows you what I am thinking inside my head. Good or bad. :confused:

These are just simple pictures that are logical to me. Will a setup like this work? I know I need to add resistors and maybe a diode or two but I need to get my fundamentals down with the right device first. (Digi-Key is who I used before so any specific recommendations will be GREATLY appreciated). The transistor in the forth picture is not labeled because the different types of transistors have different pin-outs. If you have a specific transistor in mind then feel free (of course) to modify the picture to your suggestion.

BTW: this video helped me belive that this was possible: http://www.youtube.com/watch?v=Te5YYVZiOKs



1. My setup now



2. What I would like to do at a minimum.



3. what I would like to do as a complete project.



4. What I am thinking (basic_no resistors, etc. in place)



Thank you for any help and clarification that you can provide!



EDIT: I can work with any package type although I prefer thru-hole types but any type will do.
 
Last edited:

rjenkins

Joined Nov 6, 2005
1,013
A P-Channel logic level FET is ideal for that.
The voltage drop when 'on' is trival, it should still work fine with the 5V supply.

Connect the Source to the incoming +5V and the Drain to the ouput load.
Add a 10K resistor between Gate and Source to ensure it turns off properly.

You need to take the gate to 0V for On and 5V for Off, you can use a second small NPN transistor or logic FET to invert that if required.

(I have a similar circuit in the laptop I'm using, to enable/disable a Bluetooth module I fitted internally).
 

Thread Starter

cpqfe29

Joined Jan 30, 2010
26
A P-Channel logic level FET is ideal for that.
The voltage drop when 'on' is trival, it should still work fine with the 5V supply.

Connect the Source to the incoming +5V and the Drain to the ouput load.
Add a 10K resistor between Gate and Source to ensure it turns off properly.

You need to take the gate to 0V for On and 5V for Off, you can use a second small NPN transistor or logic FET to invert that if required.

(I have a similar circuit in the laptop I'm using, to enable/disable a Bluetooth module I fitted internally).
Thank you for the information.
I did however have some old system boards with different NPN transistors on them. I like this one and de-soldered a couple off. Do you think that it will also work for this application? I did want the transistor on and passing flow when 'system/device' power is on. And off (disconnected) when the device power is off. I can still order a p-channel if what I have will not work.

On semiconductor NTD4809N
Data sheet here. http://www.onsemi.com/pub_link/Collateral/NTD4809N-D.PDF

If this will work what will be needed to complete the circuit? It mentions a diode (DRAIN−SOURCE DIODE == Forward Diode Voltage of .95 - 1.2v). According to the graph with me using up to an amp or two will be less than a 1/2 volt drop. Am I reading/interpreting that right? And does this mean that I would not need a diode to protect it from reverse polarity? I don't plan on using a different wall-wart but you never know the future. I would rather play it safe.

A resistor is needed on the 5v to gate correct??? If so what size is good?

Is a resistor needed between source and drain? If needed what size?

Also will a cap or two help out anywhere in the circuit?

Thanks again. The data sheets help but some of it is like a foreign language to me. I can take whatever measurements are needed if anyone needs more information.
 
Last edited:

Thread Starter

cpqfe29

Joined Jan 30, 2010
26
I found this:

Note: The gate of a MOSFET has some capacitance which means that it will hold a charge (retain voltage). If the gate voltage is not discharged, the FET will continue to conduct current. This doesn't mean you can charge it and expect the FET to continue to conduct indefinitely but it will continue to conduct until the voltage on the gate is below the threshold voltage. You can make sure it turns off if you connect a pulldown resistor between the gate and source.


I also found this:
Larger resistor = slower discharge time


In this case a resistor between the gate and the source is a good idea (for these reasons I assume). I would not mind a slight pause before the gate is discharged. So a 10K resistor would be better that a 10ohm resistor (or does it even matter, the capacitances on the spec sheet look to low to matter). Of is their a calculation that is mandatory for another reason?
 
Last edited:

rjenkins

Joined Nov 6, 2005
1,013
You should only switch the positive power to a USB device, switching the 0V/Ground side may cause damage.

To use an NPN device to switch the positive side is tricky, you need a PNP or P Channel part.

The gate capacitance of the FET is only relevent when it's being switched at high frequencies. As an on/off switch like this, you can ignore it. Also don't get confused with the (low value) series gate resistor shown on some circuits, that again is for high frequency operation.

The 10K gate to source resistor is fine.

What polarity is the control signal you will be using - ie. High for On or Low for On?
 

Thread Starter

cpqfe29

Joined Jan 30, 2010
26
You should only switch the positive power to a USB device, switching the 0V/Ground side may cause damage.

To use an NPN device to switch the positive side is tricky, you need a PNP or P Channel part.

The gate capacitance of the FET is only relevent when it's being switched at high frequencies. As an on/off switch like this, you can ignore it. Also don't get confused with the (low value) series gate resistor shown on some circuits, that again is for high frequency operation.

The 10K gate to source resistor is fine.

What polarity is the control signal you will be using - ie. High for On or Low for On?
Ok,
I will check my used boards for a P type. If not then I will get something from Digi-Key. I need a breadboard anyway as I find this kind of fun.

The control signal I am not sure. I still need to learn about logic, PWM, etc.

Basically I want to use a point on the device to switch the Hub on or off. When the device is on it will have voltage and I would like the hub to power on. And when the device is off there will be no voltage and I want the hub to power down also.

I am surprised that there are not more examples of people using transistors (I am new to this and it is fascinating) as switches. At least simple switches. Especially in this generation's "green" frame of mind. I can think of hundreds of useful applications using computer ports (PS/2, etc) and other devices to power off other connected 'vampire' drains
.
 
Last edited:

Thread Starter

cpqfe29

Joined Jan 30, 2010
26
What polarity is the control signal you will be using - ie. High for On or Low for On?

Do I need a control siginal for this to work?
I am reading up on this (my books came in) so please bear with me.

It would appear that I just can't use a simple 3.3 or 5v power point on a peice of equipment to switch a transistor. Is this correct?

If so then should I look for a relay that can work with a simple 3.3/5v power source. Space is very limited.

Thanks for any help. I have spent days trying to learn and I will be out for the next couple of weeks. I do have this - STN790A PNP transistor but the data sheets are pointing at all negative voltages.
 

rjenkins

Joined Nov 6, 2005
1,013
Retched -
He is only using positive voltages.

The target is to switch the 5V power to a USB device, the best way is a PNP device with the base pulled to 0V (via a resistor) to turn it on.

cpqfe29 -
Everything is relative! As the emitter of the transistor will be connected to +5V, the 0V rail is -5V in relation to that. The base will be pulled negative in relation to the emitter.

Use a 1K resistor between emitter and base, and another 1K between base and the control signal. At that point, connecting the control signal to 0V will turn the transistor On.

If you need to switch it in with a positive signal instead, connect it to the collector of a small NPN transistor with it's emitter to 0V.
The control in to that would the be through a 10K resistor to it's base, with another 10K base to emitter. You could then control that by a positive voltage, anything from a couple of volts to 20V or so should work OK for On, with open circuit or 0V for Off.
 

Thread Starter

cpqfe29

Joined Jan 30, 2010
26
Retched -
He is only using positive voltages.

The target is to switch the 5V power to a USB device, the best way is a PNP device with the base pulled to 0V (via a resistor) to turn it on.

cpqfe29 -
Everything is relative! As the emitter of the transistor will be connected to +5V, the 0V rail is -5V in relation to that. The base will be pulled negative in relation to the emitter.

Use a 1K resistor between emitter and base, and another 1K between base and the control signal. At that point, connecting the control signal to 0V will turn the transistor On.

If you need to switch it in with a positive signal instead, connect it to the collector of a small NPN transistor with it's emitter to 0V.
The control in to that would the be through a 10K resistor to it's base, with another 10K base to emitter. You could then control that by a positive voltage, anything from a couple of volts to 20V or so should work OK for On, with open circuit or 0V for Off.
.

I am getting more confused the more that I learn. :) Actually the relativity information does make sense to me. I may also be confused if the transistor(s) is supposed to be wired in series or parallel in regards to the + and - 'rails'.

A picture is worth a thousand words.


I think I interpreted you words incorrectly at first. Or maybe I did not. If I did then look at the image below for a good laugh.

If you did not mean to wire the devices together then you were giving me an example using an PNP and an example using a NPN transistor I think.

I have a copy of my 'template' here:

http://i253.photobucket.com/albums/hh47/cpqfe29/Transistor Help/Blank-1.jpg

If it is not asking to much may I please get an example using this template or a schematic to help me out visually? I used MS paint.





One more question please. Why is it safer to switch the positive side? Does it have something to do with a common/or not common ground? I am only asking for educational benefits.

.
 

rjenkins

Joined Nov 6, 2005
1,013
The only drawing package I have to hand to do a schematic is Visio, which I hardly ever use so apologies for it being a bit scruffy..

There are several reasons for switching the 5V rather than the ground side.

USB is designed to work with peripherals that can be switched off, so having the data lines go Low when there is no power is safe.

If you switched the ground side, the data lines would pull High, making the PC think there was still something active.

The main one is that if you switch the ground on anything, you can get an alternate path through the ground or 0V side of any other wiring or device that may be connected to it or come in contact with it.

0V or Ground connections on low voltage gear are often exposed or connected to casings / screens / plug metalwork etc. and that would all become 'live', even if at low voltage, if you try to break the 0V line.

Back to the circuit;
The PNP transistor T1 and the two 1K resistors for the actual 5V power switch. That's turned On by connecting the bottom of the lower 1K to 0V, or turned off by leaving that floating / connecting it to 5V.

The NPN transistor T2 and the two 10K resistors acts as the switch-to-0V for the T1 stage, and is turned on by applying a positive voltage to the control input.

(The 1K resistors assume a reasonably high gain transistor for T1. If it's a lower gain type you could swap them for something like 220 Ohms to keep the voltage drop across T1 to a minimum).
 

Attachments

Thread Starter

cpqfe29

Joined Jan 30, 2010
26
The only drawing package I have to hand to do a schematic is Visio, which I hardly ever use so apologies for it being a bit scruffy..

Back to the circuit;
The PNP transistor T1 and the two 1K resistors for the actual 5V power switch. That's turned On by connecting the bottom of the lower 1K to 0V, or turned off by leaving that floating / connecting it to 5V.

The NPN transistor T2 and the two 10K resistors acts as the switch-to-0V for the T1 stage, and is turned on by applying a positive voltage to the control input.

(The 1K resistors assume a reasonably high gain transistor for T1. If it's a lower gain type you could swap them for something like 220 Ohms to keep the voltage drop across T1 to a minimum).
.

Are you kidding me? I must apologize to you for your time helping me understand these concepts that books have fallen short on.

That schematic is GREAT. (Did you not see my drawings above? )

That one schematic explained more than you know. I am not guessing and can use it to move forward. It also helped me understand other basic concepts (pull up/down resistors, etc.).

Thank you again for your help. I am out of town but there is a Fry’s here and I will get the parts here including a couple of breadboards. I will post again in a couple of weeks once it is done. I am also experimenting with making my own circuit board also (radio shack had CB kits on clearance for $1 – I purchased all six of them).

.
 
Last edited:
Top