Laser Intensity

Hello all,

Trying to add laser engraving to my 3d printer.
I have been able to get the laser to turn on and off with M3 S255 and M3 <S255.
But I would dearly love to enable intesnity settings.
My laser has a PWM input that is being triggered by Pin4 as configured in my firmware, but I am missing some setting or configuration that allows PWM to work.  

Here are what I believe to be the relavent files. Thanks!

configuration.h - https://pastebin.com/LDhZ5i0U
events.h - https://pastebin.com/wUTPFEBx
drivers.cpp - https://pastebin.com/P9RMTYcs

«1

Comments

  • Please check the forum. There is at least one thread in the recent past describing how to do it. In the github sources you will even find the matching modifications from RayWBa in the sample events directory.
  • if by chance you mean this thread:
    http://forum.repetier.com/discussion/1387/implementing-laser-intensity

    I have been looking at that thread off and on for the last 6 hours.  information is talked about hte implementation in both the firmware itself comments and that thread but much information is just plain left out.
  • Looked into the github.

    Tried to implement what I found here, but now I get now laser on m3 commands.

    https://github.com/repetier/Repetier-Firmware/pull/524
  • Laser turns on when E value exceeds or with M3 Sxx. But it only turns on for G1 moves. When not moving or for G0 moves the laser stays off. That way you can use G0 for positioning and G1 for engraving.
  • Sure I understand that, but I am getting no laser while moving on G1 or G0 with M3 S0 to S255.
  • Have you already tried without the pwm modification? PWM only works for very few pins that are bound to a timer that does not get used by firmware. 
  • Yep, laser mode works fine without PWM.  wiht just the built in laser mode in 0.92 firmware.
  • Hey bro, found a final solution for this?
    I just need a simple PWM output pin to drive my laser.
    I'm using Arduino Mega with RAMPS 1.4
  • You can take fan2 output (print cooling fan).Its PWM and can be controled easy.
  • No, it will not sync and PWM is very slow, not fast enough for a laser. Better use
    https://forum.repetier.com/discussion/6363/laser-enable-pin-issue#latest

  • Is it possible to make simple SG3525 PWM (I am asking logicaly - making pwn is out of the question)......that works on 100KHz to 400KHz and simply tune manualy lasser output power?It can easy go from 1% to 99%.
  • That might be a good solution also I have no idea how to set PWM for that chip. You just would need to add the custom event for laser to set value to that chip and it would work. Surely faster then what the avr will create.
  • Repetier said:
    No, it will not sync and PWM is very slow, not fast enough for a laser. Better use
    https://forum.repetier.com/discussion/6363/laser-enable-pin-issue#latest

    Repetier solution is 100% and VERY easy to implement!
    I recommend!
    Just 1 line to change.
    I chose pin 44 (Aux 2 - RAMPS 1.4)
  • edited April 2
    PWM for sg3525 can be set with potentiometer on the board or with voltage (analog) control.I will post schematic here today.
  • But we have no analog voltage. All we have is a pwm output. So you use a pwm signal to create a pwm signal. Guess if there is a capacitor somehow involved to stabalize voltage it should work.
  • edited April 2
    I can make it to work that way easy.This is my area.No prob.Whats pwm frequency available from arduino?
  • Let me know whats fan2 output pwm frequency too.Lets make something easy to implement.
  • Repetier can answer better, but, AFAIK the fan output has a very slow PWM frequency.
    But, if you said that PWM controller can be adjust by a potentiometer, this can be interesting also, the machine enables this external PWM but its duty is adjusted manually by potentiometer, if it has an enable pin is just hook to the LASER_PIN.
  • Yup i can design that too.Good idea.Before i design all i will make a break so maybe someone else will give some other good idea too.So far circuit i can design can work up to 200KHz-400Khz and can be adjusted manualy with potentiometer.I can add on/off pin and i will make pwm input to control output duty cycle.I can also make output frequency to be controlable with analog or digital input ??? If needed.Parts will cost no more than 5USD-7USD.....so its not a big deal to make some more functionality.
  • This will be for free from me and i will deliver all files......gerber and schematic.
  • Any ideas?digital on/off ,pwm controled pin for pwm output i can make output pwm frequency control both pam and analog controled......anything esle?
  • edited April 5
    Think before developing something you should get laser driver specs.
    there are several laser drivers on the market, some of them convert the pwm input to
    analog voltage by simply integrating.
    for the ones which have real pwm input you will see that max pwm input frequency is limited for several reason.
    and the 3rd sort of drivers (most common cheap ones )just uses the enable pin of the buck converter ic to simulate PWM....

    so there will not be a "one for all " solution.

    from my own experience  and based on the laser drivers i own i can say more than 5KHz PWM mostly makes things worse (i use 1KHz and things are runiing well)


  • edited April 5
    1KHz is very low.Thank you for your input on this.I dont have lasser but i plan to have one.I will not agree about not possible to make universal solution :) .I have 20 years of professional designing in electronics behind me.So i will say clearly :) , yes i can make universal solution.So far if i understood right these are key parameters:

    trim pot manual output pwm control
    trim pot manual frequency control
    pwm controled pwm output (can do on/off functionality too) from trim pot pre set value or full range control
    analog controled pwm output (can do on/off functionality too) from trim pot pre set value or full range control
    pwm controled frequency output from trim pot pre set value or full range control
    analog controled frequency output from trim pot pre set value or full range control
    output pwm and analog type ...... so output will be pwm and in paralell it will have analog output too

    Did I miss something?

    Do i need pwm output to have TTL output or i can make totem pole full driver?In general,pwm speed is related with engraving speed....faster engraving requires faster pwm frequency for lasser otherwise you will have dots instead of lines when engraving.







  • You´ll see that cannot work universal...
    BTW i used the predecessor of the IC you suggested in middle of 1990´s  ;-)
    So I´m in business for more than 35 years now.


    Do i need pwm output to have TTL output or i can make totem pole full driver?In general,pwm speed is related with engraving speed....faster engraving requires faster pwm frequency for lasser otherwise you will have dots instead of lines when engraving.







    Well...

    you are mixing things...

    TTL Output or Totem pole... guess you mean open collector or totem pole... result is ttl signal in both cases
    as long as you supply 5VDC

    faster engraving speed needs wider pulse not higher frequency.
    PWM is Pulse Width Modulation .... you modulate pulse width , NOT frequency

    Good luck from my side ;-)



  • :) I am not mixing antyhing.IC i mentioned is something i did on purpose becouse its cheap and can do the job.There are many other high end, ultra high quality ICs I use on daily basis......but any of them will be golden hammer for iron nail in this topic.I meant exactly as you said about totem pole.....i didnt read after writing :) .

    "faster engraving speed needs wider pulse not higher frequency.PWM is Pulse Width Modulation .... you modulate pulse width , NOT frequency"

    In time domain if you just try to draw on paper you will see that if you travel slowly and pwm frequency is slow on-off sequence from pwm will be represented as dot-blank-dot if you try to engrave a line......lower the frequency bigger the dot-blank will be.So if you go slow with engraving and if you have high freqency pwm on lasser no matter what the duty cycle is you will have line (wont be able to see dot-blank).

    Also if frequency is low and you use wider pulse as you said you will have much higher output power for lower speed to have a line and will burn things......So you missed my point as i can see ,which is ok.No one is perfect.

    My solution is for any speed to have high quality output and to have precise control.If you want to bet i will accept.I will make universal solution.And i am ready to put 1000USD on that.We can make this official through my freelance profile as official job.If i fail to make what i said I will pay you 1000USD if not you will pay me.Ok?



  • edited April 5
    Anyway i will make it and post all here for free :)

    I am curious.....if you used this IC and are long in business why didnt you come up with some solution as i mentioned?It was to hard to figure out?
  • Good one.
  • think it´s enough that i wrote and shared that stuff so no need for me to do something else ;-)
Sign In or Register to comment.