Author Topic: Controlling Electric Motors from a PC  (Read 12544 times)

0 Members and 1 Guest are viewing this topic.

Offline DonQuigleoneTopic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Controlling Electric Motors from a PC
« on: October 05, 2011, 10:09:38 AM »
I'm working on a Mechanical Engineering project, and as part of it I need to be able to control a fairly small electric motor from a PC. I'll only need to change the speed at which the electric motor rotates.

I'm looking to attach a propeller to the motor and generate lift, the motor will be held in place. Later on I'm hoping to be able to tilt the motor at various angles, and have the motor respond by producing more or less power, to maintain constant lift. At all times the motor will be attached to the PC, so as long as my PC can directly control the motor there shouldn't be any particularly advanced electronics required (besides connecting the motor to the PC)

Now I've been looking around for ways to control the motor, I'm not particularly experienced in this area, but there doesn't seem to be any cheap solution to what seems to be an elementary problem.

Any suggestions? Thanks in advance!

Offline Daanii

  • Robot Overlord
  • ****
  • Posts: 138
  • Helpful? 3
Re: Controlling Electric Motors from a PC
« Reply #1 on: October 05, 2011, 11:05:05 AM »
I need to be able to control a fairly small electric motor from a PC.

Exactly how big is your motor? (in Volts and maximum Amps at stall)

What will you use to power it? A battery?

What do you want to use to send a signal from the PC to the motor controller? A USB port?

The easiest solution I can think of would be a Pololu Simple Motor Controller: www.pololu.com/catalog/product/1373 I've used them, and they work well. I don't know if you would consider the $30+ to be cheap.

Offline joe61

  • Supreme Robot
  • *****
  • Posts: 417
  • Helpful? 16
Re: Controlling Electric Motors from a PC
« Reply #2 on: October 05, 2011, 11:12:20 AM »
I don't know what you mean by "cheap" but you might be able to do it with one a breadboard a transistor and an Arduino (around $30 US). Probably a separate power supply for the motor. Pololu makes good stuff too, but the Arduino has communication with the PC ready to go. Take a look at the Arduino site and see if anything here looks like what you want to do:

http://arduino.cc/playground/Main/InterfacingWithHardware

Offline DonQuigleoneTopic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Re: Controlling Electric Motors from a PC
« Reply #3 on: October 05, 2011, 11:40:26 AM »
To clarify, the motor doesn't need any kind of independent power supply, it can be powered by whatever is most convenient. Likewise it does not need to operate independently of a computer, but be directly controlled by a computer.

As for sending the signal, whatever is most convenient. USB would be nice if possible.

Finally, for the power of the motor, I'm still not exactly sure how powerful the motor needs to be. The propeller is only going to be 20 mm in diameter at most, so the motor only needs to operate fast enough to be within the propeller's operating range. I'm not familiar with propeller dynamics at the moment, so that's something for me to figure out. Given that RC helicopters have motors at about 5-10 V, and 5-10 amps, I'd be considering small motors in that range.

I still have not bought the propeller or motor, so I'm looking to get 2 that will be easy to fit onto one another. Price is also an issue, I'd like to be able to get everything for the least amount of money possible.

Offline joe61

  • Supreme Robot
  • *****
  • Posts: 417
  • Helpful? 16
Re: Controlling Electric Motors from a PC
« Reply #4 on: October 05, 2011, 01:06:16 PM »
To clarify, the motor doesn't need any kind of independent power supply, it can be powered by whatever is most convenient. Likewise it does not need to operate independently of a computer, but be directly controlled by a computer.
The reason for the separate power supply is that a microcontroller probably won't be able to provide enough current to run the motor. A separate power supply mediated by a transistor is probably going to work better.

Edit: Some of the Pololu controllers have a built-in h-bridge, in which case you won't need the transistor (or maybe a separate power supply, depending ...)

Quote
As for sending the signal, whatever is most convenient. USB would be nice if possible.
The Pololu controllers can also do this, but most need a separate level converter of some kind to go from tty levels to rs-232. Some of the Pololu controllers have built in USB connections though.

Quote
Finally, for the power of the motor, I'm still not exactly sure how powerful the motor needs to be. The propeller is only going to be 20 mm in diameter at most, so the motor only needs to operate fast enough to be within the propeller's operating range. I'm not familiar with propeller dynamics at the moment, so that's something for me to figure out. Given that RC helicopters have motors at about 5-10 V, and 5-10 amps, I'd be considering small motors in that range.

I don't know anything worthwhile about that, but if you haven't seen it yet, this might be useful: http://aeroquad.com/

Joe
« Last Edit: October 05, 2011, 01:08:25 PM by joe61 »

Offline Daanii

  • Robot Overlord
  • ****
  • Posts: 138
  • Helpful? 3
Re: Controlling Electric Motors from a PC
« Reply #5 on: October 05, 2011, 01:09:47 PM »
Certainly building something yourself will be cheapest. But in that case you will also need to do a lot of work and testing. So you save in money at the expense of time and effort learning how to build a motor controller. (Of course, if one of your goals is to learn about motor controllers, building your own is certainly a good way to do that.)

The Pololu Simple Motor Controller I mentioned above is an off-the-shelf solution that will save you a lot of time, and probably not be much more expensive anyway. Pololu has all the software you need on its website. You just hook up the controller to your PC using a USB cable, send it a speed command through USB, and you are all set.

If you need some feedback from the motor/propeller assembly (and it looks like you do, since you mentioned getting the tilt angle), then the Arduino microcontroller mentioned by joe61 will be helpful. The Arduino can easily read in sensor input from an accelerometer, process it, and adjust the speed signal to the motor controller accordingly. Using a PC to do that will be much harder.

In my case, I used an Arduino to get an analog signal from a potentiometer and used that to generate a speed signal to the Pololu Simple Motor Controller. I just used the serial data communications link. It worked pretty well.

I did have problems with electrical noise, though, so you will need to watch that. That's why I wondered how you will power the motor. If you try to power your motor and your digital electronics off the same power supply, you may have problems.  

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Controlling Electric Motors from a PC
« Reply #6 on: October 05, 2011, 03:22:09 PM »
Hi,

I'm still not exactly sure how powerful the motor needs to be. The propeller is only going to be 20 mm in diameter at most, so the motor only needs to operate fast enough to be within the propeller's operating range.
Do you at least know the amount of lift you need?
That's the first thing to decide, as this will define what power and speed you need from the motor.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline hobbes

  • Jr. Member
  • **
  • Posts: 29
  • Helpful? 0
Re: Controlling Electric Motors from a PC
« Reply #7 on: November 21, 2013, 03:43:45 PM »
If you want cheap ( free ) consider using the current from the sound card to control the motor. Now the sound card was not designed to do this but you can output a steady sound and control it's volume using a software API such as PortAudio or OpenAL.

 

 


Get Your Ad Here