How can I control a motor with my PC?

Soldato
Joined
22 Jun 2005
Posts
9,068
Location
Nottinghamshire
I have a temporary project, where I need to control a motor with a PC.

I need it to spin one way for 3 seconds, then spin the opposite way for 3 seconds and count how many times it has done this.

I need it to display the count on a monitor.

Can anyone advise the best way to do this? I've looked into a raspberry pi, but I have a windows pc lying around that I could use.
 
Depends on the motor, it's interfaces and what, if any, SDK's are supplied.

Basically you connect it to you PC, write some code in the relavant language, compile the code, flash the chip in the motor and your good to go.

Lanagues will vary from Assembler(old now) to Basic and C, maybe propriety langagues also.

Need to find a suitable programmable motor first.

It's called embedded programming.
 
On desktop PCs you don't have easy access to low-level interfaces required to perform this task (GPIO, I2C, SPI, etc.), so it will probably be easier to look at buying some cheap kit to be dedicated to this task.

A Raspberry Pi gives good access to the physical pins so will allow you to do the job if you have one. If you need really exact timings then the Raspberry Pi may not be the best solution as the OS task scheduler can get in the way, but for just reversing the motor direction every 3 seconds it should be OK.

If you are having to buy in some kit my recommendation would be the same as Kaku and to look at getting an Arduino. The clone boards are cheap, low power and simple to program; and there should be more than enough examples of doing something similar that you can copy the required code.
You can buy a cheap beginner kit that would include an Arduino board, LCD display, motor, breadboard and other components required to do the job.
 
Back
Top Bottom