HowTo: ESPEasy - Using a PCA9685 to control servos

The PCA9685 is a PWM port expander. With this it is possible to connect up to 16 LEDs, servos or other components to your ESP8266 and supply them with a PWM signal.

Thanks to ESPEasy (and the appropriate plugin), controlling the PCA9685 is particularly easy. So you can ultimately control up to 16 servos with the PCA9685 using ESPEasy.

In order for this to work, however, you need to consider a few settings. Everything you need to know is described in the following article.

Safety instructions

I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.

Affiliate links/advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support in being able to offer other useful projects in the future. 🙂 


Helpful articles:
Additional tips on ESPEasy can be found in the following articles.

Required tool:

Required material:

The mode of operation

The signal for controlling a servo basically consists of a pulse of 0.5 to 2.5ms in length. This pulse should be repeated every 20ms.

This signal can be simulated with the help of the PCA9685. For this purpose, only the PWM frequency must be adjusted so that it corresponds to the period of the servo signal.

In this picture you can see the relation between servo signal (left) and servo position (right) quite well.


Configuration in ESPEasy

This section is only about the configuration of the ESPEasy plugin. That means you should have already connected the PCA9685 or the breakout board on which it is installed to the ESP8266. Therefore you should have connected the two according to the following scheme.

VCC5V or 3V3

Your ESP8266 should already have the ESPEasy firmware installed. How you can proceed is described in the article ESPEasy - Compile firmware, flash and configure WLAN access data described.

Then you can switch to the “Devices” section and create the device “Extra IO – PCA9685”.

You should then configure the created plugin as shown.

It is important that you set the PWM frequency to 50Hz. This corresponds to the period length of 20ms (necessary for the servo).

If you have made all configurations you can control the connected servos with the correct command.


The command


represents the PWM signal of the first(=0) Connection of the PCA9685 (which PCAPWM means )to the value 300.

For example, for the servo I use on port 0 of my PCA9685, I could use the following commands.

  • Smallest angle: PCAPWM,0.50,
  • Largest angle: PCAPWM,0,300,

How to send commands to your ESPEasy device is described in the article ESPEasy - Execute commands and actions via HTTP, MQTT, UDP and directly described.

Additional general info about this ESPEasy plugin can also be found at the following link:

Have fun with the project

I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂

PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂

Buy Me a Coffee at       

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert

This site uses Akismet to reduce spam. Learn how your comment data is processed.