1

I am reading high / low timing data from an 433Mhz transceiver using Arduino.

The data is in the following formation Total count, followed by ms high and then ms low. In this example-125 readings, starting high for 83ms and then low for 84ms and so on.

125:83,84,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,84,83,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,82,84,83,84,83,84,83,84,83,84,84,84,83,84,83,84,83,84,83,84,83,86,497,84,90,84,93,84,95,84,181,99,83,102,83,104,83,179,91,84,177,178,181,99,83,184,103,84,96,84,175,176,179,97,83,182,185,186,180,174,177,95,83,98,83,100,83,184,187,96,83,92,83,94,83,96,83,98,83,100,83,184,187,89 

How can I read this data and plot using Gnuplot like the attached image, so I can study the wave form?

Protocol Analyser Trace

I am used to plotting x/y or time series graphs with separate data columns. But I am not sure where to start with this type of data.

DSDmark
  • 1,045
  • 5
  • 11
  • 25
  • Do you have the freedom/flexibility to change the data format or is it given and fixed? Data in a column instead of a row would be better for gnuplot. The latter can probably also be handled at the cost of some complexity. – theozh Feb 24 '23 at 08:11
  • Do you mean as column like this? If so yes I could format like that. `83` `84` `84` – tim.roberts Feb 24 '23 at 08:38

1 Answers1

1

There is the plotting style with steps in different variations. However, in order to get to data points you first have to sum up your durations, but then the last horizontal line will be missing.

You could use the plotting style with vectors or xerrorbars then you could easily plot durations, but then the vertical lines would be missing.

So, I guess you either have to

  • plot the data twice for horizontal lines and vertical lines using with vectors
  • or plot the data with steps and only add the last horizontal line with vectors.

The following example is using the latter approach. If it is not critical, you might want to skip the last horizontal line to simplify the plot command.

Depending on your input data the plot command will be different. First graph with column data, second graph data with row data. gnuplot prefers data in columns, but for data in rows you can use the option matrix (actually, a 1 x 125 matrix)

  • you sum up your durations in the variable x1. x0 is the previous value.
  • since you have alternating high/low data, you get the y-values using modulo operator %.

Data:

SO75553813_col.dat

125:
83
84
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
84
83
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
82
84
83
84
83
84
83
84
83
84
84
84
83
84
83
84
83
84
83
84
83
86
497
84
90
84
93
84
95
84
181
99
83
102
83
104
83
179
91
84
177
178
181
99
83
184
103
84
96
84
175
176
179
97
83
182
185
186
180
174
177
95
83
98
83
100
83
184
187
96
83
92
83
94
83
96
83
98
83
100
83
184
187
89

SO75553813_row.dat

125:83,84,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,84,83,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,82,84,83,84,83,84,83,84,83,84,84,84,83,84,83,84,83,84,83,84,83,86,497,84,90,84,93,84,95,84,181,99,83,102,83,104,83,179,91,84,177,178,181,99,83,184,103,84,96,84,175,176,179,97,83,182,185,186,180,174,177,95,83,98,83,100,83,184,187,96,83,92,83,94,83,96,83,98,83,100,83,184,187,89

Script:

### plottting high low signals
reset session

FILE_COL = "SO75553813_col.dat"
FILE_ROW = "SO75553813_row.dat"

set offsets graph 0.05, graph 0.05, graph 0.1, graph 0.1
set xrange[:] noextend
set key noautotitle

set multiplot layout 2,1

    set title "column data"
    plot x1=0 FILE_COL  u (x0=x1, x1=x1+$1, x0):(y0=int($0+1)%2) skip 1 w steps lc "red", \
             '+' u (x0):(y0):(x1-x0):(0) every ::::0 w vec nohead lc "red" 
             
    set title "row data"
    set datafile separator ":,"
    plot x1=0 FILE_ROW matrix u (x0=x1, x1=x1+$3, x0):(y0=int($1)%2) every ::1 w steps lc "blue", \
             '+' u (x0):(y0):(x1-x0):(0) every ::::0 w vec nohead lc "blue" 
unset multiplot
### end of script

Result:

enter image description here

theozh
  • 22,244
  • 5
  • 28
  • 72