Continue to Site

# [SOLVED]switching 12V device from usb device

Status
Not open for further replies.

#### this

##### Member level 2
I have a usb device powered from usb (5V).
I want my device to turn on/off another device running on 12V.
What is the proper way of doing it?
My idea on how to do this is:
Code:
           ^12V
|
|
---
12V dev.
---
|
|
/
usb----|<
\
|
|
|
v gnd

Does it makes sense? If so, should I have both grounds connected together, is it safe for PC?
If not, how do I solve this? Relay? or...?

TIA

#### alexan_e

are you going to use a mosfet of a transistor, especially in the transistor case you have to add a base resistor to limit the current?
the gnd can be connected , no problem with that.
What kind of load will you drive, how much current?

Alex

#### this

##### Member level 2
Yes, I was thinking about mosfet, of course will add all the necessary resistors.
My 12V dev is an electro-lock, 350mA.
I think I should also add protection diode in parallel, right?

@johny
I need way more current, but thanks anyway.

#### alexan_e

If you are using a mosfet the resistor is not too important (I assume a small mosfet) but you can still add a 10K resistor.
Yes you can add a diode across the lock.

Alex

this

### this

Points: 2

#### this

##### Member level 2
1)So, generally this is a good way of switching 12V circuit, right?
2)Is bjt better than mosfet (or vice verca) for this purpose and why?
3)Is there any better way of achieving this, and why?

thanks!

#### alexan_e

1) So, generally this is a good way of switching 12V circuit, right?
Yes it allows you to control two different voltages (one voltage with another voltage) without problem

2) Is bjt better than mosfet (or vice verca) for this purpose and why?
A mosfet is better, you will have a much lower voltage drop across the source-drain (compared to emitter-collector)
The gate needs some current to charge (can be very small since there is no fast rate switching) and then doesn't pull current any more while in the transistor case you need to provide a constant current to the base that should be at about 1/10 to 1/20 of the output current to set the transistor in saturation.

3) Is there any better way of achieving this, and why?
The only other way i can think of is with an optocoupler in which you will have a complete physical isolation between the two device, I don't think that you need it in this case

Alex

P.S I'm charging you three answers for that although they were asked in a single post :-D

bobstay and this

Points: 2

### bobstay

Points: 2

#### this

##### Member level 2
Thanks Alex!

Status
Not open for further replies.