You are on page 1of 31

A

PRESENTATION
ON:
INTERFACING OF ARDUINO WITH MATLAB/SIMULINK

PRESENTED BY:
Kartik Sharma
Department of Electrical Engineering
Rajasthan Technical University, Kota
Overview:

• What is Arduino?
• Why Arduino?
• Arduino Products
• Arduino Interfacing basics
• Arduino Interfacing Demonstration
What is Arduino??
• Arduino is an open-source prototyping platform based on
easy-to-use hardware and software.

• Arduino boards are able to read inputs - light on a sensor,


a finger on a button, or a Twitter message - and turn it
into an output - activating a motor, turning on an LED,
publishing something online.

• We can tell our board what to do by sending a set of


instructions to the microcontroller on the board. To do so
we use the Arduino programming language (based on
Wiring), and the Arduino Software (IDE), based on
Processing.
• Arduino was born at the Ivrea Interaction Design
Institute as an easy tool for fast prototyping, aimed at
students without a background in electronics and
programming.

• As soon as it reached a wider community, the


Arduino board started changing to adapt to new needs
and challenges, differentiating its offer from simple 8-
bit boards to products for I/O applications, wearable,
3D printing, and embedded environments.
Why Arduino??

• Inexpensive
• Cross-platform
• Simple, clear programming environment
• Open source and extensible software
• Open source and extensible hardware
Arduino boards:

Arduino UNO

Arduino MEGA
Arduino DUE

Arduino MINI
Arduino NANO
Understanding Arduino UNO
Interfacing Arduino with Simulink
For learning the interfacing of Arduino hardware with
Simulink we must have following tools available:

Software:
• Computer System with MATLAB R2012b or higher.
and installed with Simulink Support package for
Arduino Hardware.

Hardware:
• Any Arduino Board (UNO, MEGA..)
Open MATLAB:
Installing Support Package for Arduino
Open Simulink Library Browser:
Open Simulink Support Package for Arduino Hardware
Create a Model for Arduino Hardware
In this task, we will create a simple Simulink model that changes the state of
the Arduino digital output pin.

 In Simulink Library Browse, select New Simulink Model.

 Insert the Pulse Generator block from the Simulink Sources library to the
new model.

 Double-click the Pulse Generator block. Set the Pulse type to parameter to
Sample based and set the Sample time parameter to 0.2 second.

 Insert the Digital Output block from Simulink support package for Arduino
hardware to the model. Use the default block settings.

 Connect the Pulse Generator block to the Digital Output block.


Create a new model in Simulink
Example of a Task
Let us take a task of alternate flashing of two LED’s
with following profile :

• LEDs having 0.2 sec. time period and glows for only
40% duty cycle.

• Delay of 0.01 sec. in between glow of both LEDs.


Connect the Arduino Hardware to PC
How to Configure and Run the Model on Supported
Arduino Hardware:
 Connect the Arduino board to the computer with a USB cable.

 In the Simulink model, Click Tools > Run on Target Hardware > Prepare to Run.

 Select the Hardware Implementation pane and select the required Arduino hardware
from the Hardware board parameter list. Do not change any other settings.

 Click OK.

 In the Simulink model, click the Deploy to Hardware button on the toolbar. The
model will now be deployed to the connected Arduino hardware.

 Look at the LEDs attached to pin 9 and pin 10. The LED should blink one time
every second.

 Save your model.


Prepare to Run the model
Changing the Configuration Parameters to select hardware
Run the model on hardware

You might also like