Driving step motors with ULN2003 like drivers???
20 Apr 2014 19:39 #46134
by hammem
Driving step motors with ULN2003 like drivers??? was created by hammem
Haloo!!!
I have made 3 axis based on this hal file :
linuxcnc.org/emc2/index.php/english/foru...on-array-ic?start=10
And it works quite well.
Question :
Now when the motor is not turning LinuxCnc keeps one pin high to hold position.
Can I "turn of" of put a "timeout" on "holding position" when movment stops???
I have made 3 axis based on this hal file :
linuxcnc.org/emc2/index.php/english/foru...on-array-ic?start=10
And it works quite well.
Question :
Now when the motor is not turning LinuxCnc keeps one pin high to hold position.
Can I "turn of" of put a "timeout" on "holding position" when movment stops???
Please Log in or Create an account to join the conversation.
20 Apr 2014 21:18 #46137
by PCW
Replied by PCW on topic Driving step motors with ULN2003 like drivers???
Sure but its a bit of work...
Here's one way using a oneshot component, a xor2 component,
and four and2 components (per axis):
Connect the stepgens step-A and step-B signals to a xor2 component.
The output of the xor2 component will now toggle for every step.
Now wire the output of the xor2 component into a oneshot components
trigger pin. Set the oneshot's retriggerable, rising and falling parameters true.
Set a reasonable timeout via the oneshots's width parameter.
Next wire the oneshot's out pin to in0 of four and2 components
and wire the in1 of the four and2 components to the four stepgen
output pins. Finally wire the out pins of the four and2 components
to the parallel port pins.
Here's one way using a oneshot component, a xor2 component,
and four and2 components (per axis):
Connect the stepgens step-A and step-B signals to a xor2 component.
The output of the xor2 component will now toggle for every step.
Now wire the output of the xor2 component into a oneshot components
trigger pin. Set the oneshot's retriggerable, rising and falling parameters true.
Set a reasonable timeout via the oneshots's width parameter.
Next wire the oneshot's out pin to in0 of four and2 components
and wire the in1 of the four and2 components to the four stepgen
output pins. Finally wire the out pins of the four and2 components
to the parallel port pins.
The following user(s) said Thank You: hammem
Please Log in or Create an account to join the conversation.
21 Apr 2014 06:42 #46153
by andypugh
Replied by andypugh on topic Driving step motors with ULN2003 like drivers???
Maybe the ideas here can help?
thread.gmane.org/gmane.linux.distributio...er/26042/focus=26173
thread.gmane.org/gmane.linux.distributio...er/26042/focus=26173
The following user(s) said Thank You: hammem
Please Log in or Create an account to join the conversation.
23 Apr 2014 22:00 #46253
by hammem
Replied by hammem on topic Driving step motors with ULN2003 like drivers???
Thank you very much!!
Although problem is advanced, I am not.
The hardware solution proposed by PCW is simply way above my capabilities,but thanks any way.
This link from andypugh looks like much simpler solution .
Does anyone knows where I should put this code:
> I STILL don't like it. You need a HAL component that looks at commanded
> position
> (comes from axis.8.motor-pos-cmd, I think) and compares current to last
> position.
Whilst also not liking it, this custom HAL component would do the
trick: (It needs to be compiled with comp --install timeout.comp)
component timeout """Reduces motor command to a predetermied value after a
certain number of seconds of no axis motion""";
pin in float position-command-in "link to motor-pos-cmd";
pin in float current-in "link to the PID output";
pin out float current-out "link to the DAC";
param rw float timeout = 10 "timeout in seconds";
param rw float default-current = 0 "current output after timeout";
variable float old_pos;
variable float t = 0;
function _;
license "GPL";
author "Andy Pugh";
;;
FUNCTION(_){
if (old_pos != position_command_in){
t = timeout;
}
else {
t -= fperiod;
}
if (t < 0){
current_out = default_current;
}
else {
current_out = current_in;
}
old_pos = position_command_in;
}
--
atp
Although problem is advanced, I am not.
The hardware solution proposed by PCW is simply way above my capabilities,but thanks any way.
This link from andypugh looks like much simpler solution .
Does anyone knows where I should put this code:
> I STILL don't like it. You need a HAL component that looks at commanded
> position
> (comes from axis.8.motor-pos-cmd, I think) and compares current to last
> position.
Whilst also not liking it, this custom HAL component would do the
trick: (It needs to be compiled with comp --install timeout.comp)
component timeout """Reduces motor command to a predetermied value after a
certain number of seconds of no axis motion""";
pin in float position-command-in "link to motor-pos-cmd";
pin in float current-in "link to the PID output";
pin out float current-out "link to the DAC";
param rw float timeout = 10 "timeout in seconds";
param rw float default-current = 0 "current output after timeout";
variable float old_pos;
variable float t = 0;
function _;
license "GPL";
author "Andy Pugh";
;;
FUNCTION(_){
if (old_pos != position_command_in){
t = timeout;
}
else {
t -= fperiod;
}
if (t < 0){
current_out = default_current;
}
else {
current_out = current_in;
}
old_pos = position_command_in;
}
--
atp
Please Log in or Create an account to join the conversation.
23 Apr 2014 22:14 #46255
by andypugh
www.linuxcnc.org/docs/html/hal/basic_hal.html
www.linuxcnc.org/docs/html/hal/comp.html
> I STILL don't like it. You need a HAL component that looks at commanded
> position
> (comes from axis.8.motor-pos-cmd, I think) and compares current to last
> position.
Whilst also not liking it, this custom HAL component would do the
trick: (It needs to be compiled with comp --install timeout.comp)
component timeout """Reduces motor command to a predetermied value after a
certain number of seconds of no axis motion""";
pin in float position-command-in "link to motor-pos-cmd";
pin in float current-in "link to the PID output";
pin out float current-out "link to the DAC";
param rw float timeout = 10 "timeout in seconds";
param rw float default-current = 0 "current output after timeout";
variable float old_pos;
variable float t = 0;
function _;
license "GPL";
author "Andy Pugh";
;;
FUNCTION(_){
if (old_pos != position_command_in){
t = timeout;
}
else {
t -= fperiod;
}
if (t < 0){
current_out = default_current;
}
else {
current_out = current_in;
}
old_pos = position_command_in;
}
--
atp[/quote]
Replied by andypugh on topic Driving step motors with ULN2003 like drivers???
It was a software solution, using existing HAL components.The hardware solution proposed by PCW is simply way above my capabilities,but thanks any way.
www.linuxcnc.org/docs/html/hal/basic_hal.html
It is a custom HAL component.This link from andypugh looks like much simpler solution .
Does anyone knows where I should put this code:
www.linuxcnc.org/docs/html/hal/comp.html
> I STILL don't like it. You need a HAL component that looks at commanded
> position
> (comes from axis.8.motor-pos-cmd, I think) and compares current to last
> position.
Whilst also not liking it, this custom HAL component would do the
trick: (It needs to be compiled with comp --install timeout.comp)
component timeout """Reduces motor command to a predetermied value after a
certain number of seconds of no axis motion""";
pin in float position-command-in "link to motor-pos-cmd";
pin in float current-in "link to the PID output";
pin out float current-out "link to the DAC";
param rw float timeout = 10 "timeout in seconds";
param rw float default-current = 0 "current output after timeout";
variable float old_pos;
variable float t = 0;
function _;
license "GPL";
author "Andy Pugh";
;;
FUNCTION(_){
if (old_pos != position_command_in){
t = timeout;
}
else {
t -= fperiod;
}
if (t < 0){
current_out = default_current;
}
else {
current_out = current_in;
}
old_pos = position_command_in;
}
--
atp[/quote]
Please Log in or Create an account to join the conversation.
Time to create page: 0.101 seconds