laser module pins etc.

I am wondering how the laser module works with a glass tube co2 laser. It requires a pmw signal (or 0-5v analog) for the power. It then requires a seperate on/off TTL signal of 0 or 5v to actually fire the laser at the prescribed power set by the pwm.

In the laser module example on your site it says the laser pin goes high and low for g0 and g1,2,3 moves. But I would also like to have a seperate pin that uses pwm to set the laser power. But when you read the laser instructions and the config file it only has one laser pin and it says that will be pwm to vary laser power. That may work for RF laser tubes or Laser diodes but it is not working for Co2 glass tubes?

How hard would it be to have the smoothie just have a pinA for the laser on laser of 0 or 5v TTL signal and pinB as a PWM power pin. Then like you say if g0 low g1 high it turns the laser on and off and you can type s125 for example to set the power (PWM) once and it stays that way the whole file unless you add another Sxxx command.

Otherwise it seems like I would just rather skip the laser module and have a m106 to fire the laser and m107 to turn it off etc. and say S128 once at the begining of the file.

Imported from wikidot

In the laser module example on your site it says the laser pin goes high and low for g0 and g1,2,3 moves. But I would also like to have a seperate pin that uses pwm to set the laser power.

That’s what the laser pin does. It modulates power *and* turns off for G0 moves.

You generally want to use the PWM pin to control everything, and keep the TTL signal ON all the time.
If you want to control the TTL signal separately, you can use a Switch module to do so.

Otherwise it seems like I would just rather skip the laser module and have a m106 to fire the laser and m107 to turn it off etc. and say S128 once at the begining of the file.

The laser module does more than that, it actually changes power proportional to speed. If power was constant, varying speeds ( accel/decel etc ) would mean dirty cuts.

My main point is this is for cutting and not engraving so we want a an (on/off) TTL (0v or 5v) (High or Low) that would never ever need to be PWM or duty cycled for any reason ever, ever. Then we could have a seperate PWM pin that sets the power that is always going at the prescribed pwm rate until you type Sxxx to change the power (or smoothie changes the power dynamically as it accelerates around curves etc.)

If this is not how the laser module works then I would pay someone to make the code so it would work. To tell you the truth the jt photonics plugin or whatever its called puts out what seems to be perfect gcode for me except it does not account for g0 being off and g1 being on it rather puts anything you select or aka m106 on and m107 off and it does put s128 etc. for power. that is a real simple plugin that I can use for inkscape.

I haven’t found any software that generates gcode favorable for the laser module or anyway to set up a laser tool in inkscape to spit out g0 and g1 codes so I am stuck here with my smoothie.

The only way I would fix it would be to set the laser max to 100% and min to 0% and then use an arduino to send a constant duty cycle to the pwm(analog 0-5V) pin on the co2 laser power supply and send the smoothies laser pin to the TTL on /off. That seems silly but since I cant code in smoothie I am stuck doing what I would have to. Then in smoothie would have problems like you say around curves i would just have to set the overall power high enough to still cut through at the slowest it would go on the curves. but again that is all basically the opposite of why i bought a smoothie and would just jump ship and get a DSP and be done with it.

I am just a little dissapointed The Glass Tube power supplies are clearly not meant to be ran this way and I am afraid I don’t know enough to just start coding new stuff in. Basically the laser module as it is is not going to work for me. I bought this because of the laser module and I have a few ideas how it could work for me But I would need a little help and I dont know if I would get it unless it came from you Aurthur because you type in laser on the forum and there is not many posts.

Can you do this, when you set the max laser power in config use that to a pin for a constant PWM only changed by the speed change. I would then hook this pin up to the pwm on the power supply like its supposed to be and adjust this pin when its cutting a curve etc. this would fix all my problems. Sounds like it may be simple I would just need it done for me I would pay to have it done.

Then I could learn how to set up a switch for m106 m107 to fire the laser.(I mean to me that sounds like it should be easier code than using the G0 G1 etc for on off and pwm) I cut 3mm acrylic and I never change the power or speed settings It would make my life much easier if I could just set the power in config and have that go straight to a pwm pin at a constant rate only changed by the “math” that i heard of when buying smoothie over other solutions.

Cant we just keep the laser module delete the whole part about G0, G1, G2 turning it on and off and keep the part to do with ON SPEED CHANGE and just make it change the maximum power setting in config?

