Purdue School of Engineering and Technology, IUPUI Electrical Engineering Technology, ECET307 Bonus Lab, Implementing Matlab to Arduino Dev Board

Similar documents
Work with Arduino Hardware

Arduino Lab 1 - The Voltage Divider

Set up and Blink - Simulink with Arduino

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

CHAPTER 11: Flip Flops

Setting up a Local Interconnect Network (LIN) using dspace MicroAutoBox 1401/1501 Simulink Blocks

How to program a Zumo Robot with Simulink

INTRODUCTION TO SERIAL ARM

Experiment 8 : Pulse Width Modulation

Arduino Lesson 1. Blink

Arduino Due Back. Warning: Unlike other Arduino boards, the Arduino Due board runs at 3.3V. The maximum. Overview

IR Communication a learn.sparkfun.com tutorial

User s Manual of Board Microcontroller ET-MEGA2560-ADK ET-MEGA2560-ADK

Arduino Lesson 14. Servo Motors

PHYS 2P32 Project: MIDI for Arduino/ 8 Note Keyboard

Board also Supports MicroBridge

Arduino DUE + DAC MCP4922 (SPI)

Arduino ADK Back. For information on using the board with the Android OS, see Google's ADK documentation.

Speedlink software will run on Windows NT, Windows 7, and Windows 8; it will run on both 32 byte and 64 byte versions of Windows.

Upgrading from Windows XP to Windows 7

Example Connection between USB Host and Android

Your Multimeter. The Arduino Uno 10/1/2012. Using Your Arduino, Breadboard and Multimeter. EAS 199A Fall Work in teams of two!

Arduino Lesson 13. DC Motors. Created by Simon Monk

ARDUINO SEVERINO SERIAL SINGLE SIDED VERSION 3 S3v3 (REVISION 2) USER MANUAL

Using Arduino Microcontrollers to Sense DC Motor Speed and Position

Designing VM2 Application Boards

Electronic WorkBench tutorial

Six-servo Robot Arm. DAGU Hi-Tech Electronic Co., LTD Six-servo Robot Arm

Using the Communication Ports on the DG-700 and DG-500 Digital Pressure Gauges

E-Blocks Easy Internet Bundle

Upgrading from Windows XP to Windows 7

CAN-Bus Shield Hookup Guide

The Answer to the 14 Most Frequently Asked Modbus Questions

PRODUCTIVITY THROUGH INNOVATION 600 CONTROL DIRECT DRIVE TECHNICAL/OPERATION MANUAL

Electronics 5: Arduino, PWM, Mosfetts and Motors

EARTH PEOPLE TECHNOLOGY SERIAL GRAPH TOOL FOR THE ARDUINO UNO USER MANUAL

RPLIDAR. Low Cost 360 degree 2D Laser Scanner (LIDAR) System Development Kit User Manual Rev.1

Building a Basic Communication Network using XBee DigiMesh. Keywords: XBee, Networking, Zigbee, Digimesh, Mesh, Python, Smart Home

AVR Butterfly Training. Atmel Norway, AVR Applications Group

Instructions for Installing and Using the FOCUS DL-15 Data Transfer Software

Warnings: This manual is intended to guide a technicians or customers who would like to repair DBL's

MS830 / MS833 Barcode Reader v1.0 9-December-2014

Adafruit SHT31-D Temperature & Humidity Sensor Breakout

STIM202 Evaluation Kit

Using Xbee in Serial Communication

Lab 6 Introduction to Serial and Wireless Communication

Serial Communications

Ethernet Radio Configuration Guide

CPSC 226 Lab Nine Fall 2015

Iowa State University Electrical and Computer Engineering. E E 452. Electric Machines and Power Electronic Drives. Laboratory #3 Figures of Merit

Business Plus Accounting Hardware Setup Guide For Windows XP

DATASHEET. ADAM Arduino Display Adaptor Module. Arduino Compatible Shield P/N: 4Display-Shield-FT843 For the 4D Systems 4DLCD-FT843 Display

Lab 11 Digital Dice. Figure Digital Dice Circuit on NI ELVIS II Workstation

A REST API for Arduino & the CC3000 WiFi Chip

Basic Pulse Width Modulation

Massachusetts Institute of Technology

Intro to Intel Galileo - IoT Apps GERARDO CARMONA

isppac-powr1220at8 I 2 C Hardware Verification Utility User s Guide

