Marlin 2.0 Spindle enabled (M3/M4/M5)

I have been working on setting up my spindle to be turn on and off by the Marin firmware. I have the RAMBo board with the current firmware for the dual end stops firmware attached to a PWN AC light Dimmer module. I have attached the two board together using pin 45(PL4), VCC and GND that is located on the RMABO Boards Motor Extension X31. On the PWN AC light Dimmer module, I used the VCC, PWM and GND.

I tested the hardware by running a script that dimed a light attached to the dimmer, so I am confident that the hardware is working correctly. I believe I have misted something on the setup of Marlin. The pins_RAMBO.h file was set to use pin 45 for PWM. The other change I made was to Configuration_adv.h file. The #define SPINDLE_LASER_ENABLEconfiguration was changed from a comment to a command. After making the changes, I flashed the RAMBo board.

[attachment file=58543]
[attachment file=58544]

When the board came back up the light came on, but I was unable to get it to do anything else when I sent M03 or M05 commands. I spent a few hours doing Google searches to see if I was missing something but could not get it to work. I am hoping someone can tell me what I have done wrong.



Have a look at this thread, disregard the PID stuff.

What dimmer are you using, most can not handle a motor. I have two in the thread one is verified and the other should work but not verified.

I am using this one that came from Amazon. At this point I have only been using a light to test the dimmer.

[attachment file=58560]

I have been fallowing this thread and it has help get me to the point I am at.
Believe that I am just missing something in the Marlin settings.


I have all of my settings a few pages in. You have all true, I believe I have a few false. Match mine before we try and trouble shoot anything. At the same time I am piping mine to an arduino first so it very well could be different.

Using that dimmer will not give you exact RPM, it is just going to vary the speed by an unknown amount. you will need something to give you an accurate measurement, or you will probably be better off with a manual dimmer.

I looked at your settings and only see that the #define SPINDLE_LASER_ENABLE_INVERT and #define SPINDLE_DIR_CHANGE were difrent than my screen shoot. I have tried the #define SPINDLE_LASER_ENABLE_INVERT= true and #define SPINDLE_LASER_ENABLE_INVERT = false and do not get any change.

Could the problem be with Repetier-Host. I am using the Manual Control to sent a G-Code to the RAMBo?

I use repetier.

What commands are you sending? You said it worked with a lamp, what did you change? If it works with one it should work with the other.

It to work with a test sketch loaded on the RAMBo to see if the hardware was setup correctly.

[attachment file=58570]

I have not gotten it to work with Marlin loaded in the RAMBo board.


What command are you using?

Try M3 S10000

I have tried

M3 S0

M3 S30000

M3 S200

M3 s250


Are you sure the flash went correctly? Does the rest of the machine get controlled by repetier?

Can you give more info so I don’t have to ask so many questions. Maybe a picture or two as well?

I will have to see if the rest of the machine is working. I was working with it on the work bench so it was not attached to the stepper motors. I will also take some photos tonight.

Thanks for the help.

Here is the details on my setup with some photos.

I have my electronics in two boxes that I mount on the underside of my table.

One box has the Power supply and RAMBo board. The other box has the 120V side of my system.

[attachment file=58645]

I am using the RAMBo board and have it flashed with the firmware that I downloaded from GET-HUB on Saturday for the RAMBo with dual end stops, 16T, T8 Leadscrew.

The Rambo Board is attached to the AC Dimmer by the pins on the Motor Extension X31.

[attachment file=58646]

In the AC Dimmer I am suing the VCC, PWM and GND.

[attachment file=58647]

To test the setup I flashed the RAMBo with a test sketch and get the light to dim.

Test Light Video

The next step was to flash the MPCNC Marlin firmware onto the board.

Then I went into Repetier-Host, Manual Control to sent a M3 S30000 and M3 S0 to the RAMBo and the test light will not go on. I then did a home X&Y and it worked. After that I ran the code to cut a test object and it worked.

I believe that I am missing something, but I did not know what to try next.

All your help is greatly appreciated.



So your spindle dimmer works after homing or do you mean just the machine works?

If it isn’t working it probably has something to do with the slope part of the spindle enable in marlin. Next time I get a chance I will try mine without the PID, but maybe you can just drop a nano on there and use my PID…I can always use more testers???

Sorry I was not clear on that. Just the machine works not the dimmer.

Would love to test the PID, but need to track down the parts to read the spindle speed.

How many wire do you need at the spindle to read the speed?

3-4 depending. The new sensor should be here today or tomorrow and I will know if they work and what it takes.