Setting up Raspberry Pi from Matlab – Part 2

Why Matlab?

Take a look at setting up Raspberry Pi from Matlab. In our Part 1 of the this tutorial we have seen the steps involved in preparing the SD card for the RaspberryPi. Sometimes, using the default OS(Raspbian) is a good choice to start or beyond. The NOOBS software itself is quite easy to do the task yet, there is another way you can try out – still keeping it simple and tidy. Since the release of Matlab ver 8, Mathworks pursuing there way too close to hardware support from Matlab through the Supplemental Software. Preparing your SD card using Matlab will enable you to easily complete the task as well as it enables you to use Matlab to test and control the RaspberryPi . Whether you want to complete your project entirely in Matlab or part of it, this way is too easy to get started with RaspberryPi . Another thing is, Matlab pre-installs certain libraries and tools that can be pretty useful.

Installing RaspberryPi Hardware Support Package in Matlab

To start, type

in Matlab Command prompt and follow the wizard to complete Hardware Support Package for RaspberryPi.

Preparing SD Card for Raspbian Weezy Linux OS from within Matlab

Continue with Matlab Hardware Support Package wizard to complete the Raspbian installation in a SD Card (Minimum 4GB recommended) connected to your PC running Matlab. To install the Hardware Support Package, one may need to register in Mathworks website which can be easily done. Class Type 4 or higher is recommended for the SD card.

Booting up for the first time.

Connect a Power Adapter having current rating of 2Amp (1Amp may be adequate sometimes) or more to handle USB WiFi dongle and the Camera board simultaneously. Connect the LAN cable and insert the SD card which were prepared using Matlab. Now, Power up your RaspberryPi and wait for few seconds to boot. Matlab creates a unique Computer name to the RaspberryPi while installation which later will be used by Matlab itself to identify the RaspberryPi in the network. If you have access to your Router then go to LAN status section, there you may find the Name of the RaspberryPi, its IP address and other details something like this shown below;

DHCPlist1

Actually, we don’t need to be looking at the Router settings because Matlab can find the RaspberryPi automatically. The Matlab Wizard you started earlier will be waiting for the RaspberryPi to boot and then detects it. If Matlab fails to discover the RaspberryPi, then put the IP address of the Pi, username and password manually when it’s been asked for.

For example:

IP Address: 192.168.2.3

Username: pi

Password: raspberry

Another way is to use the command line to connect with Pi. To do that, cancel the wizard and type in the command window,

You should get the details of the mypi object we just created if the connection was successful.

Don’t forget clear this object when you’re done with your commands. Type,

to clear the RaspberryPi object from the Workspace, otherwise you won’t be able to connect it from another Matlab program.

A good practice before doing anything is to update everything you have inside your RaspberryPi OS. Type below commands in Matlab command window.

You don’t have to put the connection details every time because, Matlab will remember the last successful settings for the RaspberryPi. The openShell command will open a PuTTY SSH Terminal session with RaspberryPi.

The Terminal

Login to the RaspberryPi with the default credentials (username: pi, password: raspberry) through the PuTTY Terminal.

Open RaspberryPi configuration utility using the command,

Select ‘Expand Filesystem’ to use the whole space in the SD card.

Next ‘Change User password’. It is always a good practice to change the default password. For simplifying this guide we shall continue with the default password for the time being.

Third, ‘Enable the Camera’ to use the Camera board functionality.

Now go to ‘Advanced Options

And, change the Hostname if you wish to. For the final step select the ‘Update’ to update this utility to the latest available.

Run the below commands to update your RaspberryPi.


Comments

digxtech

Quick Contact

* Required field

Your Name*

Your Email*

Telephone

Your Message

or

Log in with your credentials

Forgot your details?