Using a Raspberry Pi with MATLAB Online
Get started using a Raspberry Pi™ with MATLAB Online™. Set up a Raspberry Pi in the terminal app to allow MATLAB Online connections. Then you can remotely access your Raspberry Pi from anywhere that has an Internet connection after setup is complete. Discover the features for the Raspberry Pi with MATLAB Online.
Published: 23 Jul 2019
In this video, I will show you how to setup your Raspberry Pi™ to use with MATLAB Online™, so you can remotely connect to your device from anywhere. You will need a Raspberry Pi with Raspbian configured with Internet. It's recommended to change your default username and password for security before you connect to the Internet.
Open the terminal on the Raspberry Pi if you have a monitor and keyboard directly connected, or remotely access the Raspberry Pi via SSH.
Now, enter this command to update your Raspberry Pi repo:
$ sudo apt-get update
Enter this command to install the MATLAB Raspberry Pi package:
$ sudo apt-get install matlab-rpi
For the installation to complete, type “y
” and then “enter
”.
Run this command to configure MATLAB Online connections:
$ sudo matlab-rpi-setup
You can enter a display name for your device in MATLAB Online. Enable peripherals you want by typing “y
” and then “enter
”. Enter your MathWorks account username and password. If you ever want to change these settings, just use the setup command again.
Reboot your Raspberry Pi, so the configuration can take effect. Now, you can connect to your Raspberry Pi to MATLAB Online from anywhere as long as it has an Internet connection.
In MATLAB Online, enter the same MathWorks credentials to sign in.
In the command window, type the command: raspilist
. This will show you the online Raspberry Pis that you configured in the setup with your MathWorks account.
The function raspi()
creates a connection to the Pi. You can also specify which one to connect to if there are multiple Pi’s available.
Once we connect, we can see the properties and the available peripherals we can use.
If you enter the command showLEDs(),
you can see a diagram of the Raspberry Pi with the available LED. There is a similar command called showPins(),
where you can see all of the available pins in the diagram.
For more help, please refer to the documentation "Connect to Raspberry Pi in MATLAB Online".