Hello,
I have a problem with controlling stepper motors by ESP32 DEVKIT V1.
I've uploaded FluidNC software (v3.5.0), I've established proper connection, even by WiFi, but motors are humming, when I've plugged the power supply it seems like the machine is trying to home Y axis, but motors are moving in very strange way. When I click the limit switch from the Y axis nothing happened, but when i clicked limit switch from the X axis, the motors stopped.
These are settings I've used to set everything up:
name: "Plotter"
board: "DOIT ESP32 Dekit V1"
stepping:
engine: RMT
idle_ms: 250
dir_delay_us: 1
pulse_us: 2
disable_delay_us: 0
axes:
x:
steps_per_mm: 100
max_rate_mm_per_min: 3000
acceleration_mm_per_sec2: 25
max_travel_mm: 600
soft_limits: true
homing:
cycle: 1
mpos_mm: 0
positive_direction: false
feed_mm_per_min: 200.000
seek_mm_per_min: 3000.000
settle_ms: 500
seek_scaler: 1.100
feed_scaler: 1.100
motor0:
limit_all_pin: gpio.34
stepstick:
direction_pin: gpio.13
step_pin: gpio.5
motor1:
null_motor:
y:
steps_per_mm: 100
max_rate_mm_per_min: 3000
acceleration_mm_per_sec2: 25
max_travel_mm: 1200
soft_limits: true
homing:
cycle: 1
mpos_mm: 0
positive_direction: false
feed_mm_per_min: 200.000
seek_mm_per_min: 3000.000
settle_ms: 500
seek_scaler: 1.100
feed_scaler: 1.100
motor0:
limit_all_pin: gpio.35
stepstick:
direction_pin: gpio.19
step_pin: gpio.18
motor1:
null_motor:
z:
steps_per_mm: 100
max_rate_mm_per_min: 3000
acceleration_mm_per_sec2: 25
max_travel_mm: 1000
homing:
cycle: 0
mpos_mm: 10
positive_direction: false
motor0:
limit_all_pin: NO_PIN
stepstick:
direction_pin: gpio.33
step_pin: gpio.32
motor1:
null_motor:
spi:
miso_pin: NO_PIN
mosi_pin: NO_PIN
sck_pin: NO_PIN
sdcard:
cs_pin: NO_PIN
card_detect_pin: NO_PIN
coolant:
flood_pin: NO_PIN
mist_pin: NO_PIN
probe:
pin: NO_PIN
PWM:
pwm_hz: 5000
output_pin: gpio.4
enable_pin: NO_PIN
direction_pin: NO_PIN
disable_with_s0: false
s0_with_disable: true
spinup_ms: 0
spindown_ms: 0
tool_num: 0
speed_map: 0=0% 10000=100%
I do not have a dedicated MKS DLC32 for this project, so I built my own schema.
My power supply is MEAN WELL LRS-350-24, I'm using DC-DC converter to decrease the voltage from 24V to 5V (I set it around 5.5V), ESP32 DEVKIT V1 to control everything, level shifter TXS0108E to convert 3.3V logic to 5V and then from high voltage side send the instructions to the DM542 which control the stepper motor.
Schema below:
I connected the GPIO pins to DIR- and PUL- as it is mentioned here:
X axis:
PUL- D5
DIR- D13
Y axis:
PUL- D18
DIR- D19
Z axis:
PUL- D32
DIR- D33
X Limit switch - D34
Y Limit switch - D35
I didn't know what was wrong so i decided to erase the flash memory on the ESP and uploaded this code to check if i'll be working with only one stepper motor:
#include <AccelStepper.h>
int stepper1Pulse = 5;
int stepper1Dir = 13;
int motor1Speed = 0;
int speedMin = 0;
int speedMax = 2000;
AccelStepper step1(1, stepper1Pulse, stepper1Dir);
void setup() {
step1.setMaxSpeed(speedMax);
step1.setSpeed(0);
pinMode(stepper1Pulse, OUTPUT);
pinMode(stepper1Dir, OUTPUT);
digitalWrite(stepper1Pulse, LOW);
digitalWrite(stepper1Dir, LOW);
}
void loop() {
// Increasing speed 0 to max
for (int i = 0; i <= 1023; i++) {
motor1Speed = map(i, 0, 1023, speedMin, speedMax);
step1.setSpeed(motor1Speed);
step1.runSpeed();
delay(10); // Fluent movement
}
// Decreasing speed from max to 0
for (int i = 1023; i >= 0; i--) {
motor1Speed = map(i, 0, 1023, speedMin, speedMax);
step1.setSpeed(motor1Speed);
step1.runSpeed();
delay(10); // Fluent movement
}
}
What happend next is very strange: all motors (other Y and Z axis) which were not supposed to move as there should be no output signal on the other pins*(I've programmed only D5 and D13 pins which are corresponding to X axis)* had worked as I described in code along with the specific one I've programmed to move. The stepper motors operation is unstable, maybe it's due to my bad soldering as I'm doing the project on prototype board.
I exclude bad connection between stepper motor and driver and driver or stepper motor fault as I carefully checked all of these. Also TXS0108E is working fine. There is no short circuit as I checked the connections. I really do not know what's wrong; is it a hardware issue, loose cables, or some properties of ESP32 which I do not know about.
If you had a similar issue, I would be grateful if you could help me!

