Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would I control the output of the power in USB ports in Linux?

Tags:

linux

usb

I built a robot from a thin client pc (can run Windows CE or Linux) and two servo motors. I put USB ends on the servo motors, so when they are plugged in to the thin client they continuously run. In Linux, how could I set the amount of current or voltage going from the USB ports to the servo motors? Would I be able to run a shell script to set the power of a certain USB port to slow down a motor or stop one? If this cannot be done through software, what is the easiest way to do this through hardware without having to buy too much?

like image 870
Chris Avatar asked Sep 07 '11 00:09

Chris


1 Answers

The USB voltage is fixed at a nominal 5 volts and cannot be controlled.

The behavior of USB devices regarding their current draw is well defined in the USB specifications. USB devices are supposed to draw up to 1 unit load (100mA) unless they have negotiated a higher load from the USB host. It's quite likely that the servo motors that you have are going to need to draw higher currents than that, and wouldn't be able to request it without being a USB device and negotiating with the host.

It's also likely, depending on the servo motor that you are trying to control, that you'll need to either provide a PWM signal or an analogue voltage to control motor position. USB hosts are not intended to provide either of these.

Your best options to drive your motor from your PC are:

  1. Get a dedicated USB controller for your servo motor (if one exists)
  2. Make your own, based on a small microprocessor (eg. using an arduino)
  3. Choose a different port on the PC. If available, PC parallel ports can be controlled to provide control for motor drivers.
like image 115
Andrew Edgecombe Avatar answered Nov 15 '22 22:11

Andrew Edgecombe