element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
STEM Projects
  • Learn
  • Learning Center
  • STEM Academy
  • STEM Projects
  • More
  • Cancel
STEM Projects
Blog Matlab + Arduino = Awesome!
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join STEM Projects to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: adnathanail
  • Date Created: 24 Aug 2015 9:06 PM Date Created
  • Views 874 views
  • Likes 2 likes
  • Comments 7 comments
  • teachers_pet
  • r4gv
  • teachers pet robotics design challenge
  • r4gv_project
Related
Recommended

Matlab + Arduino = Awesome!

adnathanail
adnathanail
24 Aug 2015

I know I haven't posted in a few weeks but that doesn't mean I haven't been work on the project.  To make up for that I am going to do two in quick succession now!

The first thing that I have been doing is getting the Arduino talking to MATLAB, which was harder than it may first seem. Initially MATLAB couldn't even recognise the Arduino UNO but for some strange reason it could recognise the Duemilanove so...? But I eventually realised that if I specified the port and board type then it would recognise it. I then quickly worked out servos and moved on to the actual programming of the robot whereupon I found an issue.

 

The issue was that if I set one servo going then the other servo going, paused then turned them both back off again, the robot drifted. This was because although the amount of time between each command being run is tiny, it is still noticeable between one servo beginning and the other.  The result was its final position was about half a centimetre to the left or right depending on which way round I put the commands.

 

The first though that popped into my mind was 'parallel processing' as MATLAB is built off C in which it is relatively easy to just start a new thread or two and it just works.  I was initially discouraged due to the fact that I discovered something called the "Parallel computing toolbox" which, although I didn't do too much research as to what it contained, sounded like exactly what I needed; the only problem was that it costed money. So I messed around a bit with the program tried having the code in separate functions or in for loops anything to at least lessen the drift a bit if not completely remove it. However in my research I came across a function which is in the main area of matlab called parfor. I added this to my program and I think I can see a difference...


One thing I think that I may need to do is somehow add a function called parpool which creates workers but whenever I add it in the wheels just spin in opposite directions forever so I don't really know how to fix that.

 

More posts will follow soon

 

Thanks

 

Alexander Nathanail

  • Sign in to reply

Top Comments

  • DAB
    DAB over 10 years ago +1
    I have been tempted to get into Matlab, but just do not have the time. Perhaps after you show us your experiences I may have to reassess my decision. Look forward to your posts, DAB
  • madhugovindarajan
    madhugovindarajan over 10 years ago in reply to balearicdynamics +1
    You are correct, MATLAB is not free of cost - but this cool learn to program pack is available at an affordable price along with RPi starter kit !
  • madhugovindarajan
    madhugovindarajan over 10 years ago in reply to shabaz +1
    Hi shabaz , I can definitely try to assist you with any issues. If not, we can find a resolution with the help of customer support here at e14 .
Parents
  • DAB
    DAB over 10 years ago

    I have been tempted to get into Matlab, but just do not have the time.

     

    Perhaps after you show us your experiences I may have to reassess my decision.

     

    Look forward to your posts,

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • DAB
    DAB over 10 years ago

    I have been tempted to get into Matlab, but just do not have the time.

     

    Perhaps after you show us your experiences I may have to reassess my decision.

     

    Look forward to your posts,

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube