Skip to content

RC Servo BESC CNC I O Module

bdring edited this page Dec 17, 2020 · 11 revisions

RC Servo/BESC CNC I/O module

Photo Credit

Overview

This module allows control of up to (4) RC Servos. You can also connect a BESC (Brushless Electronic Speed Controller) for use as a spindle. There is a switch to set where the power comes from. You can either use the 5V coming from the main controller or the terminal block. The internal 5V is limited by what current the controller and single header pin can provide. The terminal block can be used to provide a lot of current and higher voltages if your servos can handle it.

Example machine definition

// RC Servo Module on Socket #4
// https://github.com/bdring/6-Pack_CNC_Controller/wiki/RC-Servo-BESC-CNC-I-O-Module
#define Z_SERVO_PIN 		      GPIO_NUM_14 // Required
#define DEFAULT_Z_MAX_TRAVEL          5.0         // Optional default
#define DEFAULT_Z_HOMING_MPOS         5.0         // Optional default

// For Module Socket #3 BESC on #1 on A,B,& C axis RC Servos on pins 2,3,& 4.
// https://github.com/bdring/6-Pack_CNC_Controller/wiki/RC-Servo-BESC-CNC-I-O-Module
#define SPINDLE_TYPE            SpindleType::BESC // default, check actual $Spindle/Type Setting
#define SPINDLE_OUTPUT_PIN      GPIO_NUM_26

#define A_SERVO_PIN                   GPIO_NUM_4
// https://github.com/bdring/6-Pack_CNC_Controller/wiki/RC-Servo-BESC-CNC-I-O-Module
#define DEFAULT_A_MAX_TRAVEL          5.0   // Range of travel is 5mm
#define DEFAULT_A_HOMING_MPOS         5.0   // MPos will be set to 5mm after homing

#define B_SERVO_PIN                   GPIO_NUM_16
// https://github.com/bdring/6-Pack_CNC_Controller/wiki/RC-Servo-BESC-CNC-I-O-Module
#define DEFAULT_B_MAX_TRAVEL          5.0   // Range of travel is 5mm
#define DEFAULT_B_HOMING_MPOS         5.0   // MPos will be set to 5mm after homing

#define C_SERVO_PIN                   GPIO_NUM_27
// https://github.com/bdring/6-Pack_CNC_Controller/wiki/RC-Servo-BESC-CNC-I-O-Module
#define DEFAULT_C_MAX_TRAVEL          5.0   // Range of travel is 5mm
#define DEFAULT_C_HOMING_MPOS         5.0   // MPos will be set to 5mm after homing

Direct Analog Control

You can also directly send PWM signals to servo with the M67 and M68 commands.

// Example Servo module in socket #4
// https://github.com/bdring/6-Pack_CNC_Controller/wiki/RC-Servo-BESC-CNC-I-O-Module
// https://github.com/bdring/Grbl_Esp32/wiki/M62,-M63,-M64,-M65-&-M67-User-I-O-Commands
#define USER_ANALOG_PIN_0       GPIO_NUM_14
#define USER_ANALOG_PIN_1       GPIO_NUM_13 
#define USER_ANALOG_PIN_2       GPIO_NUM_15
#define USER_ANALOG_PIN_3       GPIO_NUM_12
Clone this wiki locally