How can I fix the sampling rate when saving text data using Coolterm

Hi there,

I’m trying to plot the data in Matlab, where I save the text file from Arduino nano in Coolterm. The circuit is basically two sensors output voltage in two channels using AnalogRead(). Then I realize the time intervals are irregular in my plot, which seems to cause by the inconsistent sampling rate. Can someone please help me to increase and fix the sampling frequency to 250 Hz? Thank you for answering.

I realize the time intervals are irregular in my plot, which seems to cause by the inconsistent sampling rate. Can someone please help me to increase and fix the sampling frequency to 250 Hz?

I'm certain someone could if you posted your code.

See How to get the best out of this forum. In particular read the section about how to post formatted code.

How much inconsistency are you seeing in the time stamps? Please post some sample data as well showing the inconstent sample rate.

Is your Arduino code generating the timestamps and sending them to CoolTerm along with your data, or are you having CoolTerm add timestamps to received data? The latter is not recommended if precise timing is required as serial communication is asynchronous and the speed and frequency with which CoolTerm can receive and record data is variable and highly dependent on the performance of the hardware it runs on.