Need help with config of continuous rotation servo

Hey, I have a continuous rotation sensor and trying to get it working. Mostly I have just clicking sounds only sometimes if I set the number value to like 75 it rotates. But not sure how long, it makes several rotations into that direction.

I am trying to get it running for x seconds into left and x seconds into right direction. So I later want to calibrate how long it needs to run until it has completed it task, maybe also with just a button for open/close.

Here is my config I have yet from videos, docs and samples

servo:
  - id: servo1
    output: output1  

output:
  - platform: ledc # For ESP8266 use: esp8266_pwm
    id: output1
    pin: GPIO16
    frequency: 50 Hz # MUST BE 50Hz

number:
  - platform: template
    id: servoSlider1
    name: Schacht Öffnung
    icon: mdi:sync
    optimistic: true
    min_value: -100
    max_value: 100
    initial_value: 0
    step: 5
    on_value:
      then:
        - lambda: !lambda |-
            id(servo1).write(x / 100.0);

I use an esp32-wroom-32d for the servo. Wiring should be correct because it can rotate but the config is a problem, anybody able to help please?

What servo you have and how it’s powered?

I got this 360 full metal

https://a.aliexpress.com/_EJqobu0

It is wired to VC on the esp32 wroom 32d board

That servo draws briefly ~1.2A when it starts movement and Esp is not able to supply it. You should power it directly from 5V(>1.5A) supply. If Esp is not powered from the same supply, you need common GND between servo and Esp.

Could you show the wiring how it should be if i power the servo from another power supply? I use a usb-c power supply for the esp and would need another one then for the servo.

Easiest way is to just split the cable.


Or use USB charger with two outputs, one directly to Esp usb connector and another to servo.
Remember to use >1.5A charger.

I have this usb charger with 5v 3A and 1 output, that should be good for esp and the servo right?

Wich cables from USB cable are the correct one? Red and black? Red is power and black ground i think?

Or better this one with 2 Outputs but just 5V and 2.1A

Yes, red 5V, blk GND. The 2.1A is fine and less sophisticated for simple use.

1 Like

Thanks for the help so far. Can you also help with the config? How can I add a button to move the servo for x amount of time left and a button for right?

I haven’t tried continuous servo with esphome.
You can try something like this:

button:
  - platform: template
    # ...
    on_press:
      then:
        - servo.write:
            id: my_servo
            level: -100%
        -delay: 700ms
        - servo.write:
            id: my_servo
            level: 0%
1 Like

While I haven’t used a continuous rotation servo before, I have connected two ‘regular’ servos to a ESP32cam to turn it into a PTZ camera. I’d share two tips that helped me greatly:

  1. Add a capacitor to the Vin and GND pins of the ESP32. Whenever you start a servo, it draws a huge amount of current and even if your supply is rated for it, there’s a chance that it could lead to a reboot of your chip. I don’t remember off the top of my head the capacitor size, I think it was a 22-100 uF. Adding this eliminated a lot of random behaviours with the ESP32
  2. Look into the multiple PWM channels available on the ESP32. My chip had a WS2812 LED strip along with the two servos and I found it is necessary to have the PWMs for each on different channels else they interfere with each other

Good luck with your project!

1 Like