2011년 12월 27일 화요일

Add an industrial NEMA17 Stepper Motor to your CUBLOC or CuTOUCH

http://zedomax.com/blog/zedomax-diy-hack-add-an-industrial-nema17-stepper-motor-to-your-cubloc-or-cutouch/

Add an industrial NEMA17 Stepper Motor to your CUBLOC or CuTOUCH.
(CublocStudio v1.5.A & Above)
[gv data="PJHhXAL6iVY"][/gv]
Do u want to add a NEMA17 stepper motor to your CUBLOC or CuTOUCH?
Here’s how to do it w/ the new CublocStudio v.1.5.A.
Today we will use a R208 Microstep Driver from RMS Technologies and a NEMA-17 Stepper Motorfrom AutomationDirect.com.
I was thinking today
that I needed to make use of the some stepper motors for industrial apps.
With the 3 new commands w/ CublocStudio v.1.5.A upgrade,
I think I can control a stepper motor very precisely and accurately.
Anyways, my plan is to eventually make some robots with this stepper motor, here we go.

Required Parts:
1 R208 Microstep Driver
order from www.linengineering.com

1 NEMA-17 Stepper Motor
(any NEMA17 Stepper Motor would work)
Part #
STP-MTR-17048
order from www.automationdirect.com
1 CB280

1 Study Board
Motor Driver & Motor Connections
All right, first, I decided to have a look at the R208 Microstep Driver manual.
If you skim through, you will find the pin assignments and a diagram like this:
As you can see here, you want to connect as shown.
Connecting the motor should be pretty easy to do.
You can ground Pin 2,3 for now to set at FULL step mode,
which will turn the motor a FULL step per pulse sent from CUBLOC.
Here’s the pin2 and 3 specs:
I decided to connect direction Pin 5 to 5V for now,
but I can hook it up to one of the CUBLOC I/O pins to control direction later.
Connect Pin 9(Yellow) to any of the I/O pins on the CUBLOC.
I’ve connected mine to P5, port 5.
Let’s take a brief look at the motor specs too:
and:
The chart here shows that the motor will have a different characteristics depending on the stepping method used.
We are using Full step, so we should have lots of torque,
but shouldn’t expect too much RPMs…
After putting everything together, you should get something like below:
There are 3 new commands for stepper motor w/ the new CublocStudio.
Command
Syntax
Features
STEPPULSE
STEPPULSE [channel], [Port Number], [Frequency], [# of pulses]
Output set number of pulses @ set frequency to set port.
- Maximum Frequency: 15KHz
- Channel must equal 0
- When using channel 0, PWM 3,4,5 may not be used
STEPSTOP
STEPSTOP channel
Stop outputting pulses
STEPSTAT( )
variable = STEPSTAT(channel)
Return # of pulses left to output
The channel is referred to as Steppulse channels.
But as of now, you can only have 1 channel for CB220, CB280, CB290, CT1720, and CT1721.
(Classified: Future modules CB4XX, will have 2 channels.)
Anyways, you can set the any Port to output your step pulses.
This command will accurately output desired # of pulses @ desired frequency up to 15kHz,
which is what you need for Step motor control.
Now, let’s make a simple BASIC code that will output to my NEMA17 motor @ 1kHZ.
Source Code
[steppermotor001.cul]Const Device = CB280
#define PORTNUMBER 5
Dim ct As Long
Dim steps As Integer
Dim Frequency As Long
Output PORTNUMBER
ct=0
Frequency=100
steps=Stepstat(0)
Debug Dec steps,Cr
Do
Steppulse 0,PORTNUMBER,Frequency,1000
‘Stepstat() function returns current # of steps
steps=Stepstat(0)
Do While steps>0
steps=Stepstat(0)
Debug Dec steps,Cr
Loop
Debug “Frequency: “, Dec Frequency,Cr
If Frequency<1200 Then
Frequency = Frequency + 400
End If
Delay 300
Loop
As you can see in the above, Steppulse 0,PORTNUMBER,Frequency,1000
command will output 1000 pulses to the step motor starting @ frequency of 100Hz.
This motor is rated at 1.8 degrees per step which equals 200 steps per revolution.
By outputting 1000 pulses, the motor should turn 5 times since 1000/200 = 5.
We will use Stepstat() to wait until all the pulses have been outputted
before increasing the Frequency by 400Hz and outputting pulses again.
You should see the motor slowly increasing in speed and topping out at 1.2kHz.
You can do higher frequencies by adjusting the motor driver’s pin 2 and pin 3,
which will allow you to get higher resolution up to 1/8 steps.
If you look at the following video,
you can see that at maximum speed of my motor stopping at the tip of my finger every 5 turns.
Now I think u should be able to make some stepper motor apps pretty easily…

If you are having any trouble with above app, please e-mail max@zedomax.com
If you have any cool apps you’d like to share, please e-mail to max@zedomax.com

댓글 없음:

댓글 쓰기