Go Back   AnandTech Forums > Social > Off Topic

Forums
· Hardware and Technology
· CPUs and Overclocking
· Motherboards
· Video Cards and Graphics
· Memory and Storage
· Power Supplies
· Cases & Cooling
· SFF, Notebooks, Pre-Built/Barebones PCs
· Networking
· Peripherals
· General Hardware
· Highly Technical
· Computer Help
· Home Theater PCs
· Consumer Electronics
· Digital and Video Cameras
· Mobile Devices & Gadgets
· Audio/Video & Home Theater
· Software
· Software for Windows
· All Things Apple
· *nix Software
· Operating Systems
· Programming
· PC Gaming
· Console Gaming
· Distributed Computing
· Security
· Social
· Off Topic
· Politics and News
· Discussion Club
· Love and Relationships
· The Garage
· Health and Fitness
· Home and Garden
· Merchandise and Shopping
· For Sale/Trade
· Hot Deals with Free Stuff/Contests
· Black Friday 2014
· Forum Issues
· Technical Forum Issues
· Personal Forum Issues
· Suggestion Box
· Moderator Resources
· Moderator Discussions
   

Reply
 
Thread Tools
Old 10-06-2010, 06:00 PM   #1
Jeff7
Lifer
 
Jeff7's Avatar
 
Join Date: Jan 2001
Posts: 39,071
Default Stepper and servo motor control, with a PIC. Where to start?

A project at work has me a bit interested in some of this stuff. The simple version of the project is:
Move a backstop using forward and backward buttons, but when it's in the stop position, the motor needs to hold its position.

More complex version:
Enter a value into a controller, and have the motor move to that position, using some manner of linear encoder, likely an optical one, something like this.

I'd like to use a PIC chip, either PIC18 or PIC32, to control this whole mess, and use Microchip's MPLAB compiler.


What's a good, and not terribly-expensive, way to get started on learning the basics of motor control in this manner?
I would have limited access to a circuit board router in order to make something like a breakout board to give some convenient pinouts for the PIC32 (TQFP package), for some breadboarding.
__________________
.
"Homeopathy is what happened when snake oil salesmen discovered that water is cheaper than snake oil."
Jeff7 is offline   Reply With Quote
Old 10-06-2010, 06:07 PM   #2
Drako
Diamond Member
 
Drako's Avatar
 
Join Date: Jun 2007
Location: San Jose, USA
Posts: 8,446
Default

I would use a DIP package PIC, and just bread board the design up. Stay away from surface mount parts.

And here's a tips doc from microchip that may be helpful to you, or not

http://ww1.microchip.com/downloads/e...doc/41233A.pdf
Drako is offline   Reply With Quote
Old 10-06-2010, 06:13 PM   #3
Drako
Diamond Member
 
Drako's Avatar
 
Join Date: Jun 2007
Location: San Jose, USA
Posts: 8,446
Default

Buy one of these, if you don't have one, or something similar.

http://search.digikey.com/scripts/Dk...name=922318-ND
Drako is offline   Reply With Quote
Old 10-06-2010, 06:19 PM   #4
Lithium381
Lifer
 
Lithium381's Avatar
 
Join Date: May 2001
Location: Bay Area, CA
Posts: 12,466
Default

A PIC18 would probably be a better platform for you, as it's available in DIP package and has plenty of horsepower for what youre trying to do. There may be similar projects online that can help give you an idea. The link DRAKO gave is pretty sweet, i had never seen that document before, but it gives a good overview. there are lots of hobby sites dedicated to robot-making, that could provide you with a lot of insight. i only very recently got into the hobby. if there is anything i can do to help, PM me.
__________________
"This action has caused a division of the people into classes: Those the government deems valuable enough to protect with modern firearms, and those whose lives have been deemed as having less value, and whom the government has decided do not deserve the right to protect themselves with the same firearms." Olympic Arms > NY
"I saw a movie once where only the police and military had guns; it was called Schindler's List"
Lithium381 is offline   Reply With Quote
Old 10-06-2010, 06:45 PM   #5
Jeff7
Lifer
 
Jeff7's Avatar
 
Join Date: Jan 2001
Posts: 39,071
Default

Quote:
Originally Posted by Drako View Post
I would use a DIP package PIC, and just bread board the design up. Stay away from surface mount parts.

