I'm looking for a way to turn a usb port on an off from an Arduino, I'm looking at purchasing something like this and somehow using a pressure or light sensor to turn the usb port on and off. I was thinking that I could use a transistor or relay to turn the usb port on and off, however, I may need to have many sensors ( maybe 20 ) that turn USB ports on and off, and the Arduino pins would fill up pretty quick. Perhaps there is such thing as a serial or i2c transistor? that way they could all be on a bus of some sort.

  • \$\begingroup\$ I am not sure what you mean by 'switching off a USB port', but if your problem is controlling multiple relays from 3 I/O pins the TPIC6C595 (focus.ti.com/lit/ds/symlink/tpic6c595.pdf) might be the answer \$\endgroup\$ – Wouter van Ooijen Jun 24 '15 at 18:28
  • \$\begingroup\$ I'm sorry, I thought it was clear, I just want to switch the power of the usb port on and off, I have a powered USB speaker that I'm trying to turn on and off \$\endgroup\$ – user379468 Jun 24 '15 at 19:41

I would recommend using a GPIO expander for this. I have used the Microchip MCP23017 in the past for this very setup. This device is a 16 channel programmable GPIO available in either SPI, or I2C (the part number is slightly different for SPI).

MCP23017 Functional Diagram

You can connect the gpio outputs from this device to N-Channel mosfets with a pull-down resistor to achieve your goal. The best thing about this part is that it is available in a dip package for cheap ($1.44) at DigiKey.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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