This maybe helpful. I wrote this up after I was able to control my ESC:
My needle cutter: https://youtu.be/iOU6zelXMo8 has worked great for me since I ordered the hardware, printed the parts and assembled it about a year ago. I’ve been using the servo tester method to start and stop the needle, like most other people. But, I’ve always wanted it to be able to turn off and then end of a sheet of foam board. I’ve tried to figure it out myself without success. I’ve waited patiently for someone else to post how they successfully did it. Finally, I’ve figured it out and feel I need to help others because I’ve seen others with this same request in multiple locations. Here’s how I did it:
My setup:
MPCNC with a Needle cutter used for DTFB (purchased through V1Engineering)
RAMBO Board with Dual End Stops
Firmware Version: Marlin-MPCNC_Rambo_T8_16T_LCD_DualEndstop based on bugfix-2.0.x
Firmware Edit:
Uncomment line 2122 in Configuration.h and upload to RAMBO board.
From: //#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
To: #define NUM_SERVOS 1 // Servo index starts with 0 for M280 command
Hardware:
The V1Engineering’s discussion on laser’s, spindle speed, and pwm wasn’t working for me, but they gave me valuable clues.
https://www.v1engineering.com/forum/topic/laser-spindle-control/
https://www.v1engineering.com/mini-rambo-1-3/
I looked up the pinout locations for servos in the /src/pins/pins_RAMBO.h file. I didn’t change any of the pin callouts. The RAMBO board says:
//
// Servos
//
#define SERVO0_PIN 22 // Motor header MX1
#define SERVO1_PIN 23 // Motor header MX2
#define SERVO2_PIN 24 // Motor header MX3
#define SERVO3_PIN 5 // PWM header pin 5
I decided to use Servo 0 to connect to my ESC. Now, I searched for PIN 22 in the pinout schematic.
Pinout Schematic: https://github.com/ultimachine/RAMBo-1.4/blob/1.4/Project%20Outputs/Schematic%20Prints_RAMBo_1.4a.PDF
I had never really looked at these kind of schematics before, but deciphered that pin 22 was the middle of 5 pins on MX1.
So, I wired the ESC ground pin to the ground on MX1 and the signal pin on PIN 22 of MX1 (the middle pin on MX1). [My ESC main power leads are wired directly to the 12V mains].
[attachment file=108337]
Edited Gcode:
M280 instructions: http://marlinfw.org/docs/gcode/M280.html
Added this Gcode to my programs. I use Estlcam (which has worked great for me.)
At Program Start:
M280 P0 S040 ; Give low PWM signal for ESC to boot up
G04 S3 ; Pause 3 seconds for ESC to turn on
M280 P0 S080 ; PWM signal for Needle cutter. Change S<value> to required PWM signal
At Program End:
M400 ; Pause and wait for all moves to complete
M280 P0 S040 ; Turn off Needle Cutter