Using Arduino With Matlab and Simulink

14
© 2015 The MathWorks, Inc. Using Arduino with MA TLAB and Simulink Dan Seal MathWorks Product Marketing

Transcript of Using Arduino With Matlab and Simulink

Page 1: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 1/15

Using Arduino with MATLAB and Simulink

Dan SealMathWorksProduct Marketing

Page 2: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 2/15

MathWorks Supports Low-Cost Hardware

Explosion of new hardware platformsavailable for hobbyists and students

Increasingly used by educators forproject-based learning

Hardware support packages enableprogramming these devices withMATLAB and Simulink

Page 3: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 3/15

What is Arduino?

Low-cost microcontroller bdesigned for students and m

Widely used to teach topicselectronic circuits, controlsembedded systems

Projects that can sense andinteract with the physical w

Page 4: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 4/15

Page 5: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 5/15

Page 6: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 6/15

Page 7: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 7/15

Page 8: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 8/15

Get Started: Download the Support Packages

Install through MATLAB with Support Package Installer

Three Arduino support packages available – MATLAB Support Package for Arduino Hardware – Simulink Support Package for Arduino Hardware – Simulink Support Package for Arduino Due Hardware

Let’s do it together!

Page 9: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 9/15

Demo Summary: Simple Inputs and Outputs

MATLAB Support Package makes it easy to directly control and read thedigital and analog pins on Arduino – Digital Input – Analog Input – Digital Output – PWM Output – Play Tone

Page 10: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 10/15

Demo: Light Meter

Measure light intensity withphotoresistor and track extremevalues

Control servo motor to positionneedle on gauge

Use Simulink to run the algorithmon the Arduino

Page 11: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 11/15

Demo Summary: Light Meter

1. Develop algorithm in MATLAB

2. Build Simulink model containingMATLAB Function block

3. Test and enhance model by

running in External mode

4. Deploy to hardware forstandalone execution

Page 12: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 12/15

MATLAB vs Simulink Workflows

MATLAB Support Package

Use hardware as I/O deviceLow-cost data acquisitionProcessing done on desktopMust be connected to computer

Simulink Support Package

Develop algorithm in SimuDeploy to hardwareProcessing done on hardwaCan run independent of com

Page 13: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 13/15

Beyond the Basics: Other Protocols and Capabilities

MATLAB Support Package has additional functionality for – I2C – SPI

Simulink Support Package has additional blocks for – Serial receive/transmit – Write to ThingSpeak – TCP/IP – UDP

Page 14: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 14/15

Additional Resources

More on Simulink Support Packages for Arduinohttp://www.mathworks.com/hardware- support/arduino-simulink.html

Discover other projects with Arduino, Raspberry Pi, and LEGOMINDSTORMS at the MakerZonehttp://makerzone.mathworks.com/

To explore more hardware support

http://www.mathworks.com/hardwareFor higher speed data acquisitionConnect to a wide range of professional DAQ hardware with Data Acquisition T

http://www.mathworks.com /products/daq/

Page 15: Using Arduino With Matlab and Simulink

7/26/2019 Using Arduino With Matlab and Simulink

http://slidepdf.com/reader/full/using-arduino-with-matlab-and-simulink 15/15

Summary

Get up and running quickly without learning a new programming language

Bring live results into MATLAB or Simulink

Deploy to hardware using Simulink

Talk to other devices over I2C/SPI or send your data over the Internet