Using Servo Motors (SG90)

Servo motors give you precise control over their movements. Ideal for moving arms or joints in your DIY project. In this video, I'll explain how to use the SG90 (a great cheap servo motor) with the ESP32. No additional hardware required!

Useful resources

Wiring diagram:

How to connect the SG90 How to connect the SG90

Full code used in this video:

#include <Arduino.h>
#include <ESP32Servo.h>

#define PIN_SERVO 13
Servo myServo;

void setup(){

void loop(){
for (int pos = 0; pos <= 180; pos += 20) {


💌 Subscribe to my newsletter

Monthly newsletter with cool stuff I found on the internet
(related to science, technology, biology, and other nerdy things)!
Check out past editions.