2

I have a motion-detecting PiCamera set up running, which is fine and dandy until it gets dark. I could get another Pi with the NoIR camera instead, but a simple solution occurred to me the other day - plug in a USB light designed for using laptops in the dark, and have the Pi turn that on when it detects motion.

However, that is predicated on the possibility of the Pi allowing individual ports to be activated and deactivated. Is that possible, either in the terminal or using Python? If not, how easy would it be to do with the GPIO system?

2

1 Answer 1

2

No, it is not possible (at least on the model B I'm familiar with, you can check the schematics for others) to toggle the USB VBus power, as there are no power switching devices on the board to implement this, and USB lights typically use only (abuse) the USB power without being command-able over the data lines.

It's true that a few USB hub implementations provide per-port power switching (many hub chips have the output pins to drive power switching FET's, but few hub PCB's have the FET's installed), and there may be ways to command them under Linux, but that's not relevant to an implementation where they are not present.

You should be able to accomplish your goal with a USB- or GPIO- commanded switching device - FET or transistor driver, mechanical or solid state relay, etc. These are available both as bare components or already packaged on a board/module, direct wired or opto-isolated, etc. If buying a USB-connected device, be sure to get one where driver source code is available either from the vendor or someone who has reverse engineered it, as neither a windows driver nor a binary-only x86 linux one would be much use on the pi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.