Main Content

beaglebone

Connection to BeagleBone Black hardware

Description

This object represents a connection from the MATLAB® software to the BeagleBone® Black hardware. After you create the object, you can use the object to interact with the hardware and its peripheral devices by using this object with the functions listed in Object Functions. You can also use the object to interact with the devices attached to the hardware, such as a web camera, I2C buses, serial devices, and SPI channels.

Creation

Description

example

bbb = beaglebone creates a connection from the MATLAB software to the BeagleBone Black hardware. This connection reuses the IP address, user name, and password from most recent connection to the BeagleBone Black hardware.

example

bbb = beaglebone(deviceaddress,username,password) creates a connection to the BeagleBone Black hardware using the IP address, user name, and password that you specify.

The BeagleBone Black hardware has two default user names: 'debian' and 'root'. For 'debian', the default password is 'temppwd'. For 'root', the default password is empty: ''. The 'root' account has superuser powers at the command line. It is a good security practice to create a strong root password.

Input Arguments

expand all

Linux user name, specified as a character vector.

Example: 'debian'

Data Types: char

Linux user password, specified as a character vector.

Note

The BeagleBone Black hardware has two default user names: 'debian' and 'root'. For 'debian', the default password is 'temppwd'. For 'root', the default password is empty: ''. The 'root' account has superuser powers at the command line. Creating a strong root password is a good security practice.

Example: 'temppwd'

Data Types: char

Properties

expand all

This property is read-only.

The IPv4 address or the host name of the BeagleBone Black hardware, specified as a character vector. This property is set by the deviceaddress input argument, and it cannot be changed after object creation.

If you are accessing the hardware through the USB port, do not use the host name as the device address. To use the host name, you must connect an Ethernet cable to the Ethernet port of the hardware. Use Linux commands to configure the hardware IP address and associate the host name with the hardware IP address.

Example: '169.254.0.2'

Example: 'beaglebone-hysdu8X38o'

Data Types: char

This property is read-only.

The name of the BeagleBone Black hardware that is connected to the computer, specified as a character vector. This property cannot be changed after object creation.

Example: 'BeagleBone Black Rev 00C0'

Data Types: char

This property is read-only.

The available LEDs on the BeagleBone Black hardware that is connected to the computer, specified as a cell array of character vectors. This property cannot be changed after object creation.

Example: {'usr0', 'usr1', 'usr2', 'usr3'}

Data Types: cell

This property is read-only.

The available digital input and output pins on the BeagleBone Black hardware that is connected to the computer, specified as a cell array of character vectors. This property cannot be changed after object creation.

The hardware has two extension headers named P8 and P9. Each extension header has 46 pins numbered from 1 to 46.

Example: {'P8_21', 'P8_22', 'P9_11', 'P9_28'}

Data Types: cell

This property is read-only.

The available analog pins on the BeagleBone Black hardware that is connected to the computer, specified as a cell array of character vectors. This property cannot be changed after object creation.

Example: {'AIN0', 'AIN1', 'AIN6'}

Data Types: cell

This property is read-only.

The available PWM pins on the BeagleBone Black hardware that is connected to the computer, specified as a cell array of character vectors. This property cannot be changed after object creation.

Example: {'P8_13'}

Data Types: cell

This property is read-only.

The available SPI channels on the BeagleBone Black hardware that is connected to the computer, specified as a cell array of character vectors. This property cannot be changed after object creation.

Example: {'spidev0.0'}

Data Types: cell

This property is read-only.

The available I2C buses on the BeagleBone Black hardware that is connected to the computer, specified as a cell array of character vectors. This property cannot be changed after object creation.

Example: {'i2c-0', 'i2c-1'}

Data Types: cell

This property is read-only.

The available serial ports on the BeagleBone Black hardware that is connected to the computer, specified as a cell array of character vectors. This property cannot be changed after object creation.

Example: {'/dev/ttyO1', '/dev/ttyO2', '/dev/ttyO4', '/dev/ttyO5'}

Data Types: cell

This property is read-only.

The available web cameras on the BeagleBone Black hardware that is connected to the computer, specified as a cell array of character vectors. This property cannot be changed after object creation.

Example: {'Logitech C950'}

Data Types: cell

Object Functions