Or cant you just make2 laser pins?… laser pin1 and laser pin2, make laser pin 1 put out the pmw and speed/power change and then make laser pin 2 turn high or low when its a G0, or G1.

So there are a few solutions to this just how much and who do I have to pay to change the laser module?

In the laser module example it says this but it seems not true Durring G0 moves it may verywell be low but durring g1 movies it is not high its a PMW duty cycle
That’s it, now the Laser pin will be LOW during G0 moves, and HIGH during G1 G2 and G3 moves.

But that’s not enough. Because we use acceleration, the speed is not constant. And thus if the power of the laser stays constant, that power will be too much when accelerating and decelerating.
So we need to have a laser power that is proportional to the instant speed of the robot.
That’s the kind of thing the on_speed_change event is for.

So when I bought smoothie I assumed it did what it said and this is the paragraph where i got confused or its unclear one or both. The statement cant be true it is constantly being pwm’ed around curves or if you set the max power lower than 100% that pin it can never be HIGH durring a G1 move?

So I either need a second laser pin one for pwm and one for TTL on off, or i need the entire part about g0, g1 moves turning it on and off removed and keep the on speed change “math” parts we all heard about in the smoothie vs other controller discussions.

Hello.

I thinks you might be confused or not understanding something here, and if you stick with me, we’ll get to the bottom of this.

There are hundreds of Smoothie users using it on lasers, most on CO2 tubes, and most using a single pin ( PWM ) for control. This works perfectly fine both for cutting and engraving, and there is no limitation to doing this that I can see.

Can you please explain why you think it is so important to use two pins ?

( please note, if you want to use two pins, that is also possible, and both single and dual pin modes are fully supported and require no coding ).

Why is the G0/G1 stuff a problem for you ?

I can assure you Smoothie completely supports laser cutting and engraving, and there is nothing you need to code. You are probably just not understanding something about how it works.

Cheers.

PS ; Please note the moduleexample page is an example of how to code a module for smoothie, and uses an extremely simplified version of the laser module of educative reasons. There is no reason you would have to look at this, or code anything, to set up a laser with Smoothie. When setting up a laser cutter, you should completely ignore that page and refer to the laser-cutter-guide instead.

the laser PSU takes the pwm signal smoothie sends it then converts it into an analog signal. of 0-5v. The psu takes that to use only for the power I understand hooking it up the way they did not intend works but it can damage the life of the PSU and the CHinese tubes I have verified this already and its unnegotiable for me and frankly you have it set up wrong.

Why do I not like the G0 G1 well Can you show me a plugin or software program that generates that code? The J T Photonics inkscape plugin is 100% ideal for me but it outputs simple m106 m107 and sxxx commands for power and laser on off. I can change the m106 to actually say anything if that helps to turn it on and another anything to turn it off.

Its really simple I need to have the PWM that go into the PWM on the laser PSU. It can be set by the max power in config or it can be set by a sxxx command I dont care at this point but I would like the on speed change to effect this pin. THen i need a second pin however you turn it on and off for the laser TTL high Low on/off.

How do I use 2 pins on smoothie one to send on off via full 5v or 0v TTL signal and the second pin for pwm power setting. Of course I want the power change on speed to still work but based on that pmw pin and that power setting.

the laser PSU takes the pwm signal smoothie sends it then converts it into an analog signal. of 0-5v. The psu takes that to use only for the power I understand hooking it up the way they did not intend works but it can damage the life of the PSU and the CHinese tubes I have verified this already and its unnegotiable for me and frankly you have it set up wrong.

Can you tell me more about this ? I see no reason why this would be the case, many users do this with no problem, including in fablabs and companies with high usage of the machines, for many years now, and with no out-of-the-ordinary problems with component life expectancy.

Why do I not like the G0 G1 well Can you show me a plugin or software program that generates that code?

Sure, Cambam, Visicut and Fusion360 all generate Gcode the way Smoothie expects it, others do too. I know at least two Inkscape plugins do so too ( I’ve never used them so I dont know much about this but others could give more details ).
Really its very standard, it’s essentially the same Gcode as when CNC milling ( you sorta consider the laser as a very thin endmill essentially ), so lots of software designed for CNC milling can be used as-is for laser cutting.

The way you describe ( M106 S ) sounds like a dirty hack to get laser cutting to work with old 8-bit electronics that had that Gcode to control fans … You could get this to work with Smoothie ( which supports fans too ) but you’d loose proportional power.

