Controlling a motor through USB?

Thread Starter

Rallen

Joined Mar 1, 2009
10
Hey there.

I need to build some kind a circuit which makes me able to control a motor through USB. What I need to do, is basically to make a motor run either direction, controlled by some kind of application on a computer.

What im thinking would be something along the lines of;

An H-bridge, to make me able to start the motor running either clockwise or counter-clockwise depending on the input I send to it. My plan is then to be able to send inputs to this H-bridge from my USB-interface, and that way make myself able to control the motor from my computer..

Now im stuck though. How am I going to make the communication between my computer and the H-bridge? Something like a PIC microcontroller controlling the outputs to the h-bridge, and then sending the usb outputs to this controller?

Any suggestions?
 

leftyretro

Joined Nov 25, 2008
395
An Arduino board would work well. It has a USB serial convertor built in on the board and has lots of software support for PWM signals and lots of I/O pins to control a H drive controller chip. The software to program the Arduino is free and open source and can run with windows, linux or Mac PCs. Programming language used is C or C++.

http://www.arduino.cc/

Lefty
 

russ_hensel

Joined Jan 11, 2009
825
Bitwacker from sparkfun is a nice PIC based solution. USB is preprogrammed ready to go, as is enough IO for motor control. Works with free microchip compiler ( or any other 18 series compiler ) which I believe the preloaded software is written in. About $25.
 

bathini

Joined Jan 25, 2009
8
Friends

I have a similar problem but in my case, I have built an H-bridge from this site
http://home.cogeco.ca/~rpaisley4/HBridge.html - the last circuit on the bottom and it works when connected to a function generator.

I have a USB to serial converter and I intend to send 4 bytes to the PIC16F628 using this utility - http://www.pololu.com/docs/0J23

The reason I am using the PIC16F628 is that it has USART hardware and has PWM hardware. I do not know how to write the code in assembly. Please help and thanks

Bathini
 

Thread Starter

Rallen

Joined Mar 1, 2009
10
Thanks a lot everyone!

Theres only one problem though .. As I'm doing it in school, i have to build _EVERYTHING_ myself.. Which means I cant just buy any finished solution..

So. How could I design a board that makes me able to control a motor through usb or serial, when I have to make every part myself?
 

Dreso12

Joined May 19, 2013
3
You can build a circuit in a prototype board. The problem is that for that you might need a through hole USB controller and that's not easy to find.

The only one I know is Microchip MCP2210 which you can buy in SOIC package and them use a adapter to convert it to though hole (look in FARNELL for that).

This chip is a USB to SPI converter so you should be able to control your motor with any SPI enable microcontroller.
 

kubeek

Joined Sep 20, 2005
5,794
This chip is a USB to SPI converter so you should be able to control your motor with any SPI enable microcontroller.
No need for a microcontroller here, that chip already has general purpose I/O pins, so should be enough to control the H-bridge.
 

THE_RB

Joined Feb 11, 2008
5,438
...
Theres only one problem though .. As I'm doing it in school, i have to build _EVERYTHING_ myself.. Which means I cant just buy any finished solution..
...
You can buy little USB->TTL converter modules on ebay for about $3 to $5.

I'm sure that would qualify as a "component" in the project if you use a PIC or other micro and hbridge to do the rest.

Likewise you can buy tiny hbridge PCB modules too.

I think most teachers would agree that making the project from a couple of tiny modules, all joined together with a PIC and your code would still be "building it all yourself".
 

Vitesse

Joined Feb 10, 2013
5
an 18F2550 would work. Little external hardware needed for USB, just a USB connector, 470nf cap (from VUSB -> GND) and a few decoupling caps. As for the H-bridge afraid I'm not much use there.

There is a pretty good tutorial and a Hitech C for PIC / C# for PC at www.waitingforfriday.com. Used that a few times for projects now and it works well.

hope this helps
 

djsfantasi

Joined Apr 11, 2010
9,156
Thanks a lot everyone!

Theres only one problem though .. As I'm doing it in school, i have to build _EVERYTHING_ myself.. Which means I cant just buy any finished solution.
One of the software engineers at work has as his signature, "if you want to bake a cake from scratch, first you have to invent a universe."
 

THE_RB

Joined Feb 11, 2008
5,438
I like that. :)

It's a bit of overkill compared to the old "first you have to grow the wheat". But taken right to the engineering limit I guess...

Hang on, don't you have to invent "inventing" first? That's a tricky one. ;)
 
Top