Mesa 5i25 with plain G540, no 7i77

More
04 Apr 2015 06:24 #57501 by dbotos
Peter,

Thanks! The Y and A motor now rotate in sync when I jog the Y axis.

For doing the direction inversion on the A motor, can I use this line that jaybobc has:

setp hm2_[HOSTMOT2](BOARD).0.gpio.012.invert_output true

or do I need something different?

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

More
04 Apr 2015 07:19 #57503 by PCW

Thanks! The Y and A motor now rotate in sync when I jog the Y axis.

For doing the direction inversion on the A motor, can I use this line that jaybobc has:

setp hm2_[HOSTMOT2](BOARD).0.gpio.012.invert_output true

or do I need something different?


Yes, that will work.

If you want a clue to what that line is doing, take a look at the g540 firmware pin-out:

sudo mesaflash --device 5i25 --readhmid | more

and you will see that I/O bit 12 is stepgens 3's direction pin

Another way to change the direction is to change the sign of a stepgens scale in the ini file

that is, for example change

SCALE = 848.826363

to

SCALE = -848.826363

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

More
04 Apr 2015 08:08 #57506 by dbotos
Now that's elegant when you can fix something with a single character. B) Thanks, Peter!

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

More
11 Apr 2015 10:57 #57673 by dbotos
It's me again, Margaret...

I'm trying to set up my 445nm laser module as a PWM-controlled spindle. I found this post, but I'm trying to decipher exactly what I need to put in my hal file:

www.linuxcnc.org/index.php/english/forum...speed-feedback#53302

So here's what I'm wondering regarding the hal file snippet in the above link:

1) Is the value for the scale variable the number of Hz output per commanded spindle rpm?

2) What's the pwm_frequency variable do?

3) Looking at the 5i25_g540x2.pin file (from the 5i25.zip file on Mesa's website), it shows the PWMGen connected to DB25 pin 14 (i/o 1) as an output. So I'm assuming I can skip the line in BobS's snippet that says "setp hm2_5i25.0.gpio.007.is_output TRUE".

4) Would the next line be something like this since the PWMGen is on i/o 1?

net spindle-enable motion.spindle-on => hm2_[HOSTMOT2](BOARD).0.gpio.001.out

Or is there something that should go in place of gpio.001.out?

5) Next two lines like this?

net spindle-speed-cmd motion.spindle-speed-out => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.value
net spindle-enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.enable

6) Leaving the last two lines about the encoder off since I don't have an encoder.

I'm planning to run a TTL wire from DB25 pin 14 on my passthrough/breakout board to the TTL input on the laser module. Specs for the laser module says it has a max modulation frequency of 20 kHz, which I'm assuming would be 100% power output for scaling purposes.

Thanks,
David

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

More
11 Apr 2015 11:56 #57675 by PCW
I think you may be mixing up PWM (Pulse Width Modulation) with PFM (Pulse Frequency Modulation)

PWM is normally a fixed frequency waveform where the ratio of on to off times is changed.

For example, if you set the 5I25 PWM frequency to 20 KHz and then set the PWM value to 0.5
you will get a 20 KHz signal that is high for 25 usec and low for 25 usec. This is called 50% duty cycle.

If you set the PWM value to 0.10 you will get a 20 KHz signal with 5 usec on time and 45 usec off time
this is a 10% duty cycle. Notice that the sum of on and off times is always 50 usec ( the period of a 20 KHz signal )

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

More
11 Apr 2015 13:01 #57676 by dbotos
Peter,

I think I may have confused myself for a moment there. Now that I look at it again, it's the % "on" time of the PWM signal that controls the laser power, not the frequency as a stated in my last post. The 20 kHz is just the max frequency you can drive the PWM signal at. Attached is a Mach config from the laser manufacturer they sent me a few years back. Looks like it's saying to use a 1 kHz PWM frequency and scale based on a 10,000 rpm max spindle speed. The 10.000 in the second to last sentence of the document is really supposed to be 10,000 (either a typo or a foreign convention - manufacturer is in Turkey). So how would I translate that to hal lines?