You can *also* wire with the TTL pin to be controlled by M106/M107, *and* a separate PWM pin to be controlled by the laser module, that is totally possible, requires no coding, would work fine, and sound like what you want, correct ?

Its really simple I need to have the PWM that go into the PWM on the laser PSU. It can be set by the max power in config or it can be set by a sxxx command I dont care at this point but I would like the on speed change to effect this pin. THen i need a second pin however you turn it on and off for the laser TTL high Low on/off.

Sure thats supported ( as described above ), I’m not sure what the problem is.

Sounds like you have a problem understanding how to set things up rather thatn a problem with somethings not being supported.

Cheers.

The thing is I have 2 RF metal tube lasers and smoothie would work perfect the way you have it setup with a metal (expensive) RF laser tube like in an Epilog, or universsal, or GCC laser. All a RF tube needs is a PMW signal and from that it tells the laser to fire and what power all in one.

But Chinese Glass tubes are meant to be fired constant on and then off when not used via a 5v TTL signal. When on it uses the pwm or maybe not even a PMW I could use an analog 5v an arduino or a potentiomenter or even a plain resistor to set a steady power supply.

I can do all that without smoothie using an arduino but what I am interested in is using the power and speed changes of smoothie

All I need is a pmw pin to set a power and then when smoothie thinks it needs to increase or decrease that power for going around curves etc. and another pin to turn it off or on it can be a pmw pin but it should be a straight up 5v or 0v signal.

Like I said having a PSU litteraly wired to on all the time is not good for the tube or the PSU. I talked to people in china and people on cnc forum and engravers forum its quite simple should be ran the way its designed a 5v ttl signeal for on off and a pwm or 5v analog signal AKA potentiometer of a K40.

Help me evolve past the potentiometer on the k40 stage where you adjust the power on curves like the advertising showed. whatever steps it takes Ill do it but its not clear how to me.

I really really assure you that keeping TTL on and using PWM to both regulate power and turn the laser off works fine, and is what *at least* a hundred users are doing.

But let’s ignore this, some people wire it the way you want to, so you can if you want, that’s supported no problem.

It’s very simple really :

First choose a GPIO pin on the Smoothieboard, wire it to the TTL signal on the laser PSU, and then configure a Switch module so that the M106/M107 Gcodes control that pin : http://smoothieware.org/switch

Then choose a PWM-capable pin, wire it to the PWM signal on the laser PSU, and configure the laser module to control that pin : http://smoothieware.org/laser

That should be all you need. Please tell me if you have any questions.

Cheers.

Hi, We use the smoothie to run our laser cutter,

We have set up the additional pins so we can use m3 and m5 to turn on-off the laser. however we rarely ever use this its just an additional line of code. we use fusion 360 to generate most our code, other programs some times generate the m3 m5 etc we just delete it. as the G0 commands will always happen when it has been turned off and G1 2 3 always happen when turned on. or has been the case thus far.

The only true reason we see for having this pin is for the door sensor. so the laser cannot fire when the door is opened.

I am curious about what you said about damaging the tube? i have never heard PWM damages tubes. could you please elaborate on this.
the way i saw TTL vs PWM is TTL is a old technique and PWM is the new. as aurther says we have been running our tube without PWM allows you to alter it constantly. why would you need to use TTL?

On a slightly unrelated note, Arthurwolf is there a way to change the PWM s value from 0.1-1 to 0-255 i have found this raster code generator for inkscape it should work perfectly for smoothie if i can change either the code in the plug in or the smoothie so the PWM is the same.
I would post the link but i am not allowed low karma :frowning: search 305engineering/Inkscape on github :slight_smile:

All the best,
Bonne

@Bonne Wilce

You’d need to modify the code to change this. It’s quite a trivial change, but you’d need to edit the source code, and compile it. Tell me if you need help with this.
You probably should change the plugin instead :slight_smile:

Hi Arthur,
I thought changing the code in the plugin would be the best way to do it but i thought id ask to see if it was easier way :wink:
My coding is not great but i guess it will make a nice learning project. :slight_smile:
I have also just sent you an email about a proposal i have.
All the best,
Bonne

Bonne - Some code to do this has just been pulled into the edge branch. Grab the latest from github and add a parameter as follows to your config. You’ll now have the range S0 to S255 controling the power of the laser.

