Hardware support packages: Using Simulink to create Arduino projects
“Projects we have completed demonstrate what we know — future projects decide what we will learn.” — Dr. Mohsin Tiwana.
Ever wondered why MATLAB and Simulink are so widely used and are considered a must learn program for engineering students? The main reason is the fact that they can be used to design, simulate and test models for different kinds of technologies like deep learning, control design, signal processing, internet of things and many others simultaneously.
Hardware support packages are available in both MATLAB and Simulink which make it handy to use different features of these programs to program our microcontrollers easily and quickly. There are different hardware support packages for Simulink like Arduino Hardware, STM32, ARM Cortex, Raspberry pi, and many others. In this blog we will look into Simulink support package for Arduino.
Installing Hardware support packages : Step-by-step procedure to get started
I am assuming that everyone has MATLAB installed in their laptop or PC. If not you can watch this tutorial to install it.
1. Open MATLAB on your computer.
2. Click on Apps and then click ‘Get More Apps’.
3. A new tab will pop-up names Add-on Explorer.
4. In the search bar type ‘Simulink support package for Arduino Hardware’ and press enter.
5. Now, just press install button. If you have already installed you will see a green mark on your package icon.
6. Once, installed your computer will restart MATLAB.
That’s it ! It is as simple as that to install hardware support packages in MATLAB. You can do the same for any other package for Simulink and MATLAB.
How to use the package?
Once you have installed your package you can see your package mentioned in library browser. You can try using all the peripherals inside the toolbox. You can simply drag and drop them and create interesting projects. You can also double tap on Simulink window and type to get a particular block you are familiar with.
There are mainly four types of components in your package namely, common, ethernet shield, utilities, and Wi-Fi. You may also find some other components if you have installed any other package as well that supports Arduino.
How to configure your Arduino and Simulink?
First thing you need to do before proceeding is to configure your board to Simulink.
For that go to ‘model setting’ under ‘modelling’. Search for ‘hardware implementations’. Now you can choose the board you are going to use. Once you select the board you will see a drop down button ‘Target hardware resources’. Drop down and check for Simulink IO. If you find is click on it and check ‘Enable Simulink IO’.
Refer the following tutorial to learn more about the package and create projects of your own.
Simulink IO on Arduino Video
Use Simulink and hardware IO for a live connection to Arduino during Normal mode simulation.in.mathworks.com
If you found this interesting, you should also check out hardware support package for MATLAB.
MATLAB vs Simulink:
Simulink is a graphical programming environment that allows you to create and simulate dynamic systems using blocks and connections. On the other hand, MATLAB is a numerical computing language that enables you to perform calculations, analysis, and scripting. Both of them have their own advantages and disadvantages depending upon goals and preferences.
Simplicity and Intuitiveness:
Once of the main advantages of Simulink over MATLAB is its simplicity. We do not require to remember syntax and commands to use Simulink unlike MATLAB. We can simply drag and drop blocks and connect them with wires. It is also less error prone.
Flexibility and Control:
MATLAB is more flexible than Simulink. Simulink is limited by the predefined functionalities and options. On the other hand, MATLAB can be used to write any custom function or script that you want, and use variables, loops, conditional statements, and other programming features. You can also integrate MATLAB with other languages and tools such as, C, Java, or Excel.
Speed and Efficiency:
Simulink blocks are generally faster and more efficient for task such as prototyping, testing, and debugging. You can also use Simulink Coder to generate C and C++ code from your Simulink model to deploy to embedded systems or hardware platforms. On the other hand, MATLAB is faster and more efficient for the tasks such as data processing, analysis, and visualization. We can generate C and C++ code from our MATLAB functions too using MATLAB coder.
Applications of Simulink:
There are many industrial applications of Simulink and is used by many experts to design and test different equipments and products. Automobile industries, research and development, building automations are some of the main areas where Simulink is used commonly. There are different block sets, applications and toolboxes that can help you get advanced in different fields.
- Control System Design
- DSP System Design
- Test and Measurement
- Communication and Aerospace System
- Vehicle dynamics simulation
Conclusion:
In conclusion, Simulink is a vital tool in engineering and science. Its user-friendly interface and powerful simulation capabilities enable modeling, analyzing complex systems, and improving product accuracy and reliability. Simulink accelerates development, fosters innovation, and plays a crucial role in various fields, making it indispensable for addressing the challenges of our advancing world.