フィルターのクリア

High Frequency Accelerometer Data Capture with Arduino

3 ビュー (過去 30 日間)
Audrey
Audrey 2019 年 4 月 28 日
Hi All,
I've implemented some accelerometer data capture with arduino using the arduino add-on library + the LSM303 add on, much like this video describes:
However, with tic toc managing the data capture, I'm getting a reading frequency of about 20Hz, and I'd like to get to 100Hz.
Is there a way to ask the arduino to store ~10 seconds of data at 100Hz and report it, to get around the time constraints of the tic toc function? If I were using the Arduino IDE, I imagine this would be some kind of Serial command, but I haven't been able to find examples for that in matlab.
Thanks!
Here's my current code (I am reading data from 2 identical systems, each with one arduino and one accelerometer):
a = arduino('/dev/cu.usbserial-AH06F3MJ','Uno', 'Libraries', 'Pololu/LSM303');
compass = addon(a, 'Pololu/LSM303');
a_b = arduino('/dev/tty.usbserial-AC00BNYZ','Uno', 'Libraries', 'Pololu/LSM303');
compass2 = addon(a_b, 'Pololu/LSM303');
sensor1_data = [];
sensor2_data = [];
time = [];
n = 1;
sensor1_data = [];
sensor2_data = [];
tic
while toc < 8
acc2 = readAcceleration(compass2);
acc1 = readAcceleration(compass);
time(n,:) = toc;
sensor1_data(n,:) = acc1;
sensor2_data(n,:) = acc2;
n = n+1;
end
close all

回答 (0 件)

カテゴリ

Help Center および File ExchangeArduino Hardware についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by