ESP32Servo + Heltec LoRa 32 V3

I require some help to programme esp32servo SG90. Since I am using esp32 microcontroller I am using esp32 Servo header files. Normally arduino uno would use servo.h.

The thing I do not understand is how to get my servo motor to turn from 0 to 90 and 90 to 0. The codes that i try sometimes turn the servo motor one round, 2 round, 4 round, 6 round. I even followed online guides from youtube and google search engine. I don't know if it is something to do with my board but i just cant seem to write a programme to make it turn exactly 90 degrees.

If your servo moves through 360 degrees or more then it is almost certain that you have what is called a "continuous rotation servo". If so, then you will not be able to command it to a given angle as you can only control its rotation direction and speed

Try the Sweep example and report back what happens

Where did you get the servo and how are you powering it ?

it spins for about 2.5 cycles avg both directions.

my setup is I am just connecting the heltec lora32 v3 to the SG90 Servo motor. There is a slight displacement from each rotation

the pinout for the esp32:

That confirms that you have a so called "continuous rotation servo" and cannot control its angle

I see, thank you. I will find out more on how to programme the continuous rotation servo. Will keep you updated if I managed to make it work.

There is not much to it

If you write a value of more than 90 to it will rotate in one direction with a speed proportional to the value written. If you write a value of less than 90 to it then it will rotate in the opposite direction with a speed proportional to the value written.

You cannot make it stop at any particular angle

Thank you very much for the help.

Btw just out of curiousity using the heltec esp32 board can I implement a web server integration to control the servo motor motion like max foward or max reverse?

like when u press open the servo turns one side for 2-3 seconds and close the servo turns in reverse 2-3 seconds?

the ESP32 has onboard WiFi and can run TCP/IP servers and clients
try an example from File>Examples>WebServer

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.