Node.js에서 MLX90614 온도센서 I2C 통신

신석진( Seokjin Shin)·2021년 7월 29일
0

RAM address와 데이터 해석

다음은 RAM에 접근하여 정보를 읽어올 때 쓰이는 주소이다. 해당 주소에 쓰기는 불가능하다. Ta는 Ambient tempature 즉 물체 주변 온도이고, TOBJ1, TOBJ2는 물체의 온도이다.

RAM address 0x07에서 데이터를 읽으면 0.02를 곱한 값이 절대온도가 된다. 절대 온도에서 섭씨 온도를 구하려면 273.15를 빼면 된다.

i2c-bus 패키지

패키지 다운

npm install i2c-bus

간단한 센서 데이터 읽기 예시

const i2cbus= require("i2c-bus");
//0x5a
i2cbus.open(1)
.then(bus => bus.readWord(0x5a, 0x07))
.then(word => console.log(word * 0.02 - 273.15));

참고자료

라이브러리 이해에 쓰인 자료

Adafruit_MLX90614.h

Adafruit_MLX90614.cpp

Adafruit_I2CDevice.h

Adafruit_I2CDevice.cpp

mlx90614-driver.js

센서 데이터 시트

datasheet-mlx90614

0개의 댓글