|
|
 |
10-06-2010, 05:00 PM
|
#1
|
|
Lifer
Join Date: Jan 2001
Posts: 36,692
|
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.
__________________
should have != should of
should have = should've
If we were better at documenting our lives,
future historians would be unemployed.
|
|
|
10-06-2010, 05:07 PM
|
#2
|
|
Diamond Member
Join Date: Jun 2007
Location: San Jose, USA
Posts: 6,350
|
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
|
|
|
10-06-2010, 05:19 PM
|
#4
|
|
Lifer
Join Date: May 2001
Location: Bay Area, CA
Posts: 11,604
|
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"
|
|
|
10-06-2010, 05:45 PM
|
#5
|
|
Lifer
Join Date: Jan 2001
Posts: 36,692
|
Quote:
Originally Posted by Drako
|
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.
__________________
should have != should of
should have = should've
If we were better at documenting our lives,
future historians would be unemployed.
|
|
|
10-06-2010, 06:56 PM
|
#6
|
|
Diamond Member
Join Date: Jun 2007
Location: San Jose, USA
Posts: 6,350
|
Quote:
Originally Posted by Jeff7
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
|
|
|
10-06-2010, 07:26 PM
|
#7
|
|
Lifer
Join Date: Feb 2007
Location: North Carolina
Posts: 16,237
|
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.
|
|
|
10-06-2010, 07:31 PM
|
#8
|
|
Diamond Member
Join Date: Apr 2002
Posts: 9,227
|
Quote:
Originally Posted by Modelworks
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.
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:22 AM.
|