Turn USB Host Power Out On and Off

The USBDroid provides USB Host functionality for use as an Android peripheral as an Open Android Development Kit board. [Product page]
Post Reply
marks
Posts: 31
Joined: Wed Jan 04, 2012 8:13 pm

Turn USB Host Power Out On and Off

Post by marks » Sat Mar 17, 2012 4:17 am

Hello All,

I'm trying to work out how to turn the USB Power Out On and Off by program. The reason being is that I have a device which I'm controlling which behaves differently when connected to a USB host port, so I need to toggle USB power On and Off.

If I remove the jumper on the board and replace it it works fine, also connecting a on/off switch to the jumper pins works as well. I've tried connecting a STP16NF06 N Channel Mosfet using one of the digital pins and setting it high/low which doesn't seem to do anything. I'm guessing that I need some additional components to make this work?

I also note that D13 has a Mosfet but have no idea if it could be done this way either.

Any and all ideas are welcome.

Thank you in advance,

Mark S.

andrewduncan
Posts: 24
Joined: Tue Dec 06, 2011 1:42 am
Location: Melbourne, AU

Re: Turn USB Host Power Out On and Off

Post by andrewduncan » Sat Mar 17, 2012 10:25 am

Hi Marks,

I am not sure if this would work, I am still just learning the basics of electronics. How about using a reed relay to toggle the USB power. You could then trigger the relay with one of the digital pins. I think you would also need a 1N4001 diode or similar to protect against back EMF. This is how the time-lapse controller is wired-up in Jon's Practical Arduino book.

Andrew

marks
Posts: 31
Joined: Wed Jan 04, 2012 8:13 pm

Re: Turn USB Host Power Out On and Off

Post by marks » Sun Mar 18, 2012 12:35 am

Thanks Andrew,

That sounds like an idea so off to Jaycar for something suitable shortly. I'll let you know how it works out.

Cheers,

Mark S.

marks
Posts: 31
Joined: Wed Jan 04, 2012 8:13 pm

Re: Turn USB Host Power Out On and Off

Post by marks » Sun Mar 18, 2012 4:05 am

That works perfectly thank you Andrew.

I used one of these http://jaycar.com.au/productView.asp?ID ... rm=KEYWORD which has an inbuilt diode.

Cheers,

Mark S.

andrewduncan
Posts: 24
Joined: Tue Dec 06, 2011 1:42 am
Location: Melbourne, AU

Re: Turn USB Host Power Out On and Off

Post by andrewduncan » Sun Mar 18, 2012 7:59 am

Excellent! Glad I could help.

LukeW
Posts: 91
Joined: Tue Nov 01, 2011 10:14 am

Re: Turn USB Host Power Out On and Off

Post by LukeW » Thu Mar 22, 2012 3:32 am

The problem here, I think, is that a N-channel MOSFET can't really be turned on properly in a simple high-side-switch circuit unless you use extra circuitry to drive the gate appropriately. (For a low-side switch, however, a N-channel is fine.)

The way to do it most easily in a high-side-switch configuration is with a P-channel MOSFET, where you bring the gate low (not high) to turn it on.

marks
Posts: 31
Joined: Wed Jan 04, 2012 8:13 pm

Re: Turn USB Host Power Out On and Off

Post by marks » Thu Mar 22, 2012 5:17 am

OK thanks Luke that makes some sense although I have very little experience with electronics, I'm actually a code cutter.

Post Reply