Electronic – How do i turn multiple usb ports off based on multiple sensors

i2csensorserialtransistorsusb

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.

Best 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).

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.

Related Topic