MATLAB: How to connect to the Raspberry Pi 3 from MATLAB with the Hardware Setup app

Instrument Control Toolbox

I would like to be able to connect my Raspberry Pi to MATLAB with a wireless connection. I have a new SD card without a Raspbian image on it.

Best Answer

Please see the instructions below to set up your Raspberry Pi with a wireless connection using the MATLAB Customized Raspbian Image.
  1. Plug the SD card into your computer and reformat it so it is recognized by your computer.* Make the volume label of the formatted drive "boot"
  2. Install the MATLAB Support Package for Raspberry Pi Hardware
  3. Open MATLAB > Manage Add-ons > Hardware Setup (this is the gear icon next to the Raspberry Pi Support Package)* Select your Hardware Board* Choose "Setup hardware with MathWorks Raspbian image"* Download the MathWorks Raspbian image.* Click "Browse" and navigate to that ZIP file that was downloaded, select that file, and click "Validate"* Select "Connect to wireless network"* Select "Automatically get IP address"* Select your SD card, if it was reformatted correctly, it should appear here as a drive on your computer.* Click write to write the OS Image to the card* Once it's done writing the image, you can close the hardware setup window, we aren't going to do the device detection here.
  4. In the file explorer on you OS, open up the "boot" folder for the SD card, and add the following two files to it.* Download the attached "wpa_supplicant.conf" and replace <Name of your WiFi> and <Password for your WiFi> with your WiFi and password. Make sure they are in quotes.* Create a file named "ssh" with no file extension and leave it empty.
  5. Eject and remove the SD card from the computer.
  6. Put the SD in the Raspberry Pi and boot it up.
  7. Go back to MATLAB and try to connect to your Pi with the following command.
>> raspi("<Pi IP address>", "pi", "raspberry") % the password should still be the default, which is "raspberry". You can change this after connecting to it