How I recycle the data (aka Return of CCS811)

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Fortunately there were some people who were interested in my previous post.

I2C Gas Sensor for Monitoring IAQ (CCS811) Sample Project

After explaining how to use the program, a quite reasonable question arose.

How can we use the data displayed in the Serial Terminal?

Can we get it as CSV data, so that we can use it with other application(s)?

光栄なことに私の前のポストにご興味を持っていただけた方もおいででした。

I2C Gas Sensor for Monitoring IAQ (CCS811) Sample Project

プログラムの使用方法などのご説明を書いていたところ、極めて妥当な質問をいただきました。

ターミナルソフトに表示されているデータを使用するのにはどうしたら良いでしょうか?

他のプログラムでも使用できるように CSV 形式でデータを取得することは可能でしょうか?

Well, for a hacker it is a matter of changing the format, but for an ordinal person, it may not be as trivial as it sounds.

So in this discussion, I'd like to try to show how to recycle the data from the board.

I'm going to show a couple of methods.

(1) Using TeraTerm

(2) Using SerialPlot

ソフトウェア技術者(笑)である私にとっては、ただ出力書式を変更するだけのお話ですが、

一般の方には敷居が高いものであったかも知れません。

そこでこのスレでは、ボードから出力されたデータをどのように再利用するのかに言及してみたいかと思います。

今回は二種類のアプローチを紹介してみたいと思います。

(1) TeraTerm を使用する方法

(2) SerialPlot を使用する方法

First of all, the output format of my previous program is far from easy to reuse, as it has bells and whistles.

何はともあれ、先に紹介させていただいたサンプルの出力はデモ目的でしたのでうるさいものでした。

===================

CCS811 test program (Nov 30 2018 14:13:08)

CCS811 status:0x10 id:0x81, Version:0x12

Firmware: Boot: 0x1000,  App: 0x1100

Status Register = 0x10

FW_MODE=0    : Firmware is in boot mode

APP_ERASE=0  : No erase completed

APP_VERIFY=0 : No verify completed

APP_VALID=1  : Valid application firmware loaded

DATA_READY=0 : No new data samples are ready

ERROR=0      : No error has occurred

Status Register = 0x90

FW_MODE=1    : Firmware is in application mode

APP_VALID=1  : Valid application firmware loaded

DATA_READY=0 : No new data samples are ready

ERROR=0      : No error has occurred

eCO2:     0 ppm [   Good   ] TVOC:     0 ppb [ Level 1: Excellent ]

eCO2:     0 ppm [   Good   ] TVOC:     0 ppb [ Level 1: Excellent ]

eCO2:     0 ppm [   Good   ] TVOC:     0 ppb [ Level 1: Excellent ]

eCO2:   400 ppm [   Good   ] TVOC:     0 ppb [ Level 1: Excellent ]

eCO2:   400 ppm [   Good   ] TVOC:     0 ppb [ Level 1: Excellent ]

eCO2:   400 ppm [   Good   ] TVOC:     0 ppb [ Level 1: Excellent ]

===================

So attached is a version which spits minimum CSV style output.

添付のプロジェクトでは CSV 形式だけを出力するようにダイエットしました。

===================

CCS811 test program csv version (Feb 25 2019 11:09:13)

eCO2(ppm), TVOC(ppb)

    0,     0

    0,     0

    0,     0

  400,     0

  400,     0

  400,     0

===================

(1) Using TeraTerm / TeraTerm を使用する方法