And here's a tips doc from microchip that may be helpful to you, or not

http://ww1.microchip.com/downloads/e...doc/41233A.pdf
Well...I'd also like to use this as a chance to get acclimated to the PIC32, which only comes in a surface mount package. I've already got access to a breakout board that has standard 0.100" pinheaders on it, and I could simply get a circuitboard routed out that would provide some manner of pinout interface, or whatever I'd need.
Though, well, I don't know how different it is working with the PIC32 vs one of their 18F line.
And I've got myself a nice breadboard already. Cheaper, too.

I've already worked with the 12F675, 16F72, 18F2520, and 18F4520. (The latter two are nearly the same - the 4520 just has more I/O pins, and I believe more memory as well.)
However, I've done all the programming using CCS' PIC-C compiler. It has some nice things that make programming easier, but this also can make it tough to access the really low-level functions of the PIC, without diving into assembly language. So I'd like to get acquainted with Microchip's MPLAB compiler. It's free, and, well, it's Microchip's own compiler, so what better thing to use than that on their microcontrollers?


And I shall certainly read the motor control app note PDF. Thank you for that.
__________________
.
"Homeopathy is what happened when snake oil salesmen discovered that water is cheaper than snake oil."
Jeff7 is offline   Reply With Quote
Old 10-06-2010, 07:56 PM   #6
Drako
Diamond Member
 
Drako's Avatar
 
Join Date: Jun 2007
Location: San Jose, USA
Posts: 8,446
Default

Quote:
Originally Posted by Jeff7 View Post
Well...I'd also like to use this as a chance to get acclimated to the PIC32, which only comes in a surface mount package. I've already got access to a breakout board that has standard 0.100" pinheaders on it, and I could simply get a circuitboard routed out that would provide some manner of pinout interface, or whatever I'd need.
Though, well, I don't know how different it is working with the PIC32 vs one of their 18F line.
And I've got myself a nice breadboard already. Cheaper, too.

I've already worked with the 12F675, 16F72, 18F2520, and 18F4520. (The latter two are nearly the same - the 4520 just has more I/O pins, and I believe more memory as well.)
However, I've done all the programming using CCS' PIC-C compiler. It has some nice things that make programming easier, but this also can make it tough to access the really low-level functions of the PIC, without diving into assembly language. So I'd like to get acquainted with Microchip's MPLAB compiler. It's free, and, well, it's Microchip's own compiler, so what better thing to use than that on their microcontrollers?


And I shall certainly read the motor control app note PDF. Thank you for that.
Sounds to me like you should get these:

http://search.digikey.com/scripts/Dk...=DM320003-2-ND

http://search.digikey.com/scripts/Dk...me=876-1000-ND
Drako is offline   Reply With Quote
Old 10-06-2010, 08:26 PM   #7
Modelworks
Lifer
 
Modelworks's Avatar
 
Join Date: Feb 2007
Location: North Carolina
Posts: 16,237
Default

Stepper motors are really easy. You just power each coil in order and the motor will rotate that many degrees or step.
You can use the pic chips you already have. You just need something that can drive the motor power since pics limit at around 20ma.
I use the ULN2004A chips. You can get them off ebay cheap.
Then you just pull a pin high for each wire on the motor you want to turn on. Let the motor turn then pull the pin back low. Move to the next pin in the sequence and continue.
So to do a full rotation you would have to do
pin 1 - H L
pin 2 - H L
pin 3 - H L
pin 4 - H L

And repeat for every revolution.
Modelworks is offline   Reply With Quote
Old 10-06-2010, 08:31 PM   #8
PottedMeat
Lifer
 
PottedMeat's Avatar
 
Join Date: Apr 2002
Posts: 10,510
Default

Quote:
Originally Posted by Modelworks View Post
Stepper motors are really easy. You just power each coil in order and the motor will rotate that many degrees or step.
You can use the pic chips you already have. You just need something that can drive the motor power since pics limit at around 20ma.
I use the ULN2004A chips.
those are handy. just remember they're limited to ~500mA per driver, anything else and you'll need an output MOSFET/BJT at the rated current and a separate diode clamp.
PottedMeat is offline   Reply With Quote
Reply

Tags
motion control, servo motor, stepper motor

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 10:07 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.