SMS Alarm Messenger. Setup Software Guide. SMSPro_Setup. Revision [Version 2.2]

RIGtalk. Revision 5. Owner s Manual 2012.

Quick Start Guide for High Voltage Solar Inverter DC-AC Board EVM. Version 1.3

ScanWin Installation and Windows 7-64 bit operating system

EasyC. Programming Tips

Transferring Scans from your Dolphin into Destiny

For support on the Beijer HMI please contact:

2013 G Miller. 3 Axis Brushless Gimbal Controller Manual

User s Manual. Powerline 200M Ethernet Bridge

Welcome to the tutorial for the MPLAB Starter Kit for dspic DSCs

P&E Microcomputer Systems, Inc. P.O. Box 2044, Woburn, MA 01888, USA

PC-EFTPOS / BWA Merchant Services. Installation Guide. (Verifone Vx810)

Introduction to Arduino

RS485 Adapters. User Manual October 26, 2008 V1.02 Copyright Light O Rama, Inc. 2006, 2007, 2008 SC485 USB485B USB485 USB485-ISO

cs281: Introduction to Computer Systems Lab08 Interrupt Handling and Stepper Motor Controller

Lab 3: Introduction to Data Acquisition Cards

Incident Commander Pro Radio-Based Automatic Tracking System

Practice Fusion API Client Installation Guide for Windows

Allen Bradley PLC connection procedure (RSLogix 500 Version 3.1.9, RSLinx Version 2.1)

FOLGER TECHNOLOGIES, LLC 2020 i3 3D Printer Kit

Arduino Motor Shield (L298) Manual

BIODEX ADDENDUM BIODEX EMG/ANALOG SIGNAL ACCESS CONFIGURATION UTILITY SOFTWARE FOR SYSTEM 3 REVISION 2 AND SYSTEM 4 DYNAMOMETERS

TOSR0X-D. USB/Wireless Timer Relay Module. User Manual. Tinysine 2013 Version 1.0

Arduino Lesson 16. Stepper Motors

The GV-I/O Box 8 Ports provides 8 inputs and 8 relay outputs, and supports both DC and AC output voltages.

Network/Floating License Installation Instructions

Windows 8 Backup, Restore & Recovery By John Allen

TCP/IP MODULE CA-ETHR-A INSTALLATION MANUAL

Config software for D2 systems USER S MANUAL

See Horenstein 4.3 and 4.4

Lab Experiment 1: The LPC 2148 Education Board

FreeAgent DockStar Network Adapter User Guide

DMX USB PRO. User Manual.

ECEN 1400, Introduction to Analog and Digital Electronics

Pololu DRV8835 Dual Motor Driver Shield for Arduino

In-System Programmer USER MANUAL RN-ISP-UM RN-WIFLYCR-UM

DAC Digital To Analog Converter

Using an Oscilloscope

Installing the USB driver for Firmware 7 or later For use with E-blocks programmer boards and PICmicro Development boards.

MANUAL FOR RX700 LR and NR

Radio Interface Setup

Yun Shield User Manual VERSION: 1.0. Yun Shield User Manual 1 / 22.

Transcription:

ECET 307, Bonus Lab Purdue School of Engineering and Technology, IUPUI Electrical Engineering Technology, ECET307 Bonus Lab, Implementing Matlab to Arduino Dev Board Objective: Learn how to compile and run Simulink Models on an Arduino Board. Requirements: Other Recources: Arduino Uno, Due, Mega, Mega ADK, Leonardo, Micro, Mini, Nano 3.1, Pro, & Fio Drivers for Arduino Boards (Provided). Admin rights to install drivers on School computer(craig Stevens) Four wires. LED and 330Ω OR 220Ω resistor Matlab Arduino support files. Visual C++ Professional(should be on computer already) Prelab: Step 1: See a tutorial Video on the following Link for a basic application: (You will be directed to a different example in this assignment). http://sti.tice.ac-orleanstours.fr/spip2/img/pdf/working_with_arduino_hardware.pdf https://learn.adafruit.com/how-to-use-matlab-and-simulink-witharduino/overview http://www.mathworks.com/help/supportpkg/arduino/examples.html http://www.mathworks.com/videos/programming-arduino-uno-with-simulink- 86316.html Step1: To be able to download your Simulink code into the Arduino board, you must get the required drivers installed on the Windows machine. Please see Craig Stevens, he has the authority to do this. Have the drivers ready; download them to your machine from the lab folder. When he does this and is in Device Manager, take note of what COM port your Arduino is assigned to. It will likely be a small number, 3 or 4. Step2: Download the Hardware add-ons for the Arduino board from within the Matlab window.

