-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FR] Standard Marlin for Cutting CNC machine(plasma , laser) #3208
Comments
I would love this too, TurnkeyTyranny fork looks like the best approach IMO, but it was not updated for a few months. |
you are so welcome and actually guys like @HakanBastedt already merge the TurnkeyTyranny code in new Marlin firmware in Due , also he mentioned it test goes well , but there is couple of feature need to be add like auto high control during the cutting or engraving , I suggest at first look at his code here |
I'm just doing the same thing on MarlinKimbra with this pull request: MKFirmware/MarlinKimbra#113 |
It would be interesting to hear your thoughts about what new commands and features need to be added. There is no reason the 3D-Printer code can't co-exist with CNC milling and Laser cutting. In fact, it is very possible in the near future machines will have all 3. My initial thinking is we can give you a whole block of GCodes (for example: 700-800) for your stuff if you can think it through and come up with some well thought out plans. |
@Roxy-3DPrintBoard on my pull request to MarlinKimbra i've added the same GCodes as is Turnkey Tyranny modified marlin, retaining full compatibility with existing frontends for it (laserweb and the inkscape plugin first of all ). The complete gcode list is here: https://github.com/nextime/MarlinKimbra/blob/dev/Documentation/GCodes.md Most notables are:
|
As i'm adding also support for water cooler on the laser patch for marlinkimbra, i'm thinking about the Mcode to set the PID for it. Actually we have 2 Mcodes for setting PIDs: M301 for extruders, and M304 for bed. For the laser cooler i have many options:
I ask here cause i hope that if in future Marlin will be patched for lasers, we can retain full compatibility in G/Mcodes, so, make sense to ask also here for those things. Has anyone suggestions about that? |
This is very interesting. |
is a "sort of de-facto" standard nowadays thanks to both the fact that repetier-firmware, other (older) marlin based modified firmwares like turnkey tyranny, and also other firmwares implement it in that way, also, looking at http://reprap.org/wiki/G-code you can read: Also, all host software specifically done for lasers like https://github.com/openhardwarecoza/LaserWeb uses this "standard" |
Side-note: I'm still a little torn on the differing usage of |
Have seen this too. For example repetier-host use G1 for movements when pressing the arrows. In 3D printing G0 and G1 are used interchangeably. |
@thinkyhead the issue can be triggered when the firmware is compiled for a machine that have both 3d print and laser, as you will have to enable LASER define, and then when 3d print using a slicer that uses g0 and g1 without differentiation. But the issue is on the 3d print side, as for lasers the g0/g1 difference is a common thing. Maybe implementing also the M452 like in the repetier-firmware can solve this issue, when in laser mode g0 and g1 are different, where in 3d print mode g1 and g0 are equal, shold be easy to implement |
@nextime |
@Blue-Marlin i'm referring to the pull request add laser support to MarlinKimbra i was describing few messages ago where the discussion about g0/g1 was started ( pull request that eventually can be ported to marlin too) (this one: MKFirmware/MarlinKimbra#113 ) |
@Blue-Marlin please check this repository https://github.com/HakanBastedt/Marlin4Due/tree/Laser , right not this firmware is implemented on CNC laser and shows reliable speed , we interested to implemented the dynamic THC with ready -to-use module with some modification and replace with temp control feature or I2c |
Ok, I have ported it for my own purposes, and I know of several people that also have taken the laser code from https://github.com/TurnkeyTyranny/buildlog-lasercutter-marlin/tree/master/Marlin and used it in current Marlin. All credits goes to TT. |
One question is how to hook up the laser driver and to control the intensity. There are laser drivers that use TTL as they call it, a 5V PWM up to like 20 kHz frequency is needed. There are laser drivers that use the voltage of the PWM signal to set max intensity, so adjustable voltage PWM is needed. Then there are laser drivers that use a "firing pin". The laser driver input can have common ground, thus disqualifying mosfet-controlled outputs, and there are laser-drivers with optically insulated inputs thus allowing the use of mosfet-controlled outputs. The laser pwm pin must be a pwm capable pin thus 2-13 and 44-46 according to docs. Also the timer needed for the chosen pin must be free and not used by stepper, servo or temperature for example. |
I also worked on the Turnkey firmware and modified for the use on chinese K40 clones. Edit: Just noticed the Nextime is quite busy in his branch... |
I have included the changes required for 8bit engraving in the release I downloaded 2 days ago. |
Sounds great! How many steps/mm do your motors have? I think the speed limit is due to steps/sec the Mega can do. 8bit == G7? |
My x and y motor run at 157.48 steps per mm. |
Have you guys checked the work being done by Laserweb (Peter van der Walt) https://github.com/openhardwarecoza/LaserWeb They are now working on an improver LaserWeb2 version. It would be good if both projects are aware of each other. Regards, Ernesto
|
@HakanBastedt more than using G8 i would like to have an M code to select how G7 would act, if using full 8 bit raster or the "usual TT" one, and by default if not selected using the "old TT" one, so, we can still fully compatible with the old TT G7 and having an 8bit implementation on the same G code. @Downunder35m i'm working on a patch to implement all TT modifications ( and few more ) on the MarlinKimbra (MKFirmware/MarlinKimbra#113), i will probably add also your modifications to it. @emartinez167 i know and use LaserWeb, and i have access to LaserWeb2 repo too, i will work to integrate my MarlinKimbra modifications on it to make it fully compatible, so, if the same modifications will be done also on Marlin, i will assure it works on it too |
Excellent!!!!
|
@nextime I am puzzled because I don't understand what you mean by the differences between 8bit and 'TT'. TT's approach does encode every pixel in 255 range greyscale. Then due to the implementation in Marlin it sometimes doesn't come out very well, but there is a (at least one) fix for that as I showed in my code. What I have read is that @Downunder35m have changed what the data in the G7 command means, with a larger than 255 range, and that is my worry. I could be wrong. But all I am saying is that I would like to keep the 255 encoding as TT did it, and fix the bad greyscale resolution at low intensity inside Marlin. @Downunder35m I will see if I can test the code tonight. It will have to be on the laserdiod so I'll see what I can do. @emartinez167 I know of LaserWeb as well. I would really like so see that photo engravings can be encoded into G7 raster commands. |
@HakanBastedt no, TT doesn't use full 8bit resolution, it scale down to power values in a percentage value, so, 1 to 100 instead of 1 to 255. @Downunder35m patches are to move to full 8bit. |
@nextime that is not correct. The pixel data in the G7 line is full 256 range. It is when the pixel data enters these lines
the value gets reduced from 0-255 range to 0-100 range. I have not seen @Downunder35m's patch, but I show one way to get rid of this limitation in the commit link a few messages above. |
Hi.. I am glad I have found this conversation. |
I too am glad I found this. I currently have a diode laser mounted alongside my extruder. I've used a selector switch between extruder fan and laser. I use the Inkscape laser plugin to turn the laser/fan output on/off. It would be great to have a T0 (extruder) and T1 (laser) #define that allows me to switch over. Hoping this could be an over-simplified way for the creative juices to begin flowing for dual purpose movement. (Pens, dremels, scribes, strapped/taped to extruders ;) I have my own idea of a metered syringe to make silicone gaskets, where I'd like to snap a plastic nozzle with a flexible feeder hose to it. |
Hi all. I've implemented G53 G1 X20 F500 …to do a move in machine-native space. See #8200 for details. |
Hi again, I was active on this topic some years ago. Nice to see progress and that a continuous laser mode is now available. My CO2 laser has been dismounted but my laser diode printer is still live and working very well with the Marlin I worked on earlier in this issue. Eventually I couldn't keep up with the changes made here so still at a much older version. Perhaps we can improve on the laser functionality a bit, I can spend some time on it. I think there are two issues really that can be addressed
I see there are a lot of changes in the stepper isr and I need guidance to find my way there. Interest? |
see the hangprinter discussion where there is also need to define additional
axis and questions about how it should be done (and what needs there are for
additional axis definitions)
|
I want to use a Marlin firmware on my home made Prusa-like H printer which use a quick-fit system to go from 3D-print head to 2.5W laser engraving head. Currently, with Bugfix-1.1.x branch of Marlin, I am able to set laser pwm with M106 S command, and am able to do some vector engraving. I wonder if Marlin function gcode_M106() and gcode_M107() does need to be modified to synchronize stepper movements with M106 and M107 commands. Actually, I got stripping bands which should not be there, like on this power calibration test on cardboard : |
Have you tried this? /**
* Spindle & Laser control
*
* Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and
* to set spindle speed, spindle direction, and laser power.
*
* SuperPid is a router/spindle speed controller used in the CNC milling community.
* Marlin can be used to turn the spindle on and off. It can also be used to set
* the spindle speed from 5,000 to 30,000 RPM.
*
* You'll need to select a pin for the ON/OFF function and optionally choose a 0-5V
* hardware PWM pin for the speed control and a pin for the rotation direction.
*
* See http://marlinfw.org/docs/configuration/laser_spindle.html for more config details.
*/
//#define SPINDLE_LASER_ENABLE It enables the proper use of |
two questions:
|
Once you configure the spindle/laser options, you can then use The pins //
// M3/M4/M5 - Spindle/Laser Control
//
#if ENABLED(SPINDLE_LASER_ENABLE) && !defined(SPINDLE_LASER_ENABLE_PIN)
#if !NUM_SERVOS // try to use servo connector first
#define SPINDLE_LASER_ENABLE_PIN 4 // Pin should have a pullup/pulldown!
#define SPINDLE_LASER_PWM_PIN 6 // MUST BE HARDWARE PWM
#define SPINDLE_DIR_PIN 5
#elif !(ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) \
&& (ENABLED(PANEL_ONE) || ENABLED(VIKI2) || ENABLED(miniVIKI) || ENABLED(MINIPANEL) || ENABLED(REPRAPWORLD_KEYPAD))) // try to use AUX 2
#define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup/pulldown!
#define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM
#define SPINDLE_DIR_PIN 65
#endif
#endif |
Physically, I have to share PWM D9 pin, both for part cooling and for laser
PWM power control, because I use a quick fit system with a DB26 connector
for fast plug/unplug of laser/printing, and almost 26 pins of this
connector are already used.
Do you think that if I define both SPINDLE_LASER_PWM_PIN and FAN_PIN to the
value RAMPS_D9_PIN it will work without a hassle?
*L*OUIS
2018-03-15 22:11 GMT+01:00 Scott Lahteine <notifications@github.com>:
… if I enable the define SPINDLE_LASER_ENABLE, is this compatible with a
normal 3D printing use? Because I don't want to reflash Marlin firmware
every time I want to switch from laser to 3dprinting and back.
Once you configure the spindle/laser options, you can then use M3/M4/M5
to control the spindle or laser. It doesn't conflict with 3D printing.
These pins SPINDLE_LASER_PWM_PIN, SPINDLE_LASER_ENABLE_PIN, and
SPINDLE_DIR_PIN are pre-defined in most pins files. For example, in the
RAMPS pins file:
//// M3/M4/M5 - Spindle/Laser Control//
#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE)
#if !defined(NUM_SERVOS) || NUM_SERVOS == 0 // try to use servo connector first
#define SPINDLE_LASER_ENABLE_PIN 4 // Pin should have a pullup/pulldown!
#define SPINDLE_LASER_PWM_PIN 6 // MUST BE HARDWARE PWM
#define SPINDLE_DIR_PIN 5
#elif !(ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) \
&& (ENABLED(PANEL_ONE) || ENABLED(VIKI2) || ENABLED(miniVIKI) || ENABLED(MINIPANEL) || ENABLED(REPRAPWORLD_KEYPAD))) // try to use AUX 2
#define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup/pulldown!
#define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM
#define SPINDLE_DIR_PIN 65
#endif
#endif
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3208 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABsSyd6ueDLgMJri7ePs8lgx2XqpDJrzks5tetkPgaJpZM4H2DPU>
.
|
You don't want to have the |
currently, I am using the electrical signal coming from the gate of the
mosfet for FAN0 as command for my PWM laser module instead of the one
coming from the D9-labelled signal coming out of the RAMPS.
I first tried to use the RAMPS switched 12V signal, by transforming it back
to a valid TTL PWM signal, but finally I gave up to using the signal of the
mosfet gate, which is a nice 0-5V PMW signal (on pin D9 of the Arduino
MEGA).
*L*OUIS
2018-03-19 11:13 GMT+01:00 Scott Lahteine <notifications@github.com>:
… You don't want to have the SPINDLE_LASER_PWM_PIN run 12V to most lasers,
as it will kill them. It should be ok to share the fan with the constant
SPINDLE_LASER_ENABLE_PIN pin, however.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3208 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABsSyQ6Wh13tp8MSC7rZuvF5YmnwYSJYks5tf4TfgaJpZM4H2DPU>
.
|
Hello everyone I'm new in the forum and I'm very interested in this topic, I would like to ask a question if possible, how do I modify the firmware resolution from 8 to 16 bit pwm? On what parameters should I act? thank you very much for your availability |
@Spidermakercnc — Here's a sample function that can be added to Marlin to set Timer 5 to just about any frequency. Adapt and modify according to your needs. /**
* Set Timer 5 PWM frequency in Hz, from 3.8Hz up to ~16MHz
* with a minimum resolution of 100 steps.
*
* DC values -1.0 to 1.0. Negative duty cycle inverts the pulse.
*/
uint16_t set_pwm_frequency_hz(const float &hz, const float dca=0.0, const float dcb=0.0, const float dcc=0.0);
uint16_t set_pwm_frequency_hz(const float &hz, const float dca, const float dcb, const float dcc) {
float count = 0;
if (hz > 0 && (dca || dcb || dcc)) {
count = float(F_CPU) / hz; // 1x prescaler, TOP for 16MHz base freq.
uint16_t prescaler; // Range of 30.5Hz (65535) 64.5KHz (>31)
if (count >= 255. * 256.) { prescaler = 1024; SET_CS(5, PRESCALER_1024); }
else if (count >= 255. * 64.) { prescaler = 256; SET_CS(5, PRESCALER_256); }
else if (count >= 255. * 8.) { prescaler = 64; SET_CS(5, PRESCALER_64); }
else if (count >= 255.) { prescaler = 8; SET_CS(5, PRESCALER_8); }
else { prescaler = 1; SET_CS(5, PRESCALER_1); }
count /= float(prescaler);
const float pwm_top = round(count); // Get the rounded count
ICR5 = (uint16_t)pwm_top - 1; // Subtract 1 for TOP
OCR5A = pwm_top * ABS(dca); // Update and scale DCs
OCR5B = pwm_top * ABS(dcb);
OCR5C = pwm_top * ABS(dcc);
_SET_COM(5, A, dca ? (dca < 0 ? COM_SET_CLEAR : COM_CLEAR_SET) : COM_NORMAL); // Set compare modes
_SET_COM(5, B, dcb ? (dcb < 0 ? COM_SET_CLEAR : COM_CLEAR_SET) : COM_NORMAL);
_SET_COM(5, C, dcc ? (dcc < 0 ? COM_SET_CLEAR : COM_CLEAR_SET) : COM_NORMAL);
SET_WGM(5, FAST_PWM_ICRn); // Fast PWM with ICR5 as TOP
//SERIAL_ECHOLNPGM("Timer 5 Settings:");
//SERIAL_ECHOLNPAIR(" Prescaler=", prescaler);
//SERIAL_ECHOLNPAIR(" TOP=", ICR5);
//SERIAL_ECHOLNPAIR(" OCR5A=", OCR5A);
//SERIAL_ECHOLNPAIR(" OCR5B=", OCR5B);
//SERIAL_ECHOLNPAIR(" OCR5C=", OCR5C);
}
else {
// Restore the default for Timer 5
SET_WGM(5, PWM_PC_8); // PWM 8-bit (Phase Correct)
SET_COMS(5, NORMAL, NORMAL, NORMAL); // Do nothing
SET_CS(5, PRESCALER_64); // 16MHz / 64 = 250KHz
OCR5A = OCR5B = OCR5C = 0;
}
return round(count);
} |
Uauuuu thank you have been the only one who gave me an answer, thank you so much, I can steal wualche always if you have time and desire as I have practically no basics of programming (I just bought 4 volumes on programming Arduino and C) but) I'm an electronic expert, this code that you wrote me I have to insert in the config.h or in the initial? Then another thing you could explain to me even in detail to understand what it does? Thank you so much, I would pay you swear |
@mkeyno Much of the laser/spindle codes have been improved such as laser/spindle PWM frequency, inline firing and trapezoidal power scaling. |
thanks, @shitcreek , I should check it with my SAM Due board |
@mkeyno, since you haven't responded, I am going to close this request based on the improvements mentioned by @shitcreek. I am sure there are many improvements yet to be made, but it makes sense to track those with more granularity as issues are found. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
2 similar comments
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
hi all developers , as I remember Marlin in primarily invented for 3d printer , however couple of cool guys hear attempted to modified Marlin for CNC machine like laser machine , but it seems all of them not follow the same and standard way as the original Marlin goes, I hope in this repository finally new branch for cutting machine will be created and gather all enthusiast on same approach for standard Marlin version for cutting machine such as Plasma oxyfule and laser
The text was updated successfully, but these errors were encountered: