element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
Arduino
  • Products
  • More
Arduino
Arduino Forum Importing data from MCU to MATlab
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 3 replies
  • Subscribers 391 subscribers
  • Views 602 views
  • Users 0 members are here
  • gizduino
  • fire
  • matlab
  • mcu
  • arduino
Related

Importing data from MCU to MATlab

Former Member
Former Member over 9 years ago

Hi! We have this project for our senior's research regarding the optimization of multiple sensors which incorporates DS Theory. I would like to know if any of you knows how to import data from a microcontroller into MATlab program?:-D

  • Sign in to reply
  • Cancel
Parents
  • Former Member
    Former Member over 9 years ago

    MATLAB has a direct interface for the most commonly used boards (Uno, Mega, Due, Leonardo) at Arduino Support from MATLAB - Hardware Support

     

    This is much easier than trying to do your own bit-banging.  The interface  is just an ordinary USB cable from the PC to port on the Arduino.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Former Member
    Former Member over 9 years ago

    MATLAB has a direct interface for the most commonly used boards (Uno, Mega, Due, Leonardo) at Arduino Support from MATLAB - Hardware Support

     

    This is much easier than trying to do your own bit-banging.  The interface  is just an ordinary USB cable from the PC to port on the Arduino.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • Former Member
    Former Member over 9 years ago in reply to Former Member

    There is a MATLAB package that you use to abstract the serial connection to both transmit instructions to, and receive data from the Arduino.  The link I included in my post gives you "how-to" videos, code examples, and a documentation package.  Only caveat is you need to have MATLAB R2014a or higher.  There is more than one way to do it, but; for instance say I wanted to connect to an Arduino Uno on the USB port COM4, and use a TMP102 I2C temp sensor.

     

    1.     Start the connection:  a = arduino ( 'com4', 'uno', 'Libraries', 'I2C')

    2.     Scan the I2C bus: addrs = scanI2CBus(a)

    3.     We'll say the only I2C address this returns is 0x298

    4.     You create the I2C object: tmp102 = i2cdev(a, '0x298')

    5.     And write the code to retrieve the Celsius temp using I2C:

                   write(tmp102, 0, 'uint8');

                     data = read(tmp102, 2, 'uint8');

                    temperature = (double(bitshift(int16(data(1)), 4)) + double(bitshift(int16(data(2)), -4))) * 0.0625

     

     

    This is a screenshot of a demo on the MathWorks website using MATLAB R2015a.  They've tried to make the API's close to Arduino syntax.

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
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