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 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.
Hardware: Arduino Due, power supply (5v), Servo motor.
Software: Arduino nightly, download it from link below (https://www.arduino.cc/en/Main/Software)
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
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw