Laser with inverted signal
hi,
I have installed a laser on my Cnc, but the driver (cheap chinese stuff) reverts the ttl signal (5v).
This means +5v = laser off and 0v= laser on.
i’ve changed some code in printer.cpp and ui.cpp to revert it logically’ and it works, but when I run a G0 command, laser is on... (as repetier disables the laser with G0 commands, which is inverted for me)
my questions are :
is there a way to invert the G0 function (where is it in repetier ?)
when I start my CNC, how can I reverse the fan speed value (100% instad of 0% which will switch off the laser)
for info, I use M106 and M107 commands and the laser is plugged on D9 pins in a ramps 1.4
the best would be to find a better driver (for 5.5w laser) but seems complicated to find or revert the TTL signal (i don’t know how to do)
thanks in advance
seb
I have installed a laser on my Cnc, but the driver (cheap chinese stuff) reverts the ttl signal (5v).
This means +5v = laser off and 0v= laser on.
i’ve changed some code in printer.cpp and ui.cpp to revert it logically’ and it works, but when I run a G0 command, laser is on... (as repetier disables the laser with G0 commands, which is inverted for me)
my questions are :
is there a way to invert the G0 function (where is it in repetier ?)
when I start my CNC, how can I reverse the fan speed value (100% instad of 0% which will switch off the laser)
for info, I use M106 and M107 commands and the laser is plugged on D9 pins in a ramps 1.4
the best would be to find a better driver (for 5.5w laser) but seems complicated to find or revert the TTL signal (i don’t know how to do)
thanks in advance
seb
Comments
so, even if my laser is connected to D9 and I want to use M3/M5, I have to enable the laser mode in the gcode (M452) which is sufficient ?
my first try didn't work. laser keeps running at 100%
sample :
>>test.gcode<<
;start cnc/laser - laser 100%
Then, how to reverse the signal for M3/M5 commands ? through changes in the code, through a single option somewhere. this is really not clear for me
thanks again.
attached my configuration.h file
https://drive.google.com/open?id=1_ao2bEHIJll8ioDQOXV22876IBZtJivP
I'm using a chinese laser on an official Ramps 1.4 and official arduino Mega 2560
repetier firmware 1.2
laser link :
https://www.aliexpress.com/item/5-5w-high-power-450NM-focusing-blue-laser-module-laser-engraving-and-cutting-TTL-module-5500mw/32559183201.html?spm=a2g0s.9042311.0.0.36b24c4dHZ0XJB
#define LASER_PIN ORIG_FAN_PIN <--- I suggest to use One of the servo pins on Radds f.e. No.5
#define LASER_ON_HIGH 0 <<--- Set to 1 to invert Signal
#define LASER_WARMUP_TIME 0
#define LASER_PWM_MAX 255
#define LASER_WATT 5.5
{
#if defined(DOOR_PIN) && DOOR_PIN > -1
if(Printer::isDoorOpen()) {
newIntensity = 0; // force laser off if door is open
}
#endif
if(EVENT_SET_LASER(newIntensity))
{
// Default implementation
#if LASER_PIN > -1
WRITE(LASER_PIN,(LASER_ON_HIGH ? newIntensity > 199 : newIntensity < 200));
#endif
}
intens=newIntensity;//for "Transfer" Status Page
}
#endif // SUPPORT_LASER
here the wiring.
I didn't use the servo pins as I think they don't support the power of the laser (5.5w)
and I use this +5V pin and D9- to get 5V and not 12V provided by D9.
but I'm still not sure if M3/M5 can be used with D9. I don't see any changes when I use these commands.
https://drive.google.com/open?id=1o6bAFwLzvAGo2fzHk23Lr6_bQNJStCVr
#define FAN_PIN 9 <--- change to 5
I wire the +5v TTL signal from the Laser directly to the TTL data signal of the servo (or the +5V ??) and gnd together right ?
i've put a picture here.
https://drive.google.com/open?id=1hfRorIyYjzoyLZQEisX2DU0l76X9PzXc
I've so changed the pin from D9 to D11 (servo) and also tried with D6 (servo)
the behavior is identical for all tests, and I was only able to use M42 commands. nothing happends with M3/M5 commands. I don't understand how to enable these commands.
I'm attaching the last configuration.h file. no other files were customized
with M42 P6 Sxx commands :
if I set LASER_ON_HIGH 1
for information, with Marlin, it works fine with M106 commands when it's connected to D9, but I don't use Marlin because of precison and buffer issues. not as reliable as repetier on my point of view.
https://drive.google.com/open?id=1yP_NIHkQq0Wq5rLXvLsvSVXlWzVGiGc6
M452 was included in my codes. the thing I was not aware is :
M3 only works with move commands, that was the trick !!
I'm also able to send M3 Sxxx commands with the small change in the code to allow analogwrite.
thanks again a lot RayWB for all your time and effort. this resolution would not have been possible without your help !
I have a PIN output of 4