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 OoijenCommented Jun 24, 2015 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\$– user379468Commented Jun 24, 2015 at 19:41
1 Answer
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).
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.