RoadTest: Raspberry Pi 3 & MathWorks Learn-to-Program Pack
Author: MARK2011
Creation date:
Evaluation Type: Workshop Tools
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?: null
What were the biggest problems encountered?: Problem of incompatibility of the OS when installing MATHWORKS-RPi add-ons environment "Support Package for Raspberry Pi Hardware". Lack of program block for RPi 1-wire interface in "Support Package for Raspberry Pi Hardware". Minor issue with RPi window resolution when working remotely using VNC. And...the extremely huge range of MATHWORKS application possibilities - hard to choose most important issues to test... apologies it was a joke!
Detailed Review:
When I received the e-mail approving me as the Raspberry Pi 3 & MathWorks tester, I felt the happiness and also sense of responsibility.
The subject is extremely deep and wide.
Both Raspberry board (and all relating stuff) as well as MATLAB/ SIMULINK environment are widely well known for years (despite the RPI is significantly younger, whatever!)
I admit, I know the raspberry from, let say, its early ages, I use it for around two years, nevertheless It's really hard to add something new as most of fields of RPi application, have been implemented, above concerns also the use of RPi together with MATHWORKS. On the other hand, there is still something new added and developed in the RPI realm.
MATLAB and obviously Simulink is another issue for me. I've been used different math supporting environments from my studying time (who remember "Derive" system for DOS?) . In one's time I enthustiately worked with MATHCAD but nowadays I prefer R (Cran system).
I know there are no comparison with SIMULINK in the matter of complex modeling, simulation and analysis. The scope of implementation is shocking and extremely huge.
With limited writer's abilities I will focus on simple explanation of my steps in this roadtest, I hope pictures and several videos would make my report more colorful and accessible.
Basic technical specifications
Honestly, I think that this part can be omitted as there are lot of information about both RPi and MATHWORKS.
Moreover Raspberry is, in my opinion, one of the "flagship" devices of Element 14, detaily depicted and still commented in the forum.
Ok, lets put here most common information from raspberrypi.org https://www.raspberrypi.org/products/raspberry-pi-3-model-b/
The Raspberry Pi 3 is the third-generation Raspberry Pi. It replaced the Raspberry Pi 2 Model B in February 2016.
All details related to the could be found here
https://www.mathworks.com/products/matlab.html
The system consist of two main elements MATLAB and SIMULINK creating amazing tool for all project concerning mathematical modeling, analyses, simulations. From simple calculations, using very simple intuitive script language to complex problem solving with enhanced but still easy to operate graphic environment (GUI). According to the definition, MATLAB is a high-level language and interactive environment that solves numerical problems quickly.
Some basic words from MATHWORKS commercial site:
System can be used to capture and analyze sensor data by communicating with Raspberry platform (as well as i.e. Arduino).
It allow to take Simulink - block diagram environment for simulation and Model-Based Design. We can model, simulate and analyze the project then program the hardware using graphical block diagrams.
According to the advertisement it " Models for Every Project".
Can I repeat - from my previous test?...
"There is nothing better than opening the package with brand new, sophisticated electronic device (for me at least…)"
Our sweet raspberry came safely and well packed in the pleasant, colorful box.
One can complain, the box was oversized, but as I think the safety of the content is most important.
You can find basic instructions before opening the box
The set consist of
The set of the AC supply adapters provides the compatibility with the every Energy System.
The MATLAB and Simulink Student Suite:
The student suite includes MATLAB, Simulink and 10 add-on products with Hardware Support Packages for Arduino, Raspberry Pi and more.
The 10 add-on products include toolboxes for control systems, data acquisition and instrument control, DSP system design, image processing, optimization, signal processing, statistics and machine learning, and symbolic math.
Well I didn't find many special documents inside. Some safety issues - regarding to requirements and regulations. For me It's correct. All necessary information you can find on the net... before the parcel arrived, so you can be well prepared to use the brick when you open the box.
Raspberry launch
It's simple and pleasant, nevertheless system downloading is time consuming depending on the net connection quality.
The simplest solution is to take the NOOBS system installation option, ready to use, delivered on the SD Card.
"Out Of the Box Software" NOOBS is user friendly and intuitive indeed!
NOOBS is an easy operating system installer which contains Raspbian. It also provides a selection of alternative operating systems which are then downloaded from the internet and installed.
On the other hand you can prepare the SD card individually, using SD card image burner (I tried Etcher) It's more convenient if there is the problem with fast enough internet access etc.
For me, the good habit using RPi is starting the job with update/ upgrade commands:
sudo apt-get update
sudo apt-get dist-upgrade
I try to keep the system fresh!
It looks like here:
Another worth to remember and repeat systematically thing is SD card backup policy.
The process time depends on the quality of the used storage media.
At this place I must admit, that the bundle most attractive part for me is MATWORKS suite.
At the beginning of the roadtest I was afraid, that I'm able to test only small part of this amazing environment.
Ending the report, making final corrections, I'm still sure, I know, that there are huge capabilities of this suite. I hope I will continue exploration of the matlab, sharing my discoveries and thoughts on the element14 platform.
what's going on?...
You can extend the basic suite:
Several minor problems was easy to manage:
Is it quick?
Everything is relative, it depends on the connection quality ... and your patience...
I want to admit, at this point, that you don't need to worry about interrupts or lose of internet connection during installation,
Despite of my fear, after the unsupposed break, installation continued from the last point, not the beginning!
My patience was rewarded
Voila:
In the purpose to enjoy best graphic capabilities, you should switch on Open GL in your system!
30 days of unlimited access to all MATHWORKS functionalities past quick. When the message about TRIAL period turn to 0:
I switched (associate) to my licenced package.
The process is quick and carefree!
I had the issue with licence files in C:\Program Files\MATLAB\R2017b\licenses. I had to delete the "licence" connected to the trial and everything work well!
TRIAL | MATLAB and Simulink Student Suite |
Trial Package | Student - Individual |
MATLAB | MATLAB |
Simulink | Simulink |
Communications System Toolbox | ------------------------------ |
Control System Toolbox | Control System Toolbox |
DSP System Toolbox | DSP System Toolbox |
Data Acquisition Toolbox | Data Acquisition Toolbox |
Image Processing Toolbox | |
Instrument Control Toolbox | Instrument Control Toolbox |
Optimization Toolbox | |
Signal Processing Toolbox | Signal Processing Toolbox |
Simulink Control Design | Simulink Control Design |
Stateflow | ----------------------------------- |
System Identification Toolbox | --------------------------------- |
Statistics and Machine Learning Toolbox | |
Symbolic Math Toolbox |
Following, you can find some my complains regarding lose the System Identification Toolbox
More challenging issue related to environment installation is installation of MATLAB and SIMULINK Support Package for Raspberry Pi Hardware
I forgot of SSH enabling - the results below:
Having the whole system prepared I enthusiastically wanted to test how it work together.
The simplest way to check the functionality of MATWORKS packages designed for Raspberry Pi is, according to the documentation execute of raspi command:
Unfortunately I encountered serious problem with building the MATLAB I/O system on RPi
I was trying this:
...but still unsuccesfully...
Well, I lose several days looking for the answer.
The solution was easy and came from another Roadtester - THANK YOU AGAIN!
Just replacement of the two files and several commands, the system is working!
Now, using simple code I checked if I can operate RPi using MATLAB
On the following video I present the use of basic raspi function application.
The Matlab lets me control of the LED 0 on the RPi.
In the SIMULINK, there are intuitive solutions to communicate and control the RPi unit.
Using command blocks from libraries I could build any project.
I started with the simplest one, described here:
"Getting Started with Simulink Support Package for Raspberry Pi Hardware"
Details are presented on the following video
To be honest, the project is not main but very popular, used as the first example of temperature measurement and application of 1-wire protocol in Raspberry.
The sensor is well known Dallas 18B20.
Using the simple breadboard layout I found in the net: "Raspberry Pi: Measure, Record, Explore."
The humble temperature measuring plant looks like here:
After initialization of the 1wire port, the temperature can be read using one command:
In the video below, you can see the results:
Here I want to complain a little. Maybe I looked for it in the libraries inattentively, but I didn't find 1wire library for RPi in the Simulink.
There are lot of materials and examples for arduino but regarding RPi I found nothing.
Honestly mentioned previously problem with raspi and lack of simple access from Simulink to 1wire in RPi spoiled my plan and the most important test failed.
Having RPi set as temperature logger, with the set of temperature readouts, I wanted to check possibilities of MATLAB in simple data import and visualization.
Following images show my steps in this example:
In the following video, you can see, how I imported and presented the data - temperature readouts
Usage of most examples is simple as you need only write one command in the MATHCAD to initiate the demo.
My first example - exercise of use of the Simulink, taken from the huge examples library on Mathworks site was
Simulation of a Bouncing Ball
The principle is elementary as follow:
And the model also relatively simple:
Without any problems I reach following results:
changes of position and speed of the ball are easily presented on the chart:
The next example was more complex. It was interested for me, as the subject is very close to my projects related to energy efficiency in HVAC installations.
Here we have:
According to the description, This example shows how to use Simulink to create the thermal model of a house.
This system models the outdoor environment, the thermal characteristics of the house, and the house heating system.
The most interesting issue is possibility to present supposed energy consumption and its cost.
The next, even more interested example, I tried to see and test:
The model is a house heating system that includes a heater (plant), thermostat (controller), and room (environment).
https://www.mathworks.com/help/simulink/examples/thermal-model-of-a-house.html
doesn't work unfortunately!
Execution of Ssc_house_heating_system gives the error in my case.
Automation is my realm and probably most vintage automation engineer (or at least me) is keen on PID regulation principles.
Therefore I decided to test some
I found very interesting examples of use simulink for modeling and control
The Control Tutorials for MATLAB and Simulink (CTMS) is located here:
http://ctms.engin.umich.edu/CTMS/index.php?example=Introduction§ion=SystemModeling
Examples are simple but I quickly learned how to use SIMULINK building automation process models.
Mass-Spring-Damper System
The free-body diagram for this system is shown below. The spring force is proportional to the displacement of the mass,
and the viscous damping force is proportional to the velocity of the mass,
Both forces oppose the motion of the mass and are, therefore, shown in the negative -direction. Note also that
corresponds to the position of the mass when the spring is unstretched.
Below, you can see results of my tests:
Above chart shows behaviour of the body when the external force as well as spring force acts.
The modeling of proportional controller seems to be perfect.
PID
My attempts to model and tune the PID regulator are shown below
Thanks to the CTMS, I found the automatic PID tuning functionality of Simulink
It works great as you can see
I attached the video from my tests of the PID experiments in yhe Simulink
Trying to retrieve some coding ideas from my youth
I looked to the project examples archive looking for runde-kutta solutions for 4thorder
As I remember form my student time nice implementation of these are the pendulum modeling issues.
I found quite nice:
It was working fine on the TRIAL version - where all packages were available.
Unfortunately after switch into licenced, student version, the example can’t be used.
To use 'iddata', the following product must be licensed, installed, and enabled: System Identification Toolbox
Lack of the licence for System Identification Toolbox is the problem here.
Never mind, another pendulum model:
works fine with the Student Edition
You can watch it on the following video:
I must praise that very useful solution is online matlab version.
It's perfect solution which made me free, independent from the access to my computer.
Cloud based solutions are popular and Mathworks used it perfectly.
example below:
Probably it's very old and frequently repeated notice but I will still glorify the simplicity of use of remote control of RPi using VNC.
It helps very much if the brick is located in "strange" place or it is used in extraordinary project.
My tests were conducted having RPi on laptop's screen.
The only issue is resolution. If RPi starts without the monitor, the default settings make the screen difficult to tune-up as well as minimum resolution is... big too much.
Sometimes RPi windows oversize main window, which make troubles.
- is the perfect tool to upload data e.g. from RPi sensors. The engine belongs to Mathworks, which make it perfectly compatible with our subject.
According to the definition, Thingspeak is an IoT platform that enables collecting, store, analyze, visualize,
and act on data from sensors or actuators from devices as Raspberry, Arduino etc.
Unfortunately, I neglected Thingspeak capabilities during my roadtest
but this part will be continued in my following projects with RPi & Simulink.
The first Raspberry Pi - 1 Model B was released in February 2012, Model A was simpler and cheaper.
Raspberry Pi 1 Model B+ was released In 2014,
Raspberry Pi 2 which extended RAM was released in February 2015, It could be up to 14 times faster than a Raspberry Pi 1 Model B+
Raspberry Pi 3 Model B was released in February 2016 is told to be 10 times the performance of a Raspberry Pi 1
simple comparison is presented in the following table
My experiments and tests show, how powerful and interesting is the set: Matlab+Simulink & Raspberry Pi.
This roadtest is only the beginning of my adventure with that amazing program suite and charming device.
I feel, that probably I've lost too much time experimenting with MATLAB and Rpi separately, adding unsupposed problem with the integration,
I didn't have enough time to finish my test related to temperature control using Rpi as PID controller, all governed using Simulink.
This task will be conducted and I hope to report the results on this forum soon.
I must confirm, that according to the advertisement, Mathwork products capabilities fulfill advanced requirements for analyzing data, developing algorithms or creating models.
It is intuitive, supported by excellent help as well as worldwide Matlab/ Simulink environment enthusiasts associated on many forums.
RPi is also very convenient, thanks to its versatility. Same as above, myriads of forums, examples and advices will not allow you to feel lost when encounter hardware or software issue.
Incompatibility of system version, when installing MATLAB and SIMULINK Support Package for Raspberry Pi Hardware,
resulting errors when building the MATLAB I/O server on RPi,
resolution problem when using RPi remotely with VNC,
lack of 1wire library for RPi in the Simulink.
Talking about Matlab, i admit, the price is, let say, delicate and relative issue. I don't know the pricing policy in different countries but I'm afraid for many students, or even universities,the suite is unavailable because of the costs. I hope I'm wrong.
MathWorks papers The MathWorks, Inc. www.mathworks.com
Raspberry papers, manuals Raspberry Pi www.raspberrypi.org
CTMS tutorials Control Tutorials for MATLAB and Simulink (CTMS) ctms.engin.umich.edu/CTMS
Thank you again for selecting me as the roadtester and give me the opportunity to deal with these extraordinary and amazing tools.
Marek
Top Comments
Very good road test report.
DAB
OK The final version is published now!
I'm awaiting your comments and notices
The final review is very good.
I agree with your concerns on the price, though you also have to look at versatility of the Simulink feature.
You can get less expensive tools for the basic functions, but…