RAMPS Spindle laser headache TRUE //

hello there forum

I am battling with my ramps 1.4 (reprap discount), marlin 2.0,

functionality/triggering is hard. why doesn’t M3 / M5 seem to trigger. I can confirm that the code is error free according to Arduino complier.

in this important section in configuration_adv.h, the seemingly key code is uncommented and compiles.

#define SPINDLE_FEATURE
//#define LASER_FEATURE
#if EITHER(SPINDLE_FEATURE, LASER_FEATURE)
#define SPINDLE_LASER_ACTIVE_STATE true // Set to “HIGH” if the on/off function is active HIGH
#define SPINDLE_LASER_PWM true // Set to “true” if your controller supports setting the speed/power
#define SPINDLE_LASER_PWM_INVERT false // Set to “true” if the speed/power goes up when you want it to go slower


and according to the file at marlin-2.0.x/marlin/src/pins/ramps/pins_RAMPS.h
(There are mentions in several files referring to “pins_MYBOARD.h” but this file doesn’t really exist or something, please wtf!)

//
// M3/M4/M5 - Spindle/Laser Control
//
#if HAS_CUTTER && !defined(SPINDLE_LASER_ENA_PIN)
#if !NUM_SERVOS // Use servo connector if possible
#define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown!
#define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM
#define SPINDLE_DIR_PIN 5
#elif HAS_FREE_AUX2_PINS
#define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown!
#define SPINDLE_LASER_PWM_PIN 44 // Hardware PWM
#define SPINDLE_DIR_PIN 65
#else
#error “No auto-assignable Spindle/Laser pins available.”
#endif
#endif

the important pin in question is pin #4, which is (D4) supposedly. a PWM pin.
the top-right pin in the SERVOS area with 4 sets of 3-pin outs.

so I should be able to use

M3 S1300

to turn on the D4 pin.

the Gcodes can tell marlin to perform arcs successfully via Arduino serial monitor, but it reads error back that M commands are “unknown”

also it sends back the “m3: unknown” when I’m watching via serial monitor and marlin is running code from an sd card.

there is a spindle dropdown menu in marlin now that spindle is enabled in configuration_adv.h

the menu option for on/off won’t toggle when selected, and the speed of 193 is displaying when I’m running a gcode via sdcard. yet I can “turn off” spindle with select when running code program, though no actual change in running program. when speed: 193 is selected it reverts to 0 when attempted adjust.

and of course nothing gets triggered in D4, my relay doesn’t turn on via signal, I’m using a grove 1.2 relay, Pins are: ground,5+,signal input. there is no power or signals coming from D4 and accompanying GND&5+ pins either.

my marlin does a very dark reset when its done with running any gcode now. I remember that it used to send me back to the main screen when its complete.

if anyone has the link to the GCODE / hardware test file for ramps or marlin w/e then that might help some.

otherwise if anybody has any ideas as to what is failing… also, should I do something different besides M3 S1300 to get my signal to the relay to be solid on, no on/off dancing?
Im triggering a plasma cutter signal, it needs a solid on no PWM. thank you in advance, thank you for taking the time to read this. have a great day if possible.

No idea why your M3 g-codes are not being recognized. It appears from the Marlin g-code reference an M3 without any parameters turn the pin fully on. Also S values in the 0 to 100 range appear to be treated as percentages.

1 Like

So @vicious1 (not sure whether to ping you or Jeff) I noticed that the Ramps version of the V1 firmware does not have the laser code enabled:

//#define SPINDLE_FEATURE
//#define LASER_FEATURE
#if EITHER(SPINDLE_FEATURE, LASER_FEATURE)
  #define SPINDLE_LASER_ACTIVE_STATE    LOW    // Set to "HIGH" if the on/off function is active HIGH
  #define SPINDLE_LASER_PWM             true   // Set to "true" if your controller supports setting the speed/power
  #define SPINDLE_LASER_PWM_INVERT      false  // Set to "true" if the speed/power goes up when you want it to go slower

I just wanted to bring it to your attention in case this was not what you wanted.

We haven’t been making changes to the ramps, mostly because neither of us use them. Ryan has been doing all the testing for these changes, and it is a lot of work.

I’d like to have a nice page describing the different maturity levels of each config, and having some way to quickly find out which one to grab. That would include either some kind of gold/silver/copper rating or a ln “official”/“community”/“not” supported tag. The ramps would be in the silver/community category. Once I have a page like that, I could make a lot more configs, and just tag them appropriately.

It is probably better to post a new “issue” for adding laser to the ramps config. Then when I am working in github, it is like a short todo list.

To clarify, I used the 2.0 download from marlinfw website and changed the steps/mm to 200 from 80 as the main difference I could find when looking at the v1 edition. The code I provided wasn’t from a v1 marlin. Dunno if that makes a difference in this side-convo

I have no special knowledge of this code, since I have yet to install a laser, but I’ve been reviewing laser topics on this forum as a learning exercise for my future laser. But before I give a bit more info on your post, let me ask what you are trying to accomplish. You are attempting to trigger a relay, but does it require being triggered by the M3/M5 commands? An alternate that a lot of us use to power up/power a relay is to use a fan pin and use M106 and M107 to turn the relay on and off. The fan pins on most boards are 12V (or follow the applied voltage of the power supply), but it is easy to reassign a default fan pin to 5V pin. Or you could use a 12V relay.

