On Mon, 2011-11-14 at 18:41 -0800, Chris Reynolds wrote:
> So I've been running my mini-mill with EMC2 now for almost 2 years,
> and I've gotten to where I'm interested in having the spindle
> controlled by EMC2, as well as possibly a tool changer. So I started
> reading the wiki about spindle control, and I've been reading through
> the HAL manual, and quite honestly I feel dumb. 
> 
> 
> There are so many things that I don't get, like 

> do I need to ditch the motor controller that's in the mini-mill and
> replace it with an H-Bridge? Or do I somehow tie EMC2 into the
> existing motor controller circuit board? etc etc.

What kind of spindle motor and controller do you have? Most mini-mills
have a DC motor that runs at 90 Volts DC. The controller is usually an
SCR type:
http://www.wallacecompany.com/machine_shop/kbic/

with a potentiometer that sets the speed (see bottom right of above
link). The motor usually is driven in one direction or has a manual
switch or other means to get the spindle to run in reverse when needed.

EMC2 can be used by replacing the potentiometer with an opto-coupler and
a PWM signal. The opto-coupler mimics the potentiometer by turning on
for a short time then off for a short time. The ratio between ON time
and OFF time sets the speed. EMC2 is then set up using HAL components to
connect the HAL spindle speed pin to a pwmgen component and parport.
This will control the speed but not the direction. An H-bridge or a
relay could be used on the SCR controller output to switch the motor
wires to make it turn forward or reverse. The HAL spindle direction pin
could be connected to parport pins then to the bridge input pins. SCR
speed controllers don't like the output switched while the output is on,
so the direction should _not_ be changed while the motor is being
driven.

>   I don't get why I'm having so much trouble getting my head around
> this stuff.  And I haven't even begun to look into what it would take
> to control an automatic tool changer. The more I read the more
> confused I get. hahaha 
> 
>  
> Chris

The key to EMC2's tool change is the iocontrol.0.tool-prepare and
iocontrol.0.tool-change connections in your .hal file. The standard
setup is:
"
# create signals for tool loading loopback
net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed
"

This "short circuits" the signals so that when a g-code Tx is invoked,
to prepare a tool for a change, the request immediately trips the
prepared input which tells EMC2 the tool is prepare is done. When an M6
g-code is invoked to start a tool change, this signal is also routed
into tool-changed to signal the change is finished. This is set up this
way for machines that don't have tool changers, so that the the g-code
program will keep running if Tx or M6 is in the program. For machines
with changers the short circuit is disconnected and the signals routed
to component pins that invoke software or hardware that does the prepare
and change. Here is my part of my lathe setup:
"
### TURRET ###
# create signals for tool loading loopback
linkpp iocontrol.0.tool-prepare iocontrol.0.tool-prepared
linkpp iocontrol.0.tool-change turret.0.position-change
linkpp turret.0.position-changed iocontrol.0.tool-changed

"

Prepare is still "shorted" because there is nothing my lathe can do to
prepare for a change. The change signal is routed to a pin on my turret
component. When the turret is done changing and is parked, a signal is
returned to iocontrol to tell EMC2 the change is done. If and how you
need to connect the prepare and change signals depends on the kind of
changer you have and what will control the prepare and change
mechanisms. I wrote a HAL component using C to control my turret, others
have used Classic Ladder, or you could use an external PLC or
micro-controller. 

There are a lot of details I haven't covered but this should get you
started. 

-- 
Kirk Wallace
http://www.wallacecompany.com/machine_shop/
http://www.wallacecompany.com/E45/index.html
California, USA


------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to