传感器
连接到不同传感器读取数据。
函数
IMU 和环境传感器
mpu9250 | Connect to MPU-9250 sensor on Arduino hardware I2C bus |
lsm9ds1 | Connect to LSM9DS1 sensor on Arduino hardware I2C bus |
mpu6050 | Connect to MPU-6050 sensor on Arduino hardware I2C bus |
lsm303c | Connect to LSM303C sensor Arduino hardware I2C bus (自 R2021a 起) |
lsm6ds3 | Connect to LSM6DS3 sensor on Arduino hardware I2C bus (自 R2021a 起) |
lsm6ds3h | Connect to LSM6DS3H sensor on Arduino hardware I2C bus (自 R2021a 起) |
lsm6dsl | Connection to LSM6DSL sensor on Arduino hardware I2C bus (自 R2021a 起) |
lsm6dsm | Connect to LSM6DSM sensor on Arduino hardware I2C bus (自 R2021a 起) |
lsm6dso | Connect to LSM6DSO sensor on Arduino hardware I2C bus (自 R2021a 起) |
lsm6dsr | Connect to LSM6DSR sensor on Arduino hardware I2C bus (自 R2021a 起) |
hts221 | Connect to HTS221 sensor on Arduino hardware I2C bus (自 R2021a 起) |
lps22hb | Connect to LPS22HB sensor on Arduino hardware I2C bus (自 R2021a 起) |
adxl345 | Connect to ADXL345, ADXL343, ADXL344, or ADXL346 sensor on Arduino hardware I2C bus (自 R2022a 起) |
icm20948 | Connect to ICM-20948 sensor on Arduino hardware I2C bus (自 R2022a 起) |
bmp280 | Connect to BMP280 sensor on Arduino hardware I2C bus (自 R2022b 起) |
lis3dh | Connect to LIS3DH sensor on Arduino hardware I2C bus (自 R2022b 起) |
bmi160 | Connect to BMI160 sensor on Arduino hardware I2C bus (自 R2023a 起) |
adis16505 | Connect to ADIS16505 sensor on Arduino hardware SPI bus (自 R2024a 起) |
flush | Flush the host buffer |
info | Read information related to sensor |
read | Read real-time sensor data at a specified rate |
readAcceleration | Read one sample of acceleration from sensor |
readAngularVelocity | Read one sample of angular velocity from sensor |
readMagneticField | Read one sample of magnetic field from sensor |
readTemperature | Read one sample of temperature from sensor (自 R2021a 起) |
readHumidity | Read one sample of relative humidity data from the sensor (自 R2021a 起) |
readPressure | Read one sample of barometric air pressure data from the sensor (自 R2021a 起) |
readVoltage | Read voltage from ADC pins on sensor (自 R2023a 起) |
release | Release the sensor object |
stop | Stop data collection from sensor object (自 R2020a 起) |
BNO055 传感器
bno055 | Connect to BNO055 sensor on Arduino hardware I2C bus (自 R2020a 起) |
flush | Flush the host buffer for BNO055 sensor |
info | Read output data rate and bandwidth setting of BNO055 sensor |
read | Read acceleration, angular velocity, magnetic field, time, and overrun data from BNO055 sensor |
readAcceleration | Read one sample of acceleration from BNO055 sensor |
readAngularVelocity | Read one sample of angular velocity from BNO055 sensor |
readCalibrationStatus | Read calibration status of BNO055 sensor |
readMagneticField | Read one sample of magnetic field strength from BNO055 sensor |
readOrientation | Read orientation data from BNO055 sensor |
release | Release the BNO055 object |
GPS
gpsdev | Connect to GPS receiver on Arduino hardware (自 R2020a 起) |
flush | Flush the host buffer (自 R2020a 起) |
info | Read Update Rate, GPS Lock information and number of satellites in View for the GPS receiver (自 R2020a 起) |
read | Read data from GPS (自 R2020a 起) |
release | Release the GPS object (自 R2020a 起) |
stop | Stop data collection from GPS module (自 R2020a 起) |
writeBytes | Write raw data to GPS module (自 R2020a 起) |
APDS9960
apds9960 | Connect to APDS9960 sensor on Arduino hardware using I2C bus (自 R2021b 起) |
readColor | Reads clear light and RGB components through APDS9960 sensor (自 R2021b 起) |
readGesture | Read gesture through APDS9960 sensor (自 R2021b 起) |
readProximity | Read the proximity from APDS9960 sensor (自 R2021b 起) |
超声波传感器
ultrasonic | Connection to ultrasonic sensor on Arduino hardware |
readDistance | Distance to object in front of ultrasonic sensor |
readEchoTime | Read echo time of ultrasound waves |
主题
- Read and Plot Real-Time Data from BNO055 Sensor in NDOF Mode
This example shows you how to read and plot calibrated data from a Bosch Sensortec BNO055 a 9-axis absolute orientation sensor in real time.
- Calibrate BNO055 Sensors
Steps to calibrate the BNO055 sensors.
- Limitations
Limitations when using sensors and GPS receiver.
- Calculate Pitch and Roll on Arduino Using IMU Sensor (Simulink)
This example shows how to read the acceleration and angular velocity data from IMU sensor mounted on Arduino® hardware and calculate the pitch and roll angles.
- Measure LSM9DS1 Sensor Outputs Using Nano 33 BLE Sense
Read data from a LSM9DS1 sensor using Bluetooth®.
疑难解答
Troubleshoot sensors.
精选示例
Estimating Orientation Using Inertial Sensor Fusion and MPU-9250
Get data from an InvenSense MPU-9250 IMU sensor, and to use the 6-axis and 9-axis fusion algorithms in the sensor data to compute orientation of the device.
Wireless Data Streaming Using BNO055 and Bluetooth and Estimating Orientation Using Sensor Fusion
Get data from a Bosch BNO055 IMU sensor through HC-05 Bluetooth® module and to use the 9-axis AHRS fusion algorithm on the sensor data to compute orientation of the device. The example creates a figure which gets updated as you move the device.
Plot Position Using GPS Connected to Arduino Hardware
Get the geographic location using the GPS module connected on Arduino hardware and plot the location in a map.
IoT-Based Automatic Cooling Fan Control Using ThingSpeak and Arduino Hardware
Create a ThingSpeak™ channel and use the MATLAB® functions to collect the temperature data from a BMP280 sensor connected to your Arduino® board, and then use MATLAB Analysis in ThingSpeak to trigger the automatic control of a CPU cooling fan kept in the room and then monitor the usage of the fan by calculating the runtime. This example also shows you how to set up an email alert if the fan turns on, by using MATLAB functions in ThingSpeak.
IoT-Based Temperature Monitoring Using ThingSpeak and Arduino Hardware
Create a ThingSpeak™ channel and use MATLAB® functions to collect the temperature data from a BMP280 sensor connected to your Arduino® board, and then use MATLAB Analysis in ThingSpeak to analyze the maximum and minimum temperature. This example also shows you how to set up an email alert if the room temperature exceeds a threshold value, by using MATLAB functions in ThingSpeak.
Classify and Count Fruits Using Arduino Nano 33 BLE Sense, ThingSpeak, and Machine Learning
Collect RGB values of three types of fruits using the APDS9960 sensor embedded in an Arduino® Nano 33 BLE board and use the MATLAB® 分类学习器 (Statistics and Machine Learning Toolbox) app to train a machine learning model with the RGB values to classify the fruits. This example also shows how to use the ThingSpeak™ platform for tracking the number of fruits in a box and setting up an email alert if the number of any one of the three types of fruits drops to zero.
Identify Shapes Using Machine Learning on Arduino Nano 33 BLE Sense Hardware
Use MATLAB® Support Package for Arduino® Hardware to identify shapes using a machine learning algorithm. This example uses the Arduino Nano 33 BLE Sense hardware board with an onboard lsm9ds1
.
Human Activity Recognition Using ESP32 Board and LSM9DS1 IMU Sensor
Classify and predict one of three different physical human activities: Sitting, Standing and Walking based on data acquired using an ESP32 board and an lsm9ds1
sensor. This example uses 分类学习器 (Statistics and Machine Learning Toolbox) app to train a machine learning model with the sensor data. To access all the files for this example, click Open Live Script and download the attached files.
Perform Predictive Maintenance on Rotating Device Using ESP32 Board, ThingSpeak, and Machine Learning
Predict and monitor the health of a rotating device using machine learning algorithm. You can use this example for predictive maintenance of any rotating device or piece of equipment so that you can fix them before they fail.
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)