SG90 servo motor
A small motor that moves its arm to a precise angle, from 0 to 180 degrees: barriers, grippers, robot arms.
The test program
Test this part on its own before you build the rest: if it works alone, the rest is built on something you know works.
10 SERVO 0
20 WAIT 1000
30 SERVO 90
40 WAIT 1000
50 SERVO 180
60 WAIT 1000
70 GOTO 10What you should see: The arm goes to 0°, then 90°, then 180°, and starts again.
▶ Try it in the IDEWhat to buy
- SG90 micro servo
How to wire it to an ESP32-S3
- Signal → ESP32-S3: GPIO8
- VCC → ESP32-S3: 5V
- GND → ESP32-S3: GNDCommon ground: this link is mandatory.
If it does not work
- The board restarts by itself
- When it starts, the servo draws more current than the board gets from USB, and the voltage drops. Put a 100 µF capacitor between 5 V and GND close to the servo, or power it separately with a common GND.
- The program runs but nothing happens
- The servo gets no 5 V, or the signal is on the wrong pin. Brown wire to GND, red to 5 V, orange to the signal pin shown in the diagram.
What you can adjust
- The angles: where the arm starts and where it ends, from 0 to 180.
Which boards it works on
- ESP32-S3 Freenove: yes
- Nordic nRF54LM20 DK: yes
- Arduino UNO R4 WiFi: yes