When TeraTerm started, select Menu > File > Log... (Sorry, I'm using Japanese style menu this time)

TeraTerm が起動したら、メニューから ファイル > ログ... を選択してください。

001-TeraTerm-LOG.JPG

In the Log file select Dialog, name your log file with extension ".csv".

ログファイルのダイアログが表示されたら、ファイル名を設定します。

その際、エクステンションは ".csv" にしてください。

002-log_file.JPG

Then when you start debug in PSoC Creator or just reset the connected board after loading the new project,

TeraTerm starts to show output something like below.

PSoC Creator からデバッグを開始するか、接続した基板をリセットすると下記のような出力が始まります。

003-logging.JPG

After a while when we accumulate enough data we can stop the debugger and quit TeraTerm so that another program can manipulate the data.

(We can keep TeraTerm on, if we do read-only access to the data though)

しばらくして十分なデータが記録されたところで、他のプログラムでデータをいじることが出来るようにTeraTermを終了します。

(読込専用でデータをアクセスするのであれば終了しなくても問題ありませんが)

Then open the log data.

そしてログデータを開きます。

004-Log-icon.JPG

If installed in the PC, Excel (or similar program) will show the data like below.

もし PC に Excel (若しくは同様のプログラム) がインストールされていれば下記のように表示されます。

005-Excel-started.JPG

In the program, select the top part of data.

プログラム上でデータの最初の部分を選択します。

006-select1.JPG

Then using shift-select the bottom part of the data to select all data.

次にデータの最後部をシフトキーを押しながら選択することにより

全データを選択します。

007-select2.JPG

From Insert tab of the menu select line graph

メニューの挿入タブから、折れ線グラフを選択します。

008-Insert-graph.JPG

Now a line graph of the data is placed on the worksheet.

I sighed three times during the measurement of this data.

ワークシートに測定されたデータの折れ線グラフが表示されます。

このデータを取得時に私は3回、大きく息を吐いてみました。

009-Graph-inserted.JPG

(2) Using SerialPlot / SerialPlot を使用する方法

There is a nice program called SerialPlot.

You can download it from the URL below.

SerialPlot という便利なプログラムがあります。

下記のURLからダウンロードすることが可能です。

010-SerialPlot.JPG

SerialPlot - Realtime Plotting Software | Hackaday.io

After downloading and Installing start SerialPlot.

Note: You need to disconnect TeraTerm from the board to use this program.

ダウンロード/インストール後に SerialPlot を立ち上げてください。

※: このプログラムを使用するときには TeraTerm は 基板から disconnect しておいてください。

2.1 Port Tab

011-Started.JPG

For the Port Tab,

Port:  Your CY8CKIT-044's com

Baud Rate: 115200

No Parity

8 bits

1 Stop Bit

No Flow Control

Port タブでは通信設定を行います。

Port:  お使いの CY8CKIT-044 の COM port を選択します。

Baud Rate: 115200

No Parity

8 bits

1 Stop Bit

No Flow Control

2.2 Data Format Tab

012-DataFormat.JPG

At the Data Format tab, select

ASCII

Number Of Channels: 2

Column Delimiter: comma

Data Format タブでは下記を選択・設定してください。

ASCII

Number Of Channels: 2

Column Delimiter: comma

2.3  Plot Tab

In the Plot tab

Rename

Channel 1 to eCO2

Channel 2 to TVOC

and Select Range Preset to unsigned 12bit 0 to +4095

Plot タブでは

Channel 1 を eCO2 に、Channel 2 を TVOC に変更し

Select Ragne Preset を unsigned 12bit 0 to +4095 に設定してください。

(default) (初期状態)

013-Plot-tab-1.JPG

(modified) (設定後)

014-Plot_tab-2.JPG

2.4 Record

Select filename to record the data.

データを保存するファイル名を指定します。

015-Record.JPG

Just like the previous sample, select filename with the extension ".csv"

先の例と同様に“.csv”をエクステンションとしてファイル名を設定します。

016-Filename.JPG

2.5 Start

With CY8CKIT-044 connected and ready, select "Open" button.

CY8CKIT-044 が接続されて動作準備が出来ていれば、“Open” ボタンを選択します。

017-Open.JPG

2.6 Recording

With the measured data being displayed, the data is being stored.

測定値がグラフとして表示され、データも保存されていきます。

018-Recording.JPG

2.7 Log file

  After re-select Record to stop logging, we can locate and open the log file.

再度 Record ボタンを選択して、Record を終了後、ログファイルを開くことが可能となります。

019-log-file.JPG

The data is shown in an Excel Work Sheet.

エクセルのワークシート上に測定されたデータが表示されます。

020-Excel-opened.JPG

2.8 Inserting Line Graph

Just like the previous sample, we can select the data and insert a line graph.

Note: Only two sighs this time...

先の例と同様に、データを選択して折れ線グラフを挿入することが可能です。

※ 今回はため息は2回でした。

025-graph-inserted.JPG

Well, (I hope) that's about all.

おあとがよろしいようで。

moto

2 Replies
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Some seems to have difficulty to find download link at SerialPlot's page as I did.

SerialPlot のページでダウンロードリンクが見つけにくいかもしれません。(私もそうでした)

000-SerialPlot-Web.JPG

Please scroll down the page up to where you can see the orange links as below.

下記のようにオレンジ色のリンクが表示されるまで、スクロールダウンしてください。

001-Download-links.JPG

Now please select and download the one for your platform.

ここでお使いのプラットフォーム(OS)にあったものを選択してダウンロードしてください。

64bit 版 Windows であれば serialplot-0.10.0-win64.exe

32bit 版 Windows であれば serialplot-0.10.0-win32.exe

等となります。

moto

0 Likes

お蔭様で実装が成功し測定が出来ました。

東京オリンピックや健康増進法改正での受動喫煙対策等にTVOC測定が活用可能ではと思います。

丁寧な解説のお蔭で大変参考になりました。

有難うございました。

ホルムアルデヒドや他のvocなど、品確法で定められている他のVOC測定などもあると参考になります。