showPinsShow diagram of GPIO pins
showAllPinsShow diagram of all pins
clearTerminate connection to BeagleBone Black hardware
showLEDsShow location, name, and color of user-controllable LEDs
writeLEDTurn LED on or off
configureDigitalPinConfigure GPIO pin as input or output
readDigitalPinRead logical value from GPIO input pin
writeDigitalPinWrite logical value to GPIO output pin
readVoltageRead voltage from analog input pin
enablePWMEnable PWM pin
webcamConnection to web camera on BeagleBone Black hardware
serialdevConnection to serial device on BeagleBone Black hardware
enableSerialPortEnable serial interface
enableI2CEnable I2C interface
i2cdevConnection to device on BeagleBone Black I2C bus
scanI2CBusScan I2C bus device addresses
enableSPIEnable SPI interface
spidevConnection to SPI device on BeagleBone Black hardware
systemRun command in Linux shell on BeagleBone Black hardware
openShellOpen terminal on host computer for Linux shell on BeagleBone Black hardware
getFileTransfer file from BeagleBone Black hardware to host computer
putFileTransfer file from host computer to hardware
deleteFileDelete file from hardware

Examples

collapse all

You can connect from the MATLAB software to BeagleBone Black hardware. Use this connection to interact with the hardware.

Create a connection, bbb, from the MATLAB software to BeagleBone Black hardware.

bbb = beaglebone
bbb = 

  beaglebone with properties:

           DeviceAddress: '192.168.7.2'
               BoardName: 'BeagleBone Black Rev 00C0'
           AvailableLEDs: {'USR0'  'USR1'  'USR2'  'USR3'}
    AvailableDigitalPins: {1x29 cell}
     AvailableAnalogPins: {'AIN0'  'AIN1'  'AIN2'  'AIN3'  'AIN4'  'AIN5'  'AIN6'}
        AvailablePWMPins: {}
    AvailableSPIChannels: {}
       AvailableI2CBuses: {'i2c-1'}
    AvailableSerialPorts: {}
        AvailableWebcams: {} 

Show the current pin configuration.

showPins(bbb);

Show all possible pin configurations.

showAllPins(bbb)

Use bbb to turn the usr0 LED on and off.

writeLED(bbb,'usr0',1);
pause(1);
writeLED(bbb,'usr0',0);

To close the connection to bbb, use clear.

clear bbb

You can connect from the MATLAB software to BeagleBone Black hardware that has a different device, user name, and password from the previous successful connection.

Follow this example to reconnect to hardware after you change its settings, or to connect to multiple instances of the hardware concurrently.

bbb2 = beaglebone('169.254.0.4','myusername','mypassword')
bbb2 = 

 beaglebone with properties:

           DeviceAddress: '169.254.0.4'
               BoardName: 'BeagleBone Black Rev 00C0'
           AvailableLEDs: {'USR0'  'USR1'  'USR2'  'USR3'}
    AvailableDigitalPins: {1x29 cell}
     AvailableAnalogPins: {'AIN0'  'AIN1'  'AIN2'  'AIN3'  'AIN4'  'AIN5'  'AIN6'}
        AvailablePWMPins: {}
    AvailableSPIChannels: {}
       AvailableI2CBuses: {'i2c-1'}
    AvailableSerialPorts: {}
        AvailableWebcams: {} 

You can use a host name, instead of an IP address, to connect from the MATLAB software to the BeagleBone Black hardware.

If you are accessing the hardware through the USB port, do not use the host name as device address. To use the host name, you must connect an Ethernet cable to the Ethernet port of the board. Use Linux commands to configure the hardware IP address and associate the host name with the IP address.

bbb2 = beaglebone('beaglebone-hysdu8X38o')
bbb2 = 

 beaglebone with properties:

           DeviceAddress: 'beaglebone-hysdu8X38o'
               BoardName: 'BeagleBone Black Rev 00C0'
           AvailableLEDs: {'USR0'  'USR1'  'USR2'  'USR3'}
    AvailableDigitalPins: {1x29 cell}
     AvailableAnalogPins: {'AIN0'  'AIN1'  'AIN2'  'AIN3'  'AIN4'  'AIN5'  'AIN6'}
        AvailablePWMPins: {}
    AvailableSPIChannels: {}
       AvailableI2CBuses: {'i2c-1'}
    AvailableSerialPorts: {}
        AvailableWebcams: {} 

Version History

Introduced in R2015a