Today's Pick comes to us from guest blogger Greg Wolff.
Did you know that you can quickly implement your design ideas that you simulated in Simulink on a microprocessor? The Arduino Target provides a push-button solution to execute your Simulink algorithm on the Arduino development boards.
I use Arduino hardware and this File Exchange entry to demonstrate C-code generation from Simulink models to many of our customers.
While Doug Eastman wrote and posted the original version, the actual file download is now hosted from our academic section of the MathWorks website.
Special Announcement: MathWorks Virtual Career Fair
The MathWorks Virtual Career Fair is on Thursday November 11th. This event provides you the opportunity to talk directly with Engineers and Hiring Managers at MathWorks.
ContentsArduino is an inexpensive, practical, simple hardware development package that includes an Atmel microprocessor. It is often considered a hobbyist's development board, but professionals also use this board to prototype new system hardware designs.
The Arduino Target has a couple key features that I really like for quickly testing my design ideas in hardware:
Push-Button Approach to Implementation
The Arduino Target structures the generated C-code so that it can be compiled and used on the Arduino development boards. In addition it automates the process of: generating the C-code, associating the necessary source and header files, compiling the C-code to object code, downloading the object code to the processor.
Interact With Sensors and Actuators with Peripheral Drivers
The Arduino Target provides a few peripheral driver blocks for Simulink that that allow you to specify how the algorithm executing on the processor will interact with sensors and actuators. For example it provides a block for the analog-to-digital converters, and blocks for digital input/output pins.
Start-up Guide in Documentation
When you download the Arduino Target it provides documentation on where to obtain the compiler, how to install the Arduino Target, as well as making the target peripheral blocks available in the Simulink Library Browser.
If you have never generated code before from a Simulink model for a real-time application, there are a few key things to keep in mind:
Use a Fixed-Step Solver
I usually recommend the Discrete version of the fixed-step solver. However if you choose this option, you cannot use Continuous Time blocks in your Simulink model, but you can use Discrete Time blocks.
Set the System Target File to Arduino
Remember Processor Resources are Limited
Compared to using your desktop or laptop computer, these microprocessors do not have the same extensive computing power or memory storage capabilities. Embedded software design is a constant balance of desired features against limited processor resources, so you may need to make algorithm design changes in order to properly execute on the Arduino hardware.
If you would like to leave any comments regarding this post, please click here.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.