Documentation

Getting Started with Samsung® GALAXY® Android® Devices

This example shows you how to use Simulink Support Package for Samsung GALAXY Android Devices to run a Simulink® model on a Samsung GALAXY Android device.

Introduction

Simulink Support Package for Samsung GALAXY Android Devices enables you to create and run Simulink models on Samsung GALAXY Android devices. The support package includes a library of Simulink blocks for using Samsung GALAXY device sensors and network interfaces.

In this example you will learn how to create and run a simple Simulink model on a Samsung GALAXY Android device.

When you have completed this example, try these other examples:

  • Communicating with Samsung GALAXY Android Devices: Use External mode to monitor and fine-tune an application using real sensor data on the Android device.

  • Working with Samsung GALAXY Android Devices: How to use Simulink blocks from Samsung GALAXY Android Devices block library.

Prerequisites

If you are new to Simulink, we recommend completing the Interactive Simulink Tutorial, reading the Getting Started section of the Simulink documentation and running the Simulink Getting Started example.

Required Hardware

You will need the following hardware:

  • Samsung GALAXY Android device, configured using targetupdater

  • USB cable to connect the device to host computer

Task 1 - Review Samsung GALAXY Android Block Library

Simulink Support Package for Samsung GALAXY Android Devices provides blocks that you can use to work with device sensors and network interfaces.

1. Enter slLibraryBrowser at the MATLAB® prompt. This opens the Simulink Library Browser.

2. In the Simulink Library Browser, navigate to Simulink Support Package for Samsung GALAXY Android Devices.

3. Double-click the Camera block. Review the block mask, which contains a description of the block, a list of 'Resolutions', a 'Refresh' button, and a 'Sample time' parameter.

Task 2 - Create a Model for Samsung GALAXY Android Devices

In this task, you will create a simple Simulink model that observes the images captured by the device camera.

1. In MATLAB, select HOME > New > Simulink Model.

2. Drag the Camera block from Samsung GALAXY Android Devices library to the model.

3. Drag the Display block from Samsung GALAXY Android Devices library to the model.

4. Connect each output of the Camera block to the corresponding input of the Display block.

5. Save your model. A pre-configured model is included for your convenience.

Task 3 - Configure and Run the Model on Samsung GALAXY Android Devices

In this task, you will configure and run your model on a Samsung GALAXY Android device.

1. Connect a Samsung GALAXY Android device to your computer with a USB cable.

2. If you did not enable USB debugging on the device when you installed the support package, enter targetupdater in the MATLAB Command Window and follow the instructions to update the device settings.

3. In your Simulink model, click Simulation > Model Configuration Parameters to open Configuration Parameters dialog.

4. Select the Hardware Implementation pane and select Android Device from the Hardware board parameter list. Click OK.

5. In your Simulink model, click the Deploy to Hardware button on the toolbar.

6. An app will be built, downloaded and run on your device. The app will now display the camera image on the device screen.

7. Save your model. A pre-configured model is included for your convenience.

Other Things to Try

In the Camera block mask, click Refresh to query the connected device for a list of supported resolutions.

Deploy the model with different camera resolutions by updating the Resolutions parameter list in the Camera block mask.

Summary

This example introduced the workflow for creating a Simulink model, configuring the model, and then running it on a Samsung GALAXY Android device. In this example you learned that:

  • Simulink Support Package for Samsung GALAXY Android Devices provides blocks for using Samsung GALAXY devices' built-in sensors.

  • You can use the Deploy to Hardware button to run a model on Samsung GALAXY Android devices.

Was this topic helpful?