MYBOARD is a placeholder for the name of your board. If you look in Marlin/src/pins/ramps you will find a lot of boards listed. A generic Ramps 1.4 board will use pins_Ramps.h.

Another way to approach your problem would be to take the V1 Rambo firmware and run a diff (short for difference) between the configuration.h and configuration_Adv.h files and the Ramps ones you are working with. There are a lot of free diff tools available on the net. I know that the laser support is enabled in the latest Rambo firmware. This of course assumes you can solve your problems by using the laser support instead of spindle support. Right now, you don’t have laser support enabled as indicated by the ‘//’ on this line:

//#define LASER_FEATURE

Another thing, the g-code I reviewed that used the Rambo-enabled laser code use the ‘S’ parameter in the G0 and G1 commands to trigger the laser, and not the M3/M5 commands. So it is possible you could use the S parameter of these two commands to control the laser/spindle pin. From the g-code reference:

M3 and M4 aren’t needed with LASER_POWER_INLINE and LASER_MOVE_POWER enabled. Power is set directly in G1…G5


my marlin does a very dark reset when its done with running any gcode now. I remember that it used to send me back to the main screen when its complete.

This sounds serious. When I see people having this kind of trouble it is usually because they’ve drawn too much current from a pin/board. How much current does your relay draw? You’re not trying to power the relay coil from the pin are you? The pins on most of the Arduino boards have max current of 40ma. And it is possible that you’ve burned out a pin and the M3/M5 commands are working correctly. You may want to get the pin working with a multi-meter before attaching the relay, and you may want to use a different pin than the one you may have burned out. All this is conjecture.

@robertbu thank you got trying to come to my aid! thanks for answering the MYBOARD question.

in regards to your lines of questioning, I have uncommented //spindle because that’s the function I was trying to use. not //laser. it won’t let you enable both at once. the //spindle functionality is more appropriate for my end, versus the //laser because the //laser has more complexity and I am very green. I like your idea of reassigning the m106 to a 5v pin. all I need it high/low on a trigger signal for a relay breakout. it protects the ramps/ardu from voltage spike associated with relays. I had not connected any load to any of the pins that would burn anything out., no load connected. just the relay switching side. anyway I suspect it may have been poor power delivery, the main + & - connector wiggled out soon after this issue. sadly that seems unrelated to the m3/m5 issue.

thanks again for reaching out on my issue. I am going to try and keep this thread current with updates until I can either get the specific knowledge or fix it through rote. this is the last hurdle before full functionality on my plasma cutter setup. what a ride. thanks again!!!

I got it Y’all

VERY IMPORTANT STUFF

Arduino Serial Monitor… Marlin will not accept M-Commands that are not capitalized.
m106 s255 vs M106 s255

similarly,

Marlin.ino will not compile if you use lowercase for

MOTHERBOARD BOARD_RAMPS_14_SF. (sf vs SF)

so I enabled M106 fan control, chose SF, and now M106 s255 turns on D8 12v. M107 off.

I can work with this. thank you anybody who chimed in. have a great day!!

functionality/triggering is hard. why doesn’t M3 / M5 seem to trigger. I can confirm that the code is error free according to Arduino complier.

You know, the “not capitalized” issue occurred to me, but when I saw the capital letters in the line above, I thought Naaaa. Congrats on getting your pin working. When you get your machine working, I love to see a video in the “MPCNC/Your Builds” section. Plus I love to see anything you make in the “Things You Made” section of the forum. We only see a few CNC plasma cutters on this list compared to the many wood routers, and I find the metal cutting fascinating.

2 Likes

@robertbu

Hey howdy! I thought I would drop you a note here since you asked for it! the build is more or less done.

https://forum.v1engineering.com/t/long-and-slim-plasma-primo/

Thank you again for you help… Hope all is well Robert!

Congrats on getting it running. I was thinking about this topic today when another Ramps user was trying to get their laser working.

@robertbu

oh fun !

trying to get that functionality made me think of somebody buying a blender that comes with no buttons, only ON when plugged into the wall. thats what getting MARLIN delivered to my lap with full functionality would look like. (in my mind) it would work but an unmanageable mess. It was good to struggle a bit to ensure that i am in better control moving forwards.

Got the link to that other person? thanks for the reply… hope you are well!

Got the link to that other person? thanks for the reply

This is the new topic. Since my knowledge is all theory, maybe you can add some real world details. Not sure if the poster is still looking to get the laser running since he did not reply. But even if not, someone else will come along and appreciate your information.

@robertbu

great idea. I did a summary over there in that thread. thanks for the good idea… I’m imagining that guy afk, struggling with the tidbits of project. hopefully I will be hearing from you in the future… you say your knowledge is theoretical? no machine of your own?? no worries if I’m probing, no obligation to say. :slight_smile:
thanks again for being helpful, talk to you later

I have a Premo, just not a laser. When I make suggestions about lasers, it is based on how I think things should work from reading forum posts, crawling around in the firmware, and some hobbyist knowledge of microprocessors. I use the word(s) “theoretical” or “no personal experience” in some posts so the person reading my suggestion knows not to take what I write as gospel based on my personal experience.

3 Likes

good to know, I appreciate having people like yourself being helpful.

I get the feeling I’m going to redo a dedicated plasma frame design to supercede my current large cnc housing that you may remember In my other thread. I would like to be able to use the mpcnc for many fun uses. it’s good to know somebody like yourself is out there being quite helpful. thanks again :slight_smile:

3 Likes