PWM Controlled Linear Actuator

Sorry ledc is now removed. Still no luck unfortunately.
Here is a pic.

I’ve also connected the 5VO pinout to the ESP32. I noticed the led on the ESP32 didn’t illuminate as it would when connected via USB-C, however ESPHome is able to connect to it so I’m assuming I no longer need to power it using the USB-C cable?

You’ve got IN1 and PWM connected to gpio’s which are defined as analog input pins in the esp32 datasheet. Try using digital ones for those as well. For example gpio12 (D9) and gpio14(D7).

I’ve changed the pins to those mentioned. Still not working.
New wiring configuration:
IN1 - GPIO12
PWM - GPIO14

Do you have any other suggestions to try or do you think perhaps it’s time to go down the path of using relays?

Yeah i’m starting to run out of suggestions. Go ahead and try out a relay.
You could even use a Shelly2pm; no need for esphome in that case.

I bought the Shelly 2.5 but realised this requires a 24v power supply.
I’ve never used Shelly products before so I’m expecting another steep learning curve…

FYI I tried using the L298N h-bridge with your ESPHome config. with GPIO3 - ENA; GPIO12 - IN1 and GPIO16 - IN2.
As soon as I connected the power, the shelf lowered itself until it reached the built-in endstop.
The h-bridge started to get warm after say 30-60 seconds so I just unplugged it.

So it was a faulty motor driver then?
The L298N can only support 2A max and even then it gets warm. There are many other inexpensive motor drivers that can handle more current, if you’re still wanting to go this way. A few examples (please have a look at the specs though, some of them don’t work with 3.3V logic for example and you would need a levelshifter):
Link
Link
Link

No the motor driver is not faulty. I know this because I tried the below code to eliminate the possibility of a bad driver.

/*********
  Rui Santos
  Complete project details at https://randomnerdtutorials.com  
*********/

// Motor A
int motor1Pin1 = 2; 
int motor1Pin2 = 13; 
int enable1Pin = 14; 

// Setting PWM properties
const int freq = 30000;
const int pwmChannel = 0;
const int resolution = 8;
int dutyCycle = 200;

void setup() {
  // sets the pins as outputs:
  pinMode(motor1Pin1, OUTPUT);
  pinMode(motor1Pin2, OUTPUT);
  pinMode(enable1Pin, OUTPUT);
  
  // configure LED PWM functionalitites
  ledcSetup(pwmChannel, freq, resolution);
  
  // attach the channel to the GPIO to be controlled
  ledcAttachPin(enable1Pin, pwmChannel);

  Serial.begin(115200);

  // testing
  Serial.print("Testing DC Motor...");
}

void loop() {
  // Move the DC motor forward at maximum speed
  Serial.println("Moving Forward");
  digitalWrite(motor1Pin1, LOW);
  digitalWrite(motor1Pin2, HIGH); 
  delay(2000);

  // Stop the DC motor
  Serial.println("Motor stopped");
  digitalWrite(motor1Pin1, LOW);
  digitalWrite(motor1Pin2, LOW);
  delay(1000);

  // Move DC motor backwards at maximum speed
  Serial.println("Moving Backwards");
  digitalWrite(motor1Pin1, HIGH);
  digitalWrite(motor1Pin2, LOW); 
  delay(2000);

  // Stop the DC motor
  Serial.println("Motor stopped");
  digitalWrite(motor1Pin1, LOW);
  digitalWrite(motor1Pin2, LOW);
  delay(1000);

  // Move DC motor forward with increasing speed
  digitalWrite(motor1Pin1, HIGH);
  digitalWrite(motor1Pin2, LOW);
  while (dutyCycle <= 255){
    ledcWrite(pwmChannel, dutyCycle);   
    Serial.print("Forward with duty cycle: ");
    Serial.println(dutyCycle);
    dutyCycle = dutyCycle + 5;
    delay(500);
  }
  dutyCycle = 200;
}

So I can confirm that all components are in perfect working order.
The problem is in ESPHome / configuration. But WHY?!?! I hate not knowing the reason and feel it is likely something minor in the scheme of this project.

Oh and I have the BTS7960 but haven’t had any success with it. I have a feeling it’s the driver as when it arrived the pins were all bent and it was poorly packaged.