plotting
This commit is contained in:
parent
644f99985e
commit
20b8c8c0f0
4
.gitignore
vendored
4
.gitignore
vendored
@ -2,4 +2,6 @@
|
||||
bme680
|
||||
bme680_i2c
|
||||
bme680_spi
|
||||
bme680_log*
|
||||
bme680_log*
|
||||
plot/*.png
|
||||
plot/*.txt
|
67
README.md
67
README.md
@ -106,8 +106,6 @@ gas resistance: 14702.868852 Ohm
|
||||
=== heat_stab_r: 1
|
||||
```
|
||||
|
||||
Note: Do not trust the gas resistance measurement if `heat_stab_r` is not `1`.
|
||||
|
||||
## Burn-in / logging
|
||||
|
||||
See file `example/log.c`
|
||||
@ -119,64 +117,9 @@ See file `example/log.c`
|
||||
|
||||
Compile and run
|
||||
```sh
|
||||
stdbuf -o0 ./bme680 2>&1 | tee -a log.txt
|
||||
```
|
||||
|
||||
This will give an output similar to this:
|
||||
```
|
||||
2024-05-14T13:03:02+0100 20.8916 99836.7 68.6594 7180.73 1
|
||||
2024-05-14T13:04:03+0100 20.8658 99840.3 68.7844 7171.53 1
|
||||
2024-05-14T13:05:03+0100 20.8979 99838.6 68.7759 7162.35 1
|
||||
2024-05-14T13:06:03+0100 20.9208 99843.8 68.6436 7166.93 1
|
||||
2024-05-14T13:07:03+0100 20.9303 99845.4 68.747 7144.05 1
|
||||
2024-05-14T13:08:03+0100 20.9249 99846 68.7122 7139.49 0
|
||||
2024-05-14T13:09:04+0100 20.9036 99845.2 68.7224 7157.76 1
|
||||
2024-05-14T13:10:04+0100 20.8737 99850.5 68.575 7144.05 1
|
||||
2024-05-14T13:11:04+0100 20.8753 99850.6 68.8879 7139.49 1
|
||||
2024-05-14T13:12:04+0100 20.9152 99849.3 68.8602 7134.94 1
|
||||
```
|
||||
|
||||
If last field is not 1 then the measurement, at least for gas resistance, cannot be trusted.
|
||||
```sh
|
||||
sed -n '/1$/p' log.txt > test.txt
|
||||
```
|
||||
|
||||
Then graph with gnuplot
|
||||
```
|
||||
# gnuplot
|
||||
reset
|
||||
|
||||
set key autotitle columnhead
|
||||
set terminal pngcairo enhanced size 2*1920/3,2*1080/3
|
||||
set grid
|
||||
set xdata time
|
||||
set timefmt "%Y-%m-%dT%H:%M:%S%z"
|
||||
|
||||
|
||||
|
||||
# gas res vs time
|
||||
set title "[I_{dac}=100, 100ms, target=300 C] GasRes over time"
|
||||
set xlabel "Time"
|
||||
set ylabel "Gas Resistance (OHM)"
|
||||
set output "gas.png"
|
||||
plot 'test.txt' u 1:5 w p pt 3 ps 1 t "BME680"
|
||||
|
||||
|
||||
set title "[I_{dac}=100, 100ms, target=300 C] Temperature over time"
|
||||
set xlabel "Time"
|
||||
set ylabel "Temperature (C)"
|
||||
set output "temp.png"
|
||||
plot 'test.txt' u 1:2 w p pt 3 ps 1 t "BME680"
|
||||
|
||||
set title "[I_{dac}=100, 100ms, target=300 C] Pressure over time"
|
||||
set xlabel "Time"
|
||||
set ylabel "Pressure (Pa)"
|
||||
set output "press.png"
|
||||
plot 'test.txt' u 1:3 w p pt 3 ps 1 t "BME680"
|
||||
|
||||
set title "[I_{dac}=100, 100ms, target=300 C] Humidity over time"
|
||||
set xlabel "Time"
|
||||
set ylabel "Humidity (%RH)"
|
||||
set output "hum.png"
|
||||
plot 'test.txt' u 1:4 w p pt 3 ps 1 t "BME680"
|
||||
$ stdbuf -o0 ./bme680_log_i2c 2>&1 | tee -a data/i2c.txt &
|
||||
$ stdbuf -o0 ./bme680_log_spi 2>&1 | tee -a data/spi.txt &
|
||||
# wait a couple of hours or days ..
|
||||
$ cd plot
|
||||
$ ./plot.sh
|
||||
```
|
||||
|
37
plot/gnuplot.gpt
Normal file
37
plot/gnuplot.gpt
Normal file
@ -0,0 +1,37 @@
|
||||
# gnuplot
|
||||
reset
|
||||
|
||||
set key autotitle columnhead
|
||||
set terminal pngcairo enhanced size 2*1920/3,2*1080/3
|
||||
set grid
|
||||
set xdata time
|
||||
set timefmt "%Y-%m-%dT%H:%M:%S%z"
|
||||
|
||||
# gas res vs time
|
||||
set title "[I_{dac}=100, 100ms, target=300 C] GasRes over time"
|
||||
set xlabel "Time"
|
||||
set ylabel "Gas Resistance (OHM)"
|
||||
set output "gas.png"
|
||||
plot 'i2c.txt' u 1:5 w p pt 3 ps 1 t "bme680-i2c", \
|
||||
'spi.txt' u 1:5 w p pt 3 ps 1 t "bme680-spi"
|
||||
|
||||
set title "[I_{dac}=100, 100ms, target=300 C] Temperature over time"
|
||||
set xlabel "Time"
|
||||
set ylabel "Temperature (C)"
|
||||
set output "temp.png"
|
||||
plot 'i2c.txt' u 1:2 w p pt 3 ps 1 t "bme680-i2c", \
|
||||
'spi.txt' u 1:2 w p pt 3 ps 1 t "bme680-spi"
|
||||
|
||||
set title "[I_{dac}=100, 100ms, target=300 C] Pressure over time"
|
||||
set xlabel "Time"
|
||||
set ylabel "Pressure (Pa)"
|
||||
set output "press.png"
|
||||
plot 'i2c.txt' u 1:3 w p pt 3 ps 1 t "bme680-i2c", \
|
||||
'spi.txt' u 1:3 w p pt 3 ps 1 t "bme680-spi"
|
||||
|
||||
set title "[I_{dac}=100, 100ms, target=300 C] Humidity over time"
|
||||
set xlabel "Time"
|
||||
set ylabel "Humidity (%RH)"
|
||||
set output "hum.png"
|
||||
plot 'i2c.txt' u 1:4 w p pt 3 ps 1 t "bme680-i2c", \
|
||||
'spi.txt' u 1:4 w p pt 3 ps 1 t "bme680-spi"
|
5
plot/plot.sh
Executable file
5
plot/plot.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
sed -n '/1$/p' ../data/spi.txt > spi.txt
|
||||
sed -n '/1$/p' ../data/i2c.txt > i2c.txt
|
||||
gnuplot gnuplot.gpt
|
Loading…
Reference in New Issue
Block a user