iAQ-Core C(VOC) Sensor
2018年7月27日 - 未分類
ams社から、サンプルで送ってもらった、iAQ-Core Cセンサーを試してみました。
I2Cセンサーです。アドレスは0x5aです。
下記コードは、センサーから1秒おきに値を読み出すpythonスクリプトです。
#!/usr/bin/env python
import pigpio
import time,sys,datetime
pi = pigpio.pi()
if not pi.connected:
exit()
h = pi.i2c_open(1, 0x5a)
while True:
try:
c, d = pi.i2c_read_device(h, 9)
length=len(d)
if length != 9:
continue
print('time ='+str(datetime.datetime.today()))
prediction=d[0]*pow(2,8)+d[1]
print('eCO2 = '+str(prediction)+' ppm')
if d[2] == 0:
status='OK'
if d[2] == 0x01:
prediction=d[0]*pow(2,8)+d[1]
print('eCO2 = '+str(prediction)+' ppm')
if d[2] == 0:
status='OK'
if d[2] == 0x01:
status='BUSY'
if d[2] == 0x10:
status='RUNIN'
if d[2] == 0x80:
status='BUSY'
if status == 'OK':
print('status = '+str(status))
resistance = d[4]*pow(2,16)+d[5]*pow(2,8)+d[6]
print('resistance = '+str(resistance)+' Ohm')
eTVOC= d[7]*pow(2,8)+d[8]
print(' eTVOC = '+str(eTVOC)+' ppb')
#time.sleep(4)
time.sleep(1)
except KeyboardInterrupt:
pi.i2c_close(h)
pi.stop()
sys.exit(0)
thingspeakでグラフ化した結果です。多少のバラツキはありますが、CS811よりも安定しているようです。
内部に温度センサーを持っているようで、温度補償は必要ありません。バーインも不要のようです。