What is matlab's sampling rate through Arduino analog input?

12 views (last 30 days)
45 hz. In my case average sample time is 0.011008 sec/sample, roughly 45hz, while the Arduino's sampling rate is 10000hz.
  4 Comments
Walter Roberson
Walter Roberson on 13 May 2018
I put a lot of effort into answering this question for you. I am disappointed that you deleted your part of the conversation.
Jun W
Jun W on 24 May 2018
sorry, didn't think those questions were valuable. let me undelete them

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 12 May 2018
Sensor data is numbers (or sometimes text strings). Sensors do not emit datetime objects. Most sensors do not return times at all. There are some sensors and some recording devices that time-stamp samples; they transfer that information a variety of formats. (For some sensors, resolution to minutes is more than enough; for other sensors, nanoseconds is too crude.)
MATLAB can read whatever data is sent. Sometimes converting the data to a useful format can be a bit of a nuisance (for example the encoding of GPS signals is a bit strange.) The datetime() 'InputFormat' and 'ConvertFrom' options are useful for doing conversions of various time-stamps.
However... your previous questions involve devices that do not emit timestamps, so I suspect that you are asking the wrong question.
  6 Comments
Walter Roberson
Walter Roberson on 12 May 2018
You are using the arduino in a way that is easy to program and which is flexible. With simple instructions on the MATLAB side, you can tell it to read one particular voltage, and then you could read a digital pin, and then you might have it send a pulse width modulation to control a motor. Maybe then you would cycle through reading a digital pin until it flipped, indicating that the limiter switch on the motor had been reached. The interface is easy to use and does not require that you know how the arduino works, and you can use the analog inputs and outputs and any add-on boards in any order you want.
The trade off for this is that you have to command every I/O operation, not being able to easily create an input buffer or an output queue.
The arduino can be programmed to do specific operations, such as continually reading from a sensor and putting the information in a buffer to be transmitted as a batch to the host. That can be more efficient -- but it is not as flexible or as easy to code.
Walter Roberson
Walter Roberson on 13 May 2018
The piezo-electric device you mentioned does not appear to have a serial port: it looks like it just has connectors that you attach to a sensor that samples the voltage. It is not a requirement that the sensor be connected through serial port to MATLAB.

Sign in to comment.

Categories

Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!