Project showcase
Robotic Arm: Arduino + Matlab

Robotic Arm: Arduino + Matlab

This robotic arm can be controlled with computer mouse or it can make decisions by itself with Matlab vision system.

  • 13,709 views
  • 10 comments
  • 33 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
The robot's brain. It's used to process mouse's movement and also to establish robot-Matlab comunication.
×1
Servos (Tower Pro MG996R)
I used 3 servos as 3 degrees of freedom and one to work as a gripper.
×4
Computer Mouse
Not the one you are using with your PC! Extra one is needed.
×1
Camera (generic)
Just a standard webcam. We need one to make the robot "see".
×1

Apps and online services

Ide web
Arduino IDE
H5g3etjnacmazg8oq17z
MATLAB
Amazing software. I used it to develop vision sysyem. Read on for details.

About this project

Introduction

It was an obligatory task during my studies to develop an Arduino based project. I am really interested in robotics so I decided to make a robot of my own. The idea was to build a desktop robotic arm possible to control with computer mouse. After I achieved that, I came to a conclusion that the project was too simple - that's just controlling 4 servos with a computer mouse - not funny at all, so I started my work on image processing program. I am familiar with Matlab software so I decided to use it for this purpose.

Video

In the video you can see the final effect. This video was made for Matlab's contest and it also includes some explanations which I may duplicate in further description:

How it works?

The robot can work in 2 modes. Manual - with the mouse controlling it and automatic with vision system. Connecting computer mouse with Arduino is pretty easy - I used this schematic and this library.

When it comes to communication between Arduino and Matlab, there are 2 ways to deal with it. First is by using Matlab support package for Arduino, it's quite handy when you want to access some Arduino's variables from Matlab to show them on graphs or do math calculations on them. The second way (the one I used) is using serial comunication.

Automatic mode - image processing

If you haven't watched the video above - please do now. Below i will explain some of the most important functions that I used in Matlab. However to truly understand how this image processing works, you have to see what the robot sees.

The functions worth mentioning are:

  • snapshot - to acquire images from webcam
  • rgb2gray - to convert image to greyscale
  • bwareaopen - to remove noise from binary picture
  • regionprops - to measure white spot and find its location

From the last function, Matlab is able to find centerpoint of the tape (its position). It then calculates on which out of 3 possible locations the tape is. What is left to do is to send the location number to Arduino with fprintf function. Then Arduino (depending on what value it recieved) decides which location to approach.

As you may have noticed - this vision system is not able to recognize any location but only one out of three predefined.

Serial communication trick

When we open serial communication on our Arduino, the controller will reset. You can notice that it even resets when you open the Serial Monitor in IDE. To deal with it, I soldered a 10uF capacitor between RESET and GND pins of Arduoino (+ goes to RESET). Details here.

Using Matlab Support Package for Arduino

I haven't used it in this project but I did in another one and I think it's worth mentioning. To install the package, go to: Add-Ons -> Get Hardware Support Packages -> Install from Internet -> Arduino.

There are many many functions to use with this packege, you can find the list here.

You can write whole program on Arduino using Matlab thanks to this package, but it doesn't seem conveninet to me. What I used it for is when I had to watch and analyze some voltage signals and had no osciloscope to do it. Instead, I used this package and a simple code which you can find in Code section. The results were great:

Code

Real time AnalogRead plot.MATLAB
By changing the value in "toc<10" condition you can adjust for how long the plot should work.
a=arduino;
i = 1;
tic
while (toc<10)
b(i) = a.readVoltage(0);
plot(b);
drawnow;
i=i+1;
end

Schematics

Schematic
Schemat

Comments

Similar projects you might like

Simple Programmable Robotic Arm

Project showcase by Ryan Chan

  • 49,015 views
  • 63 comments
  • 145 respects

Robotic Arm Controlled by Human Arm

Project showcase by zezarandrade

  • 5,551 views
  • 0 comments
  • 11 respects

Gesture Controlled Robotic Arm Using Kinect & Arduino

Project showcase by Avinash Baranitharan and Karthikeyan

  • 8,328 views
  • 0 comments
  • 27 respects

Hand Motion-Controlled Robotic Arm

Project tutorial by Ashwini kumar sinha

  • 2,771 views
  • 0 comments
  • 6 respects

Robotic Arm from Recycled Materials

Project tutorial by circuito.io team

  • 24,658 views
  • 22 comments
  • 97 respects

Robotic Arm And 3D Modeling

Project showcase by Samuel Jasmer

  • 4,280 views
  • 3 comments
  • 20 respects
Add projectSign up / Login