Select Install from Internet And hit Next. Yours should say Install not reinstall like shown here. Select all packages. It will proceed to download and install.

Trouble Shooting At This Point: A couple of things can prevent you from continuing or installing the packages properly. Matlab can hold onto Arduino packages and not remember(the pointer file is locked.) If someone has used Arduino with Matlab on the system you are working on, simply delete the Arduino folders from Matlab and reinstall them. C:\MATLAB\SupportPackages\...

Another problem you can encounter, although less likely on IUPUI s systems is not having a recognized C compiler. From the Matlab Command Window, you can test to see if it is configured properly. Type mex setup. From the Command Window, with the Arduino Uno plugged in, you can test to see if the communication is working. Type a = Arduino( com ). In this case, the Arduino was registered to com14. Step3: Prepare your Arduino board to talk to Simulink. If you followed the previous step and communicated with the board from the Command Window. Unplug your USB cable to disengage the connection and then re-plug it back in. In the Simulink window, navigate to Tools/Run on Target Hardware/Prepare to Run /. Select your board and hit OK. We ll assume UNO in this case but any of the listed boards would work fine. Keep in mind that different boards have different PWM, I 2 C, SPI and etc. pinouts.

You can either select automatic or manual port configuration. Stick with automatic unless it gives you trouble. Then look in the Windows Device Manager for the COM port that the Arduino is assigned to.

Step4: Test out with Simulink. If your installation of the package worked, the Simulink Library Browser should now contain blocks for the Arduino. Create the schematic shown below to quickly test. If it compiles and downloads you ll see Rx & Tx on your board flashing and Matlab won t have errors. You can double click on the pulse generator to get different pulse rates if you wish. The default setting is around 1Hertz. Use two wires to connect ground and the output from the board, PIN9, to an oscilloscope or your LED. You should see your square wave or pulses of LED. Exercise 1: Find the transfer function of the following circuit with values R=3.14, L=1mH. Vin Vout V out V in = R L s+ R L Exercise 2: Create the Simulink Model shown below. Take note that we need to use the Data Type Conversion blocks to change the input and output types of the Transfer Function block; this can be found in the Logic and Bit Operations Tab. Also used is the Compare to Constant block; found in the Math Operations tab. The Digital Output of the Ardiuno is of type Boolean but the output type of the transfer function is double, it needs to be converted. The same is true of Digital Inputs. Analog Input will produce a type of INT with a value from 0-1023 on the UNO board. We use the compare block to know when the signal is high. For this exercise, multiply the R/L value by two. Try and think about why this is necessary.

Exercise 3: Build the Circuit. We are using a DC offset and a square wave to help protect the AtMega328 pins. DO NOT PUT MORE THAN 5V INTO THE ARDUINO! The goal is to catch each high portion of the square wave. The ATD produces a numeric value based off of 5V. We are only using 4V for safety. That makes our numeric range 0-818. Each step size is of the ATD.00489V. We want to send a 1 into the Matlab transfer function every time the wave is high. Comparing to a constant of 300(this is a little arbitrary, 409 would be the zero crossing @ 2V). @ a compare to constant value of 300, any voltage over 1.46V will give us a 1 or True. DO NOT CONNECT THE FUNCTION GENERATOR YET. Exercise 4: In Simulink, before the model is compiled and run, the sample times must be the same. It s also worth checking the sampling rate of the Arduino ATD.

This will be a limiting factor for us. Set MATLAB s to.0001 sampling time. You will need to do this on the Analog Input block and the Configuration Parameters. Change it config parameters to a fixed-step. If these values are not the same, Simulink will tell you.

Exercise 5: Compile the model and run on the Arduino. Start with a low frequency around 1Hertz and work your way up to the assumed cutoff point of 50 HERTZ. Where did the signal actually stop getting through? Why do you think this is? What happens at very High frequencies; try 2.5K, 5K, 10K, 20K, 50K? What do you think is happening (Think Nyquist). Conlusion: Write a conclusion about what you learned, What you liked, didn t like and places that caused confusion? Are you likely to use Matlab with the Arduino again? How many bytes was the Sketch file that downloaded to the board? Why did we need to multiply the target cutoff frequency by 2?