This was my Mechatronics Final Year Project at the Faculty of Mechanical Engineering in Skopje. It objective was to develop a device that will enable interaction of real arm movements with 3D computer models. I integrated three different fields in one device, t.e. mechanical, electrical and computer engineering:

• Solidworks to design the 3D model that represent the movements of the arm.
• Arduino Mega 2560 card for connecting the real world with the computer.
• MATLAB / Simulink to program the control of the 3D model

In the next video you can see a presentation of the project. This is its content:

• An Introduction. Here I briefly talk about the Mechatronics as a field of study which enabled me to develop this kind of a device.
• The Arduino Mega 2560. Some basic features of this Arduino Board which I used in this project.
• 3D Models in Simulink Environment. How to transfer 3D Model from Solidworks to Matlab / Simulink using the SimMechanics Link.
• Development of the device. Here I talko about the components that I used to build the device and how they work, as well as the Simulink Model, the program that is running on the Arduino Board and enables the interaction between the real world and the computer

## Building the device

### Parts used in this project

• Arduino Mega 2560
• 3-Axis Accelerometer
• Linear Potentiometer x5

The accelerometer is used for tracking the orientation of the arm. As the arm moves, the values from the X, Y and Z axis from the accelerometer change and are being read in the Analog Inputs of the Arduino Board. According to them the 3D Model moves as well.

The potentiometers are used for tracking the position of the fingers. I attached a spring (pen spring) to each of the potentiometer. The spring holds the potentiometer slider at a certain position and as the fingers move the slider is being pulled and the resistance of the potentiometer is change. That values are being read in the Analog Inputs of the Arduino Board and according to them the 3D Model’s fingers moves as well.

I used a plastic cover from a calculator as a base on which i attached the five potentiometrs. On top of them I put the Breadboard on which i secured the Arduino Board and the Accelerometer using a tape. On the picture below you can see the final appearance of the device.

## The 3D Model

The 3D Model is a representation of a human arm. First, I modeled it using Solidworks and then I transferred it into Matlab / Simulink using the SimMechanicsLink from Matworks.

## The MATLAB / Simulink Model

Before building the Simulink model, first I had to install the Arduino IO Package which consists the Simulink library for communication with the Arduino board. Also using the Arduino IDE i had to upload the code to the Arduino board that comes with the package to enable the Simulink library. Here I would highly recommend my Tutorial for Matlab and Arduino IO Package so that you can understand the working principle and see the code.

I organized my Simulink model into six subsystems:

• Arduino analog inputs blocks for the values from the accelerometer and the potentiometers
• Correction of the analog reads according to my needs
• PID control for getting smoother movements
• Joint Actuators blocks for driving the joints of the 3D model
• The 3D Model which was automatically generated using the SimMechanicsLink
• Joint sensor block for tracking the position the 3D model

Check my Extension of this Project.

I reprogrammed the Arduino Glove to work as a Game Controller.

### 54 Responses

1. naveen

awesome project.keep it up ……………with more useful thoughts

2. bawwa

Very good project mate, Are you on Facebook? I have some queries.

3. Humayun

Hey Dejan, awesome work. I really liked your informative videos and I finally understand how I2C works, which I never able to grasp before 🙂 Thanks buddy.
Keep up the new projects and informative videos about how things work. You really teach in simply way by putting up examples as well. Thumbs up 🙂

4. nilesh sable

Nyc bro.Its a fantastic project. U r a brilliant.i want to make this project as final year project.To what have u connected the pen spring ???

5. tayyub

i am mechatronics engineer bro. and i want to make this project,please share the code of arduino….

6. tayyub

Amazing bro. you have done great work.I’m mechatronics engineer and i also want make this project ,can you please share the arduino code.

7. Shanjedul Hassan

Good project bro… I just like to know what sensor you use in this project…? Can you give the code you use for this..? I like to make it… If you help me, the will be so kind… Thanks for your post….

8. Bilal

First thing you are doing great projects. the second and most valuable thing is you are sharing this information with public. I really appreciate that..

9. Bilal

Can I translate it to Turkish to make it benefical for people who cant speak english.

• Dejan Nedelkovski

Well all my projects and tutorials are my original work on which I have put enormous amount of time and effort. All the photos, videos and illustrations are copyrighted. Just translating them to your language would be the same as copying them which is not allowed.
If you want to do that, you should rebuild (recreate) them on your own, with your own content (photos, videos, illustrations, text).
Thanks for understanding!

10. wahid

hai…great work you have there…I’m wahid from malaysia..I’m doing my final year project this year..I want to ask, is it possible make the GUI for 5 axis robotic arms using the way you create yours?if it is possible, can you teach me how to do the integration between all the software?

11. Samir

Great Work, very interesting. The 3D Arm model you have uploaded here shows rebuild errors in Solidworks 2016. Is it possible to upload the file again?

• Samir

Thank you very much. You are truly awesome for being so helpful to people all around the world.

12. Alex

WOW.You are perfet my friend,PERFECT! I realy like the way you do things,BRAVO!

just one question: can it work for the other 3d models like a MAYA or 3D MAX model? if the answer is yes, can you guid me about it?

thanks.

13. Shakil

In the Simulink model you provided, how can I connect the imported xml model from the Solidworks file and the arduino hardware?
I would be highly grateful if you help me out.
Thanks

14. Samir

I am trying to build your system out of curiosity, with your help, the solidwork model now works, but, I am facing error when I run the simulink model in Matlab 2015. They show a algebraic loop error inside the PID controller. How did you get past this error? How can I do proper simulink rebuild? Awaiting your help. Thanks.

15. Valentin Dimitrov

Hello , Dejan!
What you’ve done is great! Congratulations! I got the idea to follow the rotary chassis , boom, arm and bucket of the excavator and always know how much have to dig. Much like your project. I’m curios how accurately can measure angles between components with combined accelerometer an gyro sensors. The rest is mathematics.
Greetings for best tutorials that you have shown here ! Keep going!

• Dejan Nedelkovski

Hi there,
Well the gyro tends to drift and make errors. There are different filters that can reduce these errors but they could be complicated to be implemented.
So, a project like that would work for sure, although the mathematics would be complicated and as for the accuracy I could say anything specific.
Cheers!

16. vinodkumar

hi dejan
that very good project i did not understand how you linked to 3d animation ,because i think i don’t the mat lab so can please put a link where i can learn this integration of all the three things.so we can make some different thing

17. Zalman

I love this tutorial very much! I’d like to make one by myself. But I can not find the arduino code in this tutorial and how to use the SimMechanicsLink ? Could you help me out? Really appreciate!

• Dejan Nedelkovski

The Arduino code comes with the Arduino IO Package and I have an example tutorial how to use the SimMechanicsLink here on the website. However, take a note at the version of your Matlab, because the latest versions don’t work with this Arduino IO Package, they have made a different one.