Borrar filtros
Borrar filtros

High Frequency Accelerometer Data Capture with Arduino

3 visualizaciones (últimos 30 días)
Audrey
Audrey el 28 de Abr. de 2019
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

Respuestas (0)

Categorías

Más información sobre Arduino Hardware en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by