Thanks,
David
Attachments:

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

More
11 Apr 2015 21:41 #57684 by PCW
Seems pretty straightforward


You set the PWM frequency to 1000 and the PWM scaling to 10000:
setp hm2_[HOSTMOT2](BOARD).0.pwmgen.pwm_frequency 1000
setp hm2_[HOSTMOT2](BOARD).0.pwmgen.00.scale 10000
The hostmot2 manual describes these parameters

typing
man hostmot2
from a terminal
will open the hostmot2 manual page

(you will have to scroll down to the PWMGEN section to see the PWMGEN parameters
The following user(s) said Thank You: dbotos

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

More
12 Apr 2015 01:58 - 12 Apr 2015 01:59 #57693 by dbotos
Based on Peter's response, BobS's hal file snippet, and the hostmot2 manual , motion manual , and Spindle Control page , I came up with the following hal section for my laser "spindle":

# this is the frequency of the PWM signal (10 kHz) (max for Kale CNC 445 nm 1400 mW module is 20 kHz)
setp hm2_[HOSTMOT2](BOARD).0.pwmgen.pwm_frequency 10000

# this is the spindle speed [rpm] equivalent to 100% laser power
setp hm2_[HOSTMOT2](BOARD).0.pwmgen.00.scale 10000

# start PWMGen ouput when spindle turns on (passes TRUE bit)
net spindle-on motion.spindle-on => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.enable

# pass commanded spindle speed [rpm] to PWMGen value, which gets divided by "scale" to yield PWM duty cycle 
net spindle-speed-cmd motion.spindle-speed-out => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.value

# hm2_[HOSTMOT2](BOARD).0.pwmgen.00.pwm should already be tied to DB25 pin 14 (i/o 1) based on 5i25_g540x2 configuration

I bumped the PWM frequency up to 10 kHz since the hostmot2 manual says "Frequencies below about 5 Hz are not terribly accurate, but above 5 Hz they’re pretty close." I've got the laser's TTL input connected to DB25 pin 14 on my breakout/passthrough board and DB25 pin 18 connected to the laser's ground pin (page 5 of the 5i25 manual says DB25 pins 18-21 are GND) (which essentially makes the laser ground, laser power supply ground, and DB25 ground all common).

So, before I let the magic smoke out of anything, does the above hal file section and physical wiring look like it should work?

Thanks,
David
Last edit: 12 Apr 2015 01:59 by dbotos.

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

More
12 Apr 2015 02:53 - 12 Apr 2015 02:53 #57694 by PCW
A couple of things:

Note that the manual says PWM frequencies are not accurate below about 5 Hz ( _not_ KHz )

So 1 KHz will be quite close in frequency

Not that its very important but a quick calculation shows that the
PWM frequency setting accuracy at 1KHz is about 1 part in 3000.

10 KHz may be a bad choice if it's at the limits of the laser drivers capabilities.

You might test the output with a LED and a resistor connected to Pin14
Last edit: 12 Apr 2015 02:53 by PCW.
The following user(s) said Thank You: dbotos

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

More
12 Apr 2015 09:02 #57706 by dbotos
Oops - yes you're right it's 5 Hz. I set my PWM frequency back to 1 kHz. I found a good diode to test it out with - it already had all the wires hooked up...



^^^1" square on cardboard, 100% power, 30 IPM B) <-- me with my laser safety googles on

Now I need to get SheetCAM installed and remember how to use it... It was in the latter half of 2013 that I decided to ditch Mach3 and make the switch to LinuxCNC and Mesa hardware. I got busy with other stuff in 2014 and finally got back to it this Spring. One of those things I wish I did sooner now that I see it wasn't too bad. I'm sure I'll be back with more questions when I go to hook up my plasma and torch height control. Thanks for all the help!

David
Attachments:

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

Moderators: PCWjmelson
Time to create page: 0.105 seconds
Powered by Kunena Forum