× Forum Header

Driving a ULN2003 Darlington array IC

More
28 Sep 2012 10:52 #24688 by BigJohnT
liam2317 wrote:

As far as I can tell doing that does absolutely nothing. Where should I be looking? What do I do after that? Running that hal file doesn't give an error but it doesn't make another axis show up or anything. Looking at it's Show Hal Config page doesn't give me any new info either.

Now I'm really confused.... :S


When you add the forth type of stepgen it will show up when you open show hal configuration and view the stepgen pins you will stepgen 3 which will be of type 5 and have different pins that a type 0 stepgen.

John

Please Log in or Create an account to join the conversation.

More
28 Sep 2012 16:56 - 28 Sep 2012 17:00 #24696 by liam2317
andypugh wrote:

Is this the case even with nothing connected?
What are you measuring with?


Yes, I measured it right out of the parallel port using my Fluke 81438 Digital Multimeter. I measured them when I set the inches/min to a very slow rate so they would each stay on for probably 1/4 second to make sure I could get a good voltage reading.

I should also note that the pins in the parallel port which are not outputting the stepgen signal are showing 5V when set high.

Other notes: My parallel port is on my motherboard, the computer is a desktop, the motherboard is an Asus P4P800-VM.
Last edit: 28 Sep 2012 17:00 by liam2317.

Please Log in or Create an account to join the conversation.

More
28 Sep 2012 17:15 #24697 by PCW
Did you remove the reset function? that is the:

setp parport.x.pin-xx-out-reset 1

As was mentioned by Andy this is simply wrong for this
step mode and is a likely cause of strange behavior

Please Log in or Create an account to join the conversation.

More
01 Oct 2012 02:47 #24773 by liam2317
Yuuuuuup, that was the problem! I think I missed it because it was in the broken quote tag. Oh well.

My test machine is working great! Thank you all for the help, it is very much appreciated!

For anyone in the future trying to figure this out that comes across this thread, below is my final working (2 axis) .hal file:
# .Hal File to drive stepper motors with a ULN2003 or similar IC
# If you make changes to this file, they will be
# overwritten when you run stepconf again
loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt probe_parport
loadrt hal_parport cfg="0x378 out"
setp parport.0.reset-time 5000
loadrt stepgen step_type=6,6,6 

addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread

addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
net spindle-cmd <= motion.spindle-speed-out


#################### Parallel Port Pins:

###  X:
net xpa => parport.0.pin-02-out
net xpb => parport.0.pin-03-out
net xpc => parport.0.pin-04-out
net xpd => parport.0.pin-05-out

### Y:
net ypa => parport.0.pin-06-out
net ypb => parport.0.pin-07-out
net ypc => parport.0.pin-08-out
net ypd => parport.0.pin-09-out

### Z:  ##### UNTESTED:  
### My setup is only a 2 axis setup but theoretically this should work
### Some pin switching/inverting may be required
net zpa => parport.0.pin-01-out
net zpb => parport.0.pin-14-out
net zpc => parport.0.pin-16-out
net zpd => parport.0.pin-17-out



####################  X AXIS 0  
setp stepgen.0.position-scale 300
setp stepgen.0.steplen 100
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd   #uncommented?? 
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xpa <= stepgen.0.phase-A
net xpb <= stepgen.0.phase-B
net xpc <= stepgen.0.phase-C
net xpd <= stepgen.0.phase-D
net xenable axis.0.amp-enable-out => stepgen.0.enable
setp stepgen.0.dirdelay 80 

####################  Y AXIS 1
setp stepgen.1.position-scale 960
setp stepgen.1.steplen 100
setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb
net ypa <= stepgen.1.phase-A
net ypb <= stepgen.1.phase-B
net ypc <= stepgen.1.phase-C
net ypd <= stepgen.1.phase-D
net yenable axis.1.amp-enable-out => stepgen.1.enable
setp stepgen.1.dirdelay 80 

####################  Z AXIS 2
setp stepgen.2.position-scale 400
setp stepgen.2.steplen 100
setp stepgen.2.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb
net zpa <= stepgen.2.phase-A
net zpb <= stepgen.2.phase-B
net zpc <= stepgen.2.phase-C
net zpd <= stepgen.2.phase-D
net zenable axis.2.amp-enable-out => stepgen.2.enable
setp stepgen.2.dirdelay 80

####################

net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in

loadusr -W hal_manualtoolchange
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared

Please Log in or Create an account to join the conversation.

More
11 Jul 2014 09:29 #48630 by tobrien
Hi

I am trying to run LinuxCNC on a raspberry Pi (custom kernel and driver already completed).

I have a ULN2003 driver with a 28BYJ-48-12V stepper motor x 3.

I am looking at the config app and I can't find anything that resembles my Raspberry Pi setup except for a coniguration that Uses only 1 x Drive and 1 x Step pin where I need 4 input pins for the ULN2003 driver. Can somebody please help me out with a config/hal file that I could create to work on a Raspberry Pi with GPIO pins driving the motors via the ULN2003?

Tom

Please Log in or Create an account to join the conversation.

More
12 Jul 2014 08:35 #48678 by andypugh

I am looking at the config app and I can't find anything that resembles my Raspberry Pi setup


I think that the Pi / ULN setup is likely to be almost unique. The good news is that you are blazing a new trail. The bad news is that there is nobody to copy.

I am almost certain that it can be made to work, though.

What GPIO driver are you using on the Pi?

Please Log in or Create an account to join the conversation.

More
20 Jul 2014 19:16 #48969 by dahaka
Hi everyone :)

@liam2317, thx a lot for sharing you code

I am trying myself a 2axis test machine, with the exact driver and step motors as yours, i've done a fresh install of linuxCNC 10.10 version and when i'm trying to run you .hal configuration with "halrun -I -f conf.hal" i get an error "Ini variable '[EMCMOT] EMCMOT' not found" :(

Can you please help me a bit here?

Thanks ;)

Please Log in or Create an account to join the conversation.

More
20 Jul 2014 20:12 #48970 by andypugh

when i'm trying to run you .hal configuration with "halrun -I -f conf.hal" i get an error "Ini variable '[EMCMOT] EMCMOT' not found"


That is because you are not passing an INI file to the hal session.
You can either take the INI variables ( [HEADER]VALUE format) out of the HAL file (I tend not to use them in my machines very much) or pass an ini file to halun as well as the hal file.
www.linuxcnc.org/docs/html/man/man1/halrun.1.html

So, you need a -I and a -i

Please Log in or Create an account to join the conversation.

Time to create page: 0.109 seconds
Powered by Kunena Forum