Servo Motor Control with Arduino Due

As discussed earlier, Arduino Due is an ARM controller based board designed for electronic engineers and hobbyists. This DUE board can be used for making CNC machines, 3D printers, robotic arms etc. All these projects have a common feature that is Position Control. Any of these projects needs accuracy towards their position. Accurate positions in these machines can be achieved by Servo Motors. In this session we are going to control the position of a Servo Motor with Arduino Due. We have already covered the Servo Motor Interfacing with Arduino Uno and Servo Motor Interfacing with 8051 Microcontroller.

Servo Motor Control with Arduino Due

Servo Motors:

Servo Motors are known for their accurate shaft movement or position. These are not proposed for high speed applications. These are proposed for low speed, medium torque and accurate position application. These motors are used in robotic arm machines, flight controls and control systems. Servo motors are also used in some of printers and fax machines.

Servo motors are available at different shapes and sizes. We will be using SG90 Servo Motor in this tutorial. SG90 is a 180 degree servo motor. So with this servo we can position the axis from 0 to 180 degrees.

A Servo Motor mainly has three wires, one is for positive voltage, another is for ground and last one is for position setting. The RED wire is connected to power, Brown wire is connected to ground and YELLOW wire (or WHITE) is connected to signal.

A Servo Motor is a combination of DC motor, position control system and gears. In servo, we have a control system which takes the PWM signal from signal pin. It decodes the signal and gets the duty ratio from it. After that it compares the ratio to the predefined positions values. If there is a difference in the values, it adjusts the position of the servo accordingly. So the axis position of the servo motor is based on the duty ratio of the PWM signal to the SIGNAL pin.

The frequency of PWM (Pulse Width Modulated) signal can vary based on type of servo motor. The important thing here is the DUTY RATIO of the PWM signal. Check this for PWM with Arduino Due. However in this case, we need not even worry about with the Duty Ratio selection. In Arduino we have a special function; upon calling it we can adjust the position of servo, just by stating the angle. We will talk about that in the Working Section below.

Servo Motor Control with Arduino Due schematic

Before Interfacing Servo Motor to Arduino Due, you can test your servo with the help of this Servo Motor Tester Circuit. Also check these projects to Control Servo by Flex Sensor or by Force Sensor.


Hardware: Arduino Due, power supply (5v), Servo motor.

Software: Arduino nightly, download it from link below (

For, details on How to download and install this software, visit the first tutorial Getting Started with Arduino Due.

Circuit Diagram and Working Explanation:

As said earlier in ARDUINO, we have predefined libraries, which will set the frequencies and duty ratios accordingly, once the header file is called or included. In ARDUINO we simply have to state the position of servo that needed and the DUE generates appropriate PWM signal for the servo. The things which we need to do for getting accurate position of servo are,

Read more: Servo Motor Control with Arduino Due

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top