laser_module_maximum_s_value    255

This is my smoothie config settings. seems like it has what the original poster is looking to do. I’m getting ready to try this today. it should work fine.

the K40 laser power supply I have has a separate input to fire the laser and it has a separate input for a potentiometer to vary from 0-5V to adjust laser current. there is hardly any documentation for my power supply, the dealer I bought the power supply from says the analog input can also accept PWM, so I am not sure if I can just use the PWM input by itself. fore the laser input to the power supply if you give a active LOW it fires the laser. the Laser panel has a test-fire button. when I push this it grounds the laser input pin and fires the laser. I know I can get this to work using 2 smoothie outputs, 1 is TTL to send a active low, the other is PWM.

  1. Laser module configuration

laser_module_enable true # Whether to activate the laser module at all. All configuration is ignored if false.
laser_module_pin 1.23 # pin will be PWMed to control the laser
laser_module_max_power .9 # this is the maximum duty cycle that will be applied to the laser
laser_module_tickle_power 0.0 # this duty cycle for travel moves to keep the laser active without actually burning

laser_module_pwm_period 20 # sets the pwm frequency as the period in microseconds

switch.laserfire.enable true #
switch.laserfire.output_pin 0.26^ # connect to laser PSU fire (!^ if to active low, !v if to active high)
switch.laserfire.output_type digital #
switch.laserfire.input_on_command M3 # fire laser
switch.laserfire.input_off_command M5 # laser off

An old post but I’ll chime in. I can also confirm that it’s easy enough to get TTL control of the laser using M3/M5 much as Superdave42 showed above. PWM control alone does work fine, but I wanted to do it this way for another reason.

I’ll post full details of my setup when I get a chance. I believe most CO2 lasers are active low for TTL input. They’re 5V so probably best to use active low, open drain and a physical pull-up resistor to 5V to ensure it’s definitely off. (I run my output via a MSP430 for coolant monitoring so didn’t need this.)

I’ve made progress on including a TTL pin in the Laser module. Any G1-3 move will activate both the PWM and TTL outputs. It seems to be working and I’ll submit a pull request once I’ve tested it a bit more thoroughly.

I’m considering an option to leave the PWM running permanently and having only the TTL output control the laser firing. It does seem to match the way the DC-K40 controls the laser, and I wonder if starting the PWM as it starts to cut will mean the cut doesn’t start at full power. (If the PWM is low-pass filtered down to an equivalent analogue signal this would be the case.) If this is something people want and it’s OK with arthurwolf I’ll work on this next.

Smoothie lowers laser power ( via PWM ) while accelerating and decelerating so that power-per-distance is constant, so you *need* to be controlling the laser with pwm. TTL should be used only as a secondary feature.

Don’t worry - I’m making sure I’m not impacting any of the existing features.

What I’m heading towards is pulsed TTL control of the laser. Many CO2 lasers seem to behave very non-linear at the lower end. My DC-K40 for instance does pretty much nothing below 4mA. Pulsed control should give finer low end control and apparently a better high end too. I believe most commercial DSPs have pulsed control. It’s also another way to decouple speed and power.

Search for “CO2 laser PPI CW” if you want to know what I’m talking about. I’m too new here to post links.

I promised to work on raster engraving for the Smoothie but fine control of mine just won’t be possible without this. Wood for instance, is definitely removed rather than darkened even at minimum power and reasonably high speed.

Obviously I know much of this doesn’t apply to diode lasers, etc. Anything I add will definitely be an option, will be thoroughly tested and obviously have to pass a pull request!

My changes to add a TTL pin to the laser module have now been accepted and pulled into the “edge” build. Simply define a new pin called laser_module_ttl_pin and this will be enabled on G1,2,3 moves. Note that you’ll want it active low for a DC-K40 CO2 laser.

PWM is left as-is so this is still only active on cutting moves. I think arthurwolf’s right that currently there’s no advantage in leaving it running. It would match how a DC-K40 laser operates, but there are a lot of things the on this laser that aren’t quite right. Quality control and safety for a start!

For clarity you can now refer to the PWM pin as laser_module_pwm_pin but the original name of laser_module_pin is still valid.

I’ll update documentation to reflect this, but not sure when best to do this. Obviously it’s not in the build that most users have so would be confusing if I updated the Wiki now.