Engrave Photos with PWM Laser

edited May 8 in Tips & Tricks
Hi,
is there anyone experienced in engraving photos with PWM Laser?
just need some setups regarding grayscales as i´m not really satisfied with my results.

I use PLTB450 B 1.6W Blue Laser Diode with PWM capable driver controlled by 12 Bit PWM at 1KHz

Thanks

Comments

  • edited August 10
    I've try to engrave some photo but without a real good result..
    See the photo on the end of the blog article...
    http://www.e-tips.it/2017/03/20/incisore-laser/


    Seems that for a gray-scale you have to drive the laser with a higher PWM frequency...
    but in repetier-firmware, if you change the PWM frequency then it will decrease the resolution of the pwm, so you have less duty cycle value, so you cannot have a good result...

    Edit.
    I will add a question...
    In the repetier, the PWM frequency is fixed?
    If the frequency is made by the hardware peripherals and it is a fixed frequency, i will try to increase it with a micro-controller programmed for multiply the frequency...

  • there is a solution out of the box , see
    https://github.com/repetier/Repetier-Firmware/tree/development/src/SampleEventSystems/Laser PWM and DAC

    I´ll post some pictures to my GitHub  to show some pretty good results.
    (may take a cuple of days)





  • edited August 11

    RAyWB said:
    there is a solution out of the box , see
    https://github.com/repetier/Repetier-Firmware/tree/development/src/SampleEventSystems/Laser PWM and DAC

    I´ll post some pictures to my GitHub  to show some pretty good results.
    (may take a cuple of days)





    Great! Fantastic work!
    I've ordered two PCA9685 board and two solid state relay (i've got to machine).
    I will tell you the result as soon i receive the parcel :)

    Great work also with the fix:
    Warmup for laser included (to avoid gaps in engraving)

    I've downloaded your firmware and i will configure and try it ;)

    Edit:
    Ops, i've got the MEGA..
  • edited August 11
    I have it running on a mega/ramps also.

    use dev firmware and add the custom events , warmup and most other features are included in official repetier-firmware
  • RAyWB said:
    I have it running on a mega/ramps also.

    use dev firmware and add the custom events , warmup and most other features are included in official repetier-firmware
    Hi, today I've finally received the PCA9685  board and I'm ready to try your code...

    Can I ask you some confirmation?
    I've copy the CustomEvents.h and CustomEventslmpl.h in the repetier firmware path, then compiled and load into Arduino MEGA...

    Now I've just to connect the PCA9685 board to the i2c bus like described in the PDF file, and connect to it the laser? Right?

    What kind of program have you used to create the G-Code in gray scale mode from a picture? Inkscape? with plugins?

    Thanks a lots for your support,
    Luca.
  • Yes, you copy the files to repetier firmware part.
    in Configuration.h you have to enable Custom events by adding

    #define CUSTOM_EVENTS

    thats all.

    there are multiple programs to generate the gcode .

    i use pic engrave pro , there is a demo version available

  • edited October 12
    After adding #define CUSTOM_EVENTS  there is some error in compiling:

    exit status 1
    'firstMove' is not a member of 'LaserDriver'

    Edit. solved...just define CUSTOM_EVENTS upper than laser section...of course...

    Problem N°2:
    exit status 1
    'newint' was not declared in this scope

    on row:

    #if defined(GAMMA_CORRECTION) && (GAMMA_CORRECTION==true)
                          newint =(com->S);
                          if (Gamma_on)
                          {
                          Outval=pow(newintens/LASER_PWM_MAX,GAMMA)*LASER_PWM_MAX; //Gamma function
                          LaserDriver::intensity = map((int)Outval,0,LASER_PWM_MAX,LASER_BASE_OFFSET,LASER_LIMIT);// scale gamma function and offset to max
                          Com::printFLN(PSTR("orig:"),(int)newintens);
                          }
                          else
                          {
                          Outval=newintens;
                          LaserDriver::intensity = map((int)Outval,0,LASER_PWM_MAX,LASER_BASE_OFFSET,LASER_LIMIT);// scale offset to max
                          Com::printFLN(PSTR("Gamma off LV:"),(int)newintens);
                          }


    declaring it, it will compile the code, but i don't think that is a good solution...
    Maybe i can declare it at the start of the file?

    int newint = 0;
  • edited October 12
    you have to use repetier 1.0 from dev branch !
    do not modify the code
  • I've configured and downloaded the 1.0dev firmware from:
    https://www.repetier.com/firmware/dev/index.php

    Then i've add the customevents.h and customeventsimpl.h to firmware folder, and i've add the:
    #define CUSTOM_EVENTS

    after


    #ifndef CONFIGURATION_H
    #define CONFIGURATION_H

    in configuration file...

    The error still the same:
    'newint' was not declared in this scope



  • edited October 12
    in the github version of repetier the define is included at the end of configuration.h
    (before last #endif)

    when did you download the firmware files?

    downloaded 3 min ago from  https://github.com/repetier/Repetier-Firmware/tree/development

    compiles without error.

    what arduino version do you use?

    EDIT::

    Typo, please change

    newint =(com->S);

    to


    newintens =(com->S);


    thanks for the hint!!!

    do you use only the pca9685  or also the mcp23017 and mcp4725?
  • if you only use the PCA 9685 the settings in CustonEvents.h have to be :

    #define FEATURE_I2C_MACROS false
    #define FEATURE_EXT_PWM true 

    #define FEATURE_PWM_LASER true
    #define FEATURE_ANALOG_LASER false
    #define GAMMA_CORRECTION true


    if not already done you also should set in configuration.h

    #define LASER_PWM_MAX 4095

    to get the 12bit resolution



  • RAyWB said:
    EDIT::
    Typo, please change

    newint =(com->S);

    to

    newintens =(com->S);

    thanks for the hint!!!

    do you use only the pca9685  or also the mcp23017 and mcp4725?
    Thanks to you for the support :)

    Now i can compile without any problem, next week i will try to use the photo engraver with your code and will post the result :)
    But before, i need to setup a mosfet for connect the PCA9685 to the laser...

    Thanks
Sign In or Register to comment.