Servo Motor Control using MATLAB using Arduino

Servo Control with MATLAB

In this tutorial you will learn to make direct connection between your Arduino and Matlab, so that you can program your Arduino directly through Matlab. It is very useful when you are working on complex robotics like Robotic Hand, Humanoid etc. as you can process your complex program on your PC in Matlab and then directly program the results in Arduino.Servo Control with MATLAB

So let’s get started:

First of all you have to download Arduino support package from Matlab. You can download it by using following link:


It will download a compressed file, so first of all uncompressed it and save it in the folder and name the folder ArduinoIO. Now open the Arduino IDE, I am using Arduino 1.0.6, click on the file menu and then open the ArduinoIO folder and select the .pde file of your interest from the Pde folder. I selected adioes.pde as it allows us to control servo motors. You may select other programs according to your choice. You may learn about various pde file by just opening it in Arduino IDE.

Now the final step will be to upload the program adioes.pde on your Arduino and now we will move on to Matlab.

I will try to teach you about Matlab code using picture so that it can be easy in understanding.

The most important thing is to select the ArduinoIO folder as your current folder in Matlab. You can do it by clicking on ‘browse the folder’.

Now after your current folder is selected, you can click on arduino.m to get all the function and commands which you can use. You can see that, first command is arduino(comport).

Now your first command will be to create a variable a=arduino(“COM3”); , it will create a variable ‘a’ which will be used to communicate between Arduino and Matlab. After that it will take few second to connect your Arduino to Matlab. You can see it in picture given below. In () you have to write about that COM port on which our Arduino is connected.

Read more:  Servo Motor Control using MATLAB

Leave a Comment

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