Arduino Nano 33 IoT - Servo Motor
This guide explains how to use the Arduino Nano 33 IoT to control a servo motor.

Hardware Preparation
Or you can buy the following sensor kits:
1 | × | DIYables Sensor Kit (30 sensors/displays) | |
1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Overview of Servo Motor
A standard servo motor is a motor that turns from 0 degrees to 180 degrees.
Servo Motor Pinout
The servo motor comes with three connection points:
- GND pin (brown or black): This pin connects to the ground (0 volts).
- VCC pin (red): This pin connects to the power supply (5 volts).
- Signal pin (yellow or orange): This pin receives the PWM control signal from a pin on the Arduino Nano 33 IoT.

How Servo Motor Works
Check out this page to learn how a servo motor works: How servo motor works
Wiring Diagram between Servo Motor and Arduino Nano 33 IoT
- When giving power to the Arduino Nano 33 IoT board using the USB port.

This image is created using Fritzing. Click to enlarge image
- When you supply power to the Arduino Nano 33 IoT board through the Vin pin.

This image is created using Fritzing. Click to enlarge image
※ NOTE THAT:
When you power the Arduino Nano 33 IoT board with USB, do not use the Vin or VBUS pins to power your servo motor. Using these pins for the servo can damage your board.
Arduino Nano 33 IoT Code
Detailed Instructions
If you are new to the Arduino Nano 33 IoT, be sure to check out our Getting Started with Arduino Nano 33 IoT tutorial. Then, follow these steps:
- Connect the components to the Arduino Nano 33 IoT board as depicted in the diagram.
- Use a USB cable to connect the Arduino Nano 33 IoT board to your computer.
- Launch the Arduino IDE on your computer.
- Select the Arduino Nano 33 IoT board and choose its corresponding COM port.
- Copy the code above and paste it into the Arduino IDE.
- Click the Upload button in the Arduino IDE to check and send the code to the Arduino Nano 33 IoT board.

- See the result: The servo motor slowly turns about 180 degrees, first to the right and then to the left.
Line-by-line Code Explanation
The code for Arduino Nano 33 IoT above explains each line. Please read the comments in the code!
How to Control Speed of Servo Motor
Check out this guide on how to control a servo motor's speed: https://arduinogetstarted.com/faq/how-to-control-speed-of-servo-motor
Video Tutorial
You can find the guide and code for the video above in this How to control a servo motor via the web tutotial.