hello fellas,
i'm in the middle of doing my final year project about pir sensor... my project is, to switch on the light when motion is detected... i want to use desktop led lamp as the output...as you all know, the desktop led lamp is using usb in order to swtich on... i want to use the usb interface on the raspberry pi to connect it with my desktop led lamp...how am i gonna do that?? is there any suggestion or mybe if there any python coding for that,can you all share it for me... i'll appreciate your help...
thank u...
-
- Posts: 5
- Joined: Sun May 11, 2014 11:09 am
- ShiftPlusOne
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6400
- Joined: Fri Jul 29, 2011 5:36 pm
Re: how to make the usb interface on pi as output
Please don't spam the same topic across the forum. Thanks.
Re: how to make the usb interface on pi as output
Don't make too many assumptions!...as you all know, ...
I don't know about your lamp, but others I've come across don't have any control - if there's power on the USB plug, the lamp is lit.
As the Pi's USB sockets are always powered*, you can't control the lamp that way. You'll need to put some electronics into the lamp, and drive it from a GPIO
*not quite true - on the B+, the power goes through a switch-chip, and that's got an enable on it, that comes from the 9514 USB/LAN chip.
But you probably didn't want to know that.

Re: how to make the usb interface on pi as output
How exactly was I supposed to know that?murny_shah wrote:as you all know, the desktop led lamp is using usb in order to swtich on...
Does the USB connection from the lamp actually have logic on it to switch it on and off over USB, or is it just a USB-powered lamp like Burngate mentioned?
If it has logic on it, check the datasheet and send whatever signal it's expecting to turn off and on. If not, I'd use a GPIO pin to switch a relay or transistor which controls the lamp instead. You'd obviously have to tap into the power wire of the lamp's cord if this is the case.
Re: how to make the usb interface on pi as output
Do you have a link to details on that as the circuit diagram I have for the B+ doesn't show it. Perhaps I haven't got the latest circuit diagram?Burngate wrote:on the B+, the power goes through a switch-chip, and that's got an enable on it, that comes from the 9514 USB/LAN chip.
Re: how to make the usb interface on pi as output
Sorry, don't have a link - I prodded around with my meter, used my skill and judgement (AKA guessed) and came up with this - I can't guarantee the accuracy! Note: no component values, and the diode might be reversed!hippy wrote:Do you have a link to details on that as the circuit diagram I have for the B+ doesn't show it. Perhaps I haven't got the latest circuit diagram?
Re: how to make the usb interface on pi as output
So you don't want to hear from any female readers who might have information for you?murny_shah wrote:hello fellas,
(Or maybe 'fellas' is now gender-neutral, like 'actor'?)
To the point: the power lines in the RPi usb sockets are not themselves (trivially) programmable. Maybe you could take that constant power feed to a chip like those used in motor-control H-bridge circuits, and switch that on and off via a programmable gpio pin? But if this is your final-year project that's as helpful as I am going to be...
- mahjongg
- Forum Moderator
- Posts: 14922
- Joined: Sun Mar 11, 2012 12:19 am
- Location: South Holland, The Netherlands
Re: how to make the usb interface on pi as output
I can confirm the correctness of the schematic, and can add some values.Burngate wrote:Sorry, don't have a link - I prodded around with my meter, used my skill and judgement (AKA guessed) and came up with this - I can't guarantee the accuracy! Note: no component values, and the diode might be reversed!hippy wrote:Do you have a link to details on that as the circuit diagram I have for the B+ doesn't show it. Perhaps I haven't got the latest circuit diagram?
Diode is one halve BAV99 with cathode on enable pin, FET = DMG1012T,
resistors from left to right:
1K8 Pullup R48
100K R47 over diode
R50 and R4 both 39K to gnd and to drain FET
R6 100 gate pulldown.
capacitors:
220nF C106 on enable pin, and also on Vin and Vout.
IC U13 = AP2553W6
also the fault signal from/to the LAN9514 is called "USB_OVC_N", and can both be used to sense a fault condition AND to force USB power off! (something I missed at first, but for someone insisting the USB power could be turned off).
The signal goes to pin 14 of the LAN9514.