'온도'에 해당되는 글 10건

  1. 2020.07.27 Hardware | Vici VC97 Multimeter 구매기
  2. 2019.12.15 Hardware | lenovo X240 노트북 열 잡기
  3. 2018.11.23 Hardware | MAX30105 파티클 센서 - 1
  4. 2018.08.06 Hardware | MAX31865 + PT100 온도센서 조합 2
  5. 2018.07.31 Hardware | MAX31855 + K-type 온도센서 조합 2
  6. 2017.07.29 Hardware | DS18B20 온도센서 17
  7. 2017.07.12 Hardware | AM2322 Temperature & Humidity Sensor
  8. 2017.03.09 Hardware | BME280 sensor
  9. 2017.03.06 Hardware | Arduino BMP280 고도/온도/기압 센서
  10. 2017.03.05 Hardware | Arduino 비접촉 온도센서 GY-906 MLX90614

Hardware | Vici VC97 Multimeter 구매기

|

전자 부품을 가지고 너무나 놀고 싶은데, 생계를 위한 회사 업무는 많고, 용돈은 적고, 그렇게 시간만 가고 있었습니다.

2016년 11월 20일. 하고싶은 전자 놀이를 더는 늦출 수 없다고 생각하고 저렴하더라도 멀티 미터를 구입합니다.




1. VC97


AliExpress 를 검색하던 중, 뭔가 카피스러운 멀티미터를 발견합니다. VC97.

그때 당시 가격이 26.79 USD. 4년만에 2.3 달러 정도 올랐네요.


* VICI VC97 digital multimeter voltmeter AC/DC voltage current Resistance Capacitance frequency Tester multimetro vc97

https://www.aliexpress.com/item/32871339902.html



저렴하지만, 기능 상 특별히 문제는 없다는 글들을 봤습니다.


VC97_upgrade_diff.pdf


어느정도 검증된 FLUKE 같은 제품을 구매하고 싶었으나, 기본 25만원이 훌쩍 넘어가는 금액... ㅠㅠ




2. 도착


중국 사이트에서 물건을 직접 구매해 보기 시작할 때라 조마조마 하면서 기다리던 생각이 나네요.

실제 가격은 거의 30 USD 인데, 10 USD 정도로 교기하고 보낸 소포.



파우치 안에 캐이블류와 함께 꽉꽉 담겨 왔습니다.



요놈이 그놈이군.



프로브는 악어클립형과 탐침용 두 개가 들어있고, Thermocouple 온도 센서도 포함되어 있습니다.

이 가격에 이 구성품이면 훌륭한 것이죠.





3. 분해


잘 써오고 있던 와중에, 분해해 보고 싶어 졌습니다.

사실은 저렴한 멀티미터를 개조한 글 들을 보고, 혹시 나의 VC97 도 그런 가능성이 있는지 미리 확인해 보려는 의도도 있습니다.


우선 말랑말랑한 연질의 케이스를 벗겨 냅니다.



분해시 쇼트의 위험이 있으므로, 밑의 커버를 벗겨 내고 건전지를 분리합니다.



뒷면의 나사 세 개를 풀면, 뒷 커버가 쉽게 분리 됩니다.



PCB 상의 정식 명칭은 VC97 V0.7 이네요. 버전이 극 초기인 듯 합니다.

2016년 11월 20일에 구입했지만, 실제 생산일은 2015년 3월 16일로 되어 있네요. 아니면 PCB 디자인 완료한 날짜일 수도 있구요.



모드를 바꾸는 노브와 LCD 창을 제거하면 아래와 같습니다.



모드를 바꾸는 다이얼 부분에는 끈적한 그리스가 발라져 있습니다.



중앙 처리하는 chip 은 판별할 수 없게 수지로 덮여 있네요. 아쉽.

Layout 을 보니, 원래 실장하기 위한 chip 은 좀 큰데, 대체 chip 을 사용한 듯 보입니다.

Chip 핀을 납땜하기 위한 접점이 노출되어 있어서, 개조가 가능하다면 쉽게 납땜할 수 있도록 되어 있네요.



신기하게도, LCD 와 접점은 flex 케이블이 아닌. 컨텍 동판입니다.

요즘은 잘 사용하지 않는 방식이라고 알고 있습니다. 아니면 LCD 자체가 이런 방식이라 그럴까요?



높은 연산 처리를 요구하는 것이 아니기에 4kHz 의 오실레이터로 움직이는 것을 알 수 있습니다. Chip 크기도 매우 작습니다.



테스터 프로브 꼽는 부분은 두껍게 되어 있습니다.

또한, 높은 전압이 걸릴 수 있으므로, 보호 퓨즈 2개와 shunt 저항이 달려있네요.



뒷판에 달려있는 저 스프링의 의도는 잘 모르겠습니다.

뒷판의 알루미늄 호일과 접촉하는데, 알루미늄 호일 자체가 어디와 연결된 것은 아니라서요. 차폐 용도인가?



궁금한게 많지만, 이 쪽 지식이 짧은지라, 구조와 실장된 부품들만 감상하고 그대로 재조립 합니다.




4. 강렬하게 구매하고 싶다


나중에 여유가 된다면, 다음 멀티미터기는 아래 제품을 구입해 보고 싶습니다.


목소리 카랑카랑한 영국 땜쟁이 아저씨가, 전 세계의 멀티미터를 까고 다니시다가, 본인이 직접 설계하고 제작한 멀티 미터 입니다.

Youtube 를 보면, 다른 멀티미터들을 얼마나 까대는지, 본인 것은 잘 만들었을 꺼라 생각이 듭니다.


* 121GW Multimeter

https://www.eevblog.com/product/121gw/




And

Hardware | lenovo X240 노트북 열 잡기

|

1. 증상


어느 날 부터 인가, 너Tube 를 볼 때, 화면이 끊기고 소리가 들렸다 안들려다 합니다.



사용하고 있는 laptop 은, 2014년에 만들어진 Lenovo X240 입니다.

Memory slot 도 하나라 8GB Ram 까지밖에 증설하지 못하며, Haswell 아키텍쳐에 laptop 용 CPU 지만, 그 동안 문제 없었거든요.


달라진 증상으론, 열 배출구에서 끊임없이 뜨거운 열기가 배출된다는 것이였습니다.

예전에는 뜨거웠다 아니였다 그랬는데, 이젠 계속 뜨거워.


이것은 필시, 열을 적절하게 배출되지 못해, 열이 계속 적체되면서 CPU에 쓰로틀이 나타나는 현상이라 생각했습니다.




2. 분해


CPU 써멀이 굳은게 원인이라고 생각하고, 필요한 써멀을 준비 후, 분해를 시작합니다.

써멀은 예전에 AliExpress 에서 구입해 놨던 녀석입니다.



시작은 뒷판의 나사를 전부 풀어 놓습니다.



모니터 힌지쪽이 잘 분리되지 않지만, 힘주지 않고 살살 달래면서 공간을 만들어 나가가 시작하면 뚝... 하고 분리됩니다.

힘을 주면서 분리하지 않는 것이 관건입니다.



목표 지점이 보이는군요.



CPU 를 덮고 있는 heat pipe 와 쿨링 팬 덩어리를 제거하면 됩니다.

주의사항은 전원선이 flex cable 로 되어 있으므로, 꺾이거나 찟어지지 않도록 살살...




3. 써멀 도포


Heat sink 뭉치를 제거하니 CPU 가 보입니다.



참 이쁘게도 thermal paste 를 발라 놨군요.



양쪽 모두 기존에 발라져 있는 써멀을 잘 닦아 줍니다. 그렇게 심하게 굳진 않았군요.

Heat pipe 오른쪽에 구멍이 뚤려 있는 이유는, south bridge 자리라서 별도 쿨링이 필요 없어서라고 합니다.


그래도 해주는게 좋지 않나? 하는 생각이 드네요.



새롭게 thermal paste 를 도포해 줍니다. 사진으로 보니 조금 과했군요. 

좀더 적은 양이어도 괜찮을 것 같습니다. CPU 위에 회로 보호 pad 가 붙어 있어서 맘 편하게 도포 했습니다.


오른쪽 die 는 south bridge 로 별도 쿨링하지 않아도 된다 합니다만, 그냥 했...



4. 소프트웨어 업데이트


조립은 분해의 역순.


혹시 오래된 드라이버 들이 말썽을 잃으키는게 아닌가,

특히 네트웍을 사용할 때 CPU 사용량이 느는 듯 하여, intel network driver 도 업데이트 해 줍니다.



Intel site 에서 최신을 받아 인스톨 하고, 제어판에서 다른 최신이 없나 재확인 해 봅니다.



일단, 이 문제 해결의 발단은, "너Tube 에서 시청 시, 소리가 끊김" 이었으므로, audio driver 도 업데이트 해 줍니다.





5. 결과


아래 그램은 너Tube 를 시청하는 중의 그래프 입니다.



천정에 붙어서 내려오질 않습니다.



위의 그래프는 Thermal paste 재도포 및 driver 업데이트 후의 그래프 입니다.

그래프가 천정을 치지만, 열 배출 효율화로 금방 다시 내려옵니다.


다만... 너Tube 의 소리 끊김은 여전하군요.




6. Windows Update


그러다 며칠 후, 새로운 Windows Update 가 떴습니다.

보안 문제도 있고 하니, 재깍재깍 업데이트 해 줍니다.



음? 너Tube 에서 소리 끊김이 사라졌습니다...

원인은 예전 Windows Update 가 문제였고, 이번 업데이트로 해결된것 같아요.


해결 되어서 기분은 좋지만, 뭔가 그렇습니다.

그래도 열 배출은 시원하게 되는 것 같아서, Lenovo X240 유저는 해볼만 한 작업이라 생각합니다.



And

Hardware | MAX30105 파티클 센서 - 1

|

1. 파티클 센서


인터넷을 돌아다니다 particle sensor 라는 것을 알게 되었습니다.

이게 단순히 공기중의 입자를 확인하는것 뿐만아니라, 혈중 농도 및 심전도까지 확인할 수 있다고 합니다.


나중에 도플러 효과를 이용한 원격 심전도 확인 시스템을 만들 예정이라,

기초적인 지식을 습득하기 위해 일단 이런 류의 센서 사용법을 익혀 보기로 합니다.






2. 주문


물론 AliExpress 에서 주문했습니다.


* CFsunbird High Accuracy I2C MAX30105 Particle Optical Sensor Photodetectors Board Module 1.8V power supply

https://ko.aliexpress.com/item/CFsunbird-High-Accuracy-I2C-MAX30105-Particle-Optical-Sensor-Photodetectors-Board-Module-1-8V-power-supply/32819571918.html




여타 센서류보다 단일 부품으로는 꽤나 비싼편 입니다.

이는 다양한 기능이 들어가 있으며, 기본 소자 자체가 좀 있어 보입니다.


SparkFun 에서 팔고 있는 제품인데, AliExpress 에서 구입하다 보니, 조금 변형된 중국 제품입니다.

단, 소스는 완벽하게 호환됩니다.


* SparkFun Particle Sensor Breakout - MAX30105

https://learn.sparkfun.com/tutorials/max30105-particle-and-pulse-ox-sensor-hookup-guide


보통 정식 제품보다는 AliExpress 가 싼 편인데, 이 제품은 자비가 없군요.

AliExpress 에서 약 12 USD, SparkFun 제품은 13 USD 정도 합니다.





3. 도착


크게 무리없이 2주만에 도착.



납땜이 되지 않은 상태로 배달이 됩니다. 이제 AliExpress 에서 오는 것은 이게 당연한 거죠?



핵심이 되는 센서 부품을 클로즈 업 해봤습니다.



범상치 않아 보이는군요.





4. 연결


Arduino 와의 연결은 다음과 같습니다.


 MAX30105 | Arduino Nano
-------------------------
    VCC   |     3.3V
    GND   |     GND
    SDL   |     A5
    SDA   |     A4
-------------------------


실제 회로 구성은 다음과 같습니다.

Fritzing 에서 그려 보는데, 아쉽게도 아직 Fritzing 에서는 MAX30105 부품이 리스트에 존재하지 않습니다.

아직 아무도 만들지 않았나 봅니다.



Datasheet 입니다 - MAX30105_3.pdf





5. sketch - Red, IR, Green reading


이후 나오는 소스는 모두 아래 site 를 참고하였습니다.


* SparkFun Particle Sensor Breakout - MAX30105

https://learn.sparkfun.com/tutorials/max30105-particle-and-pulse-ox-sensor-hookup-guide


Library 를 인스톨 하고 가장 간단한 스케치를 로드하여 확인해 봅니다.

소스는 소자의 기본 동작인 빨간색, 적외선, 녹색을 감지하고 수치화 하는 스케치 입니다.


File > Examples > MAX3010x Pulse and Proximity Sensor > Example1_Basic_Readings



실제 소스를 여기에 옮겨 봅니다.


/*
  MAX30105 Breakout: Output all the raw Red/IR/Green readings
  By: Nathan Seidle @ SparkFun Electronics
  Date: October 2nd, 2016
  https://github.com/sparkfun/MAX30105_Breakout

  Outputs all Red/IR/Green values.

  Hardware Connections (Breakoutboard to Arduino):
  -5V = 5V (3.3V is allowed)
  -GND = GND
  -SDA = A4 (or SDA)
  -SCL = A5 (or SCL)
  -INT = Not connected

  The MAX30105 Breakout can handle 5V or 3.3V I2C logic. We recommend powering the board with 5V
  but it will also run at 3.3V.

  This code is released under the [MIT License](http://opensource.org/licenses/MIT).
*/

#include "Wire.h"
#include "MAX30105.h"

MAX30105 particleSensor;

#define debug Serial //Uncomment this line if you're using an Uno or ESP
//#define debug SerialUSB //Uncomment this line if you're using a SAMD21

void setup() {
  debug.begin(9600);
  debug.println("MAX30105 Basic Readings Example");

  // Initialize sensor
  if (particleSensor.begin() == false)
  {
    debug.println("MAX30105 was not found. Please check wiring/power. ");
    while (1);
  }

  particleSensor.setup(); //Configure sensor. Use 6.4mA for LED drive
}

void loop() {
  debug.print(" R[");
  debug.print(particleSensor.getRed());
  debug.print("] IR[");
  debug.print(particleSensor.getIR());
  debug.print("] G[");
  debug.print(particleSensor.getGreen());
  debug.print("]");

  debug.println();
}


우선 구동을 시작하면, 녹색과 빨간색 빛이 빠르게 점멸합니다.



저렇게 빛을 쏜 다음 반사되는 값을 읽는것이겠죠?



손가락을 센서 근처로 가져가면 값의 변동이 일어납니다.


센서의 불빛을 슬로우 모션으로 9초동안 찍어 봤습니다.

그랬더니 51초짜리 동영상이 되었네요.



얼마나 빨리 점멸을 하는지, 슬로모션으로 찍어도 실제로 보는것과 그리 차이나지 않습니다.





6. sketch - 물체 인식


IR 의 delta 값을 이용하여 물체가 일정 이상 안에 들어와 있는지 없는지를 판단합니다.

소스는 아래 path 에서 확인할 수 있습니다.


File > Examples > MAX3010x Pulse and Proximity Sensor > Example2_Presense_Sensing






7. sketch - 온도


SparkFun 사에서 제공되는 library 에서 "readTemperature()" 함수를 그대로 이용한 것 입니다.

그럼 위의 함수는 어떻게 되느냐 하면 아래와 같습니다.


// Die Temperature
// Returns temp in C
float MAX30105::readTemperature() {
  // Step 1: Config die temperature register to take 1 temperature sample
  writeRegister8(_i2caddr, MAX30105_DIETEMPCONFIG, 0x01);

  // Poll for bit to clear, reading is then complete
  // Timeout after 100ms
  unsigned long startTime = millis();
  while (millis() - startTime < 100)
  {
    uint8_t response = readRegister8(_i2caddr, MAX30105_DIETEMPCONFIG);
    if ((response & 0x01) == 0) break; //We're done!
    delay(1); //Let's not over burden the I2C bus
  }
  //TODO How do we want to fail? With what type of error?
  //? if(millis() - startTime >= 100) return(-999.0);

  // Step 2: Read die temperature register (integer)
  int8_t tempInt = readRegister8(_i2caddr, MAX30105_DIETEMPINT);
  uint8_t tempFrac = readRegister8(_i2caddr, MAX30105_DIETEMPFRAC);

  // Step 3: Calculate temperature (datasheet pg. 23)
  return (float)tempInt + ((float)tempFrac * 0.0625);


센서 내부에 register 값을 읽어와서 표현하는 것이군요.

구동 소스는 아래 path 에서 확인할 수 있습니다.


File > Examples > MAX3010x Pulse and Proximity Sensor > Example3_Temperature_Sense







8. sketch - 심전도


손가락을 센서에 대고 있으면 심전도를 그려주는 소스 입니다.


File > Examples > MAX3010x Pulse and Proximity Sensor > Example4_HeartBeat_Plotter


읽어들인 IR 값에 대한 변화를 plottor 을 이용해 그려주는 것이죠.
소스를 보면 setup 과 기준값 등을 정해주는 부분이 있을 뿐, 단순히 IR 값을 불러옵니다.

아래처럼 보려면, Tools > Serial Plotter 를 통해서 확인할 수 있습니다.


저의 심전도 모양입니다. 두근두근...





9. sketch - 심박수


대체로 심전도와 비슷한데, 이걸 1분에 몇분 정도 뛰는지를 확인해 주는 소스 입니다.

보통 병원이나 건강검진시 확인해 보는 심박수 겠죠?


구동 소스는 아래 path 에서 확인할 수 있습니다.


File > Examples > MAX3010x Pulse and Proximity Sensor > Example5_HeartRate







FIN


MAX30105 센서는 주로, 심박수 모니터링에 사용되는게 가장 적절해 보입니다.

인터넷에서 어느 분이, 이와 비슷한 센서를 이용하여 심박수를 OLED 에 표시해주는 것까지 해놓은 글이 아래 입니다.


* Heart beat Sensor and “ECG” Display

http://www.xtronical.com/basics/heart-beat-sensor-ecg-display/


저도 따라해 봤는데,

일단 센서에서 나오는 값 자체가 MAX30105 처럼 큰 값으로 나오지 않을 뿐더러,

값의 변화가 딱 OLED 크기만큼 잘 구현이 되어 있어서 잘 하신것 같은데, 도저히 따라해도 안되는군요.



겨우겨우 우겨 넣어서 OLED 에 보여주는 것 까지는 해 봤습니다.

이것 가지고는 만족스럽지 못하여, 못하는 코딩을 이용하여 한번 도전해 보겠습니다.


병원에서 보는 듯 한 모습으로 될 때까지 만들어서 공유해 볼께요.



And

Hardware | MAX31865 + PT100 온도센서 조합

|

1. MAX31865


K-Type 온도 센서를 arduino 와 연결하여 측정하는 MAX31855 은 아래 포스팅에서 가지고 놀아 봤습니다.


* Hardware | MAX31855 + K-type 온도센서 조합

http://chocoball.tistory.com/entry/Hardware-MAX31855-Ktype


그 외의 온도센서에 대해서는 아래 포스트들을 참고해보세요.


* Hardware | AM2322 Temperature & Humidity Sensor

http://chocoball.tistory.com/entry/Hardware-AM2322-Temperature-Humidity-Sensor


* Hardware | Arduino 비접촉 온도센서 GY-906 MLX90614

http://chocoball.tistory.com/entry/HardwareArduinoMLX90614


* Hardware | Arduino BMP280 고도/온도/기압 센서

http://chocoball.tistory.com/entry/HardwareArduinoBMP280


* Hardware | BME280 sensor

http://chocoball.tistory.com/entry/HardwareBME280


* Hardware | DS18B20 온도센서

http://chocoball.tistory.com/entry/Hardware-DS18B20-temperature-sensor


여기서 주의할 점은, MAX31865은 MAX31855와 제일 마지막 앞번의 digit 차이 입니다.

주문시 주의해야 합니다.


* MAX31865 : PT100 / PT1000 용

* MAX31855 : K-type 용





2. MAX31865 구입


AliExpress 에서 검색하면 아래의 링크가 가장 많이 구입한걸로 나옵니다.

바로 주문 넣습니다.


* MAX31865 SPI PT100/PT1000 RTD-to-Digital Converter Board Temperature Thermocouple Sensor Amplifier Module For Arduino 3.3V/5V

https://ko.aliexpress.com/item/MAX31865-PT100-PT1000-RTD-to-Digital-Converter-Board-Temperature-Thermocouple-Sensor-Amplifier-BModule-For-Arduino/32777498066.html







3. 도착


다른 센서들보다는 조금 높은 가격입니다.

그러나 업자는 항상 1 USD 미만으로 보내주십니다. :-)



포장은 일반적인 간단한 포장입니다.



Adafruit 제품과 거의 동일하게 만들었습니다.



Chip 을 확대해 봤습니다.

Taiwan 에서 생산된 M31865 라고 인쇄되어 있습니다.



Pin array 와 terminal 을 납땜해 줍니다.

Rref 의 저항은 431 = 430 ohm 입니다.





4. Thermocouple K-Type 구매하기


MAX31865 를 구입하면서, 거의 동시에 온도 센서도 주문에 넣습니다.


* Thermocouple K-Type Thermocouple Thermometer Probe WRNT-03 200mm*1000mm

https://ko.aliexpress.com/item/Thermocouple-K-Type-Thermocouple-Thermometer-Probe-WRNT-03-200mm-1000mm/32615649856.html



분명히 K-Type 이라고 적혀 있습니다.



Probe 형이라 길이가 깁니다. 포장도 큼지막 합니다.



뽁뽁이로 잘 쌓여서 도착했습니다.



음? CU50?



이미 MAX31855 글에서도 CU50 에 대해서 적었습니다.


MAX31865 / MAX31855 의 개념이 없었고, K-Type / PT100 / PT1000 개념도 없이 처음 질렀던 온도계 센서 입니다.

더욱 헷갈리게 된 것은, K-Type 이라고 주문한게 CU50 이 도착해, 처음 한동안은 뭐가 문제인지 몰랐습니다.


그 뒤에 센서 및 coverter chip 종류가 다르다는걸 알았죠.


* CU50 / WRNT-03 spec.

K1118591875.pdf



뭘 모르면 알때까지 삽질해야 하는 것은 인생의 진리 입니다.





5. PT100 구입하기


MAX31865 는 PT100 / PT1000 용 analog to digital converter 입니다.

PT1000 은 예민하면서 실험실용으로 사용되고 있어서, PT100 을 선택합니다.


* MYLB-0-400C PT100 Type 5mm x 50mm Temperature Controller Thermocouple Probe 2 Meters

https://ko.aliexpress.com/item/MYLB-0-400C-PT100-Type-5mm-x-50mm-Temperature-Controller-Thermocouple-Probe-2-Meters/32746546570.html




점점 진실에 접근하는 느낌이 듭니다.



도착.




포장 문제 없슴.

선은 3 wire 센서 이군요.



흠흠.



색이 다른 터미널끼리는 거의 100 ohm 의 차이를 보입니다.

이는 PT100 의 일반적인 현상이며, 더운 여름에 측정하다 보니 저항값이 조금 높습니다.


이 저항값의 변화를 가지고 온도를 측정하는 것입니다.



동일 선끼리는 거의 0 ohm 입니다.





6. Pinout / Layout


Pinout 에 대해서는 아래 Adafruit 의 링크를 참조해 보세요.


* Adafruit MAX31865 RTD PT100 or PT1000 Amplifier

https://learn.adafruit.com/adafruit-max31865-rtd-pt100-amplifier/pinouts


 MAX31865  | Arduino Micro
---------------------------
    Vin    |      3.3V
    GND    |      GND
    CLK    |      D13
    SDO    |      D12
    SDI    |      D11
    CS     |      D10
---------------------------


Layout 입니다.






7. sketch


레퍼런스 소스를 이용해서 기본적인 동작 확인에 들어갑니다.

우선 Library Manager 에서 max31865 를 검색해서 install 해줍니다.



인스톨이 완료되면, "File > Examples > Adafruit MAX31865 library > max31865" 을 선택하여 소스를 로딩합니다.



아래는 sketch 입니다.


/*************************************************** 
  This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865

  Designed specifically to work with the Adafruit RTD Sensor
  ----> https://www.adafruit.com/products/3328

  This sensor uses SPI to communicate, 4 pins are required to  
  interface
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include 

// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 max = Adafruit_MAX31865(10, 11, 12, 13);
// use hardware SPI, just pass in the CS pin
//Adafruit_MAX31865 max = Adafruit_MAX31865(10);

// The value of the Rref resistor. Use 430.0 for PT100 and 4300.0 for PT1000
#define RREF      430.0
// The 'nominal' 0-degrees-C resistance of the sensor
// 100.0 for PT100, 1000.0 for PT1000
#define RNOMINAL  100.0

void setup() {
  Serial.begin(115200);
  Serial.println("Adafruit MAX31865 PT100 Sensor Test!");

  max.begin(MAX31865_3WIRE);  // set to 2WIRE or 4WIRE as necessary
}


void loop() {
  uint16_t rtd = max.readRTD();

  Serial.print("RTD value: "); Serial.println(rtd);
  float ratio = rtd;
  ratio /= 32768;
  Serial.print("Ratio = "); Serial.println(ratio,8);
  Serial.print("Resistance = "); Serial.println(RREF*ratio,8);
  Serial.print("Temperature = "); Serial.println(max.temperature(RNOMINAL, RREF));

  // Check and print any faults
  uint8_t fault = max.readFault();
  if (fault) {
    Serial.print("Fault 0x"); Serial.println(fault, HEX);
    if (fault & MAX31865_FAULT_HIGHTHRESH) {
      Serial.println("RTD High Threshold"); 
    }
    if (fault & MAX31865_FAULT_LOWTHRESH) {
      Serial.println("RTD Low Threshold"); 
    }
    if (fault & MAX31865_FAULT_REFINLOW) {
      Serial.println("REFIN- > 0.85 x Bias"); 
    }
    if (fault & MAX31865_FAULT_REFINHIGH) {
      Serial.println("REFIN- < 0.85 x Bias - FORCE- open"); 
    }
    if (fault & MAX31865_FAULT_RTDINLOW) {
      Serial.println("RTDIN- < 0.85 x Bias - FORCE- open"); 
    }
    if (fault & MAX31865_FAULT_OVUV) {
      Serial.println("Under/Over voltage"); 
    }
    max.clearFault();
  }
  Serial.println();
  delay(1000);
}


결과는 아래와 같습니다.



뭔가 많이 이상하군요... 뭐가 문제일까...





8. Jumper !!!


그렇습니다.

Adafruit 의 점퍼 설정을 대충 읽은 결과 입니다.



위의 글에 나와 있듯이, 미세하게 연결된 24 부분의 선을 잘라줘야 합니다.

시키는 대로 했으나 제대로 되지 않았습니다.


처음에는 CU50 으로 삽질하면서 2 wire 설정으로 납땜 했다가, 납 지워줬다가, 3 wire 설정으로 다시 납땜 했다가,

기판이 지저분해진 상태이고, 자주 인두로 지져서 기판 상태가 엉망으로 되면서 고장난게 분명하다는 결론에 도달했습니다.

(모두 합하면 10시간동안 삽질함)





9. 재구매


breakout 보드값이 비싸지만, 모든걸 다 해본 뒤라 새로운 converter 를 구입하기로 합니다.

이번에는 색이 다른것으로 구입합니다.


배송료 합하면 거의 6천원이군요... ㅠ.ㅠ


* 31865 MAX31865 RTD platinum resistance temperature detector module PT100 to PT1000

https://www.aliexpress.com/item/31865-MAX31865-RTD-platinum-resistance-temperature-detector-module-PT100-to-PT1000/32814557294.html



잘 도착했습니다. 얼른 시험해보고 싶습니다.



점퍼 사시의 간극이 커서 잘 납땜해야 합니다.



Rref 저항은 430 ohm 으로 동일하며, 2 4 사이에 미세하게 연결되어 있는것도 확인했습니다.

커터로 잘 그어서 절단해 줍니다.



두둥!

잘 연결하고 확인해 봅니다.



Aㅏ.....

그렇습니다. 여러 삽질을 하는 동안, 기존 breakout 기판이 고장난 것이었습니다.

그간 삽질하면서 학습한 내용을 토대로 잘 jumper 도 납땜하고, 자를껀 자르고 연결하니 한방에 성공합니다.



애증의 MAX31865 와 PT100 센서 입니다.



찬물 / 상온 물 / 뜨거운 물을 가지고 확인한 동영상 입니다.

calibration 이 필요해 보이지만, 그딴거는 나중에 기회되면 하겠습니다.

여기까지 오는것만 해도 힘들었습니다.



그래프화 시킨 그림입니다.

동작에 무리 없어 보입니다.





FIN


제가 가지고 있는 온도센서 및 converter breakout 보드는 다 확인해 봤네요.

CU50 만 빼고... 이놈은 어떻게 해야 할까요.


And

Hardware | MAX31855 + K-type 온도센서 조합

|

1. 또 온도센서야?


지금까지 시험해본 온도센서들 입니다. 5개나 있네요.


* Hardware | AM2322 Temperature & Humidity Sensor

http://chocoball.tistory.com/entry/Hardware-AM2322-Temperature-Humidity-Sensor


* Hardware | Arduino 비접촉 온도센서 GY-906 MLX90614

http://chocoball.tistory.com/entry/HardwareArduinoMLX90614


* Hardware | Arduino BMP280 고도/온도/기압 센서

http://chocoball.tistory.com/entry/HardwareArduinoBMP280


* Hardware | BME280 sensor

http://chocoball.tistory.com/entry/HardwareBME280


* Hardware | DS18B20 온도센서

http://chocoball.tistory.com/entry/Hardware-DS18B20-temperature-sensor



* Hardware | AM2322 Temperature & Humidity Sensor

http://chocoball.tistory.com/entry/Hardware-AM2322-Temperature-Humidity-Sensor


* Hardware | Arduino 비접촉 온도센서 GY-906 MLX90614

http://chocoball.tistory.com/entry/HardwareArduinoMLX90614


* Hardware | Arduino BMP280 고도/온도/기압 센서

- http://chocoball.tistory.com/entry/HardwareArduinoBMP280


* Hardware | BME280 sensor

- http://chocoball.tistory.com/entry/HardwareBME280



출처: http://chocoball.tistory.com/entry/Hardware-DS18B20-temperature-sensor [초코볼의 inside Tech]


* Hardware | AM2322 Temperature & Humidity Sensor

http://chocoball.tistory.com/entry/Hardware-AM2322-Temperature-Humidity-Sensor


* Hardware | Arduino 비접촉 온도센서 GY-906 MLX90614

http://chocoball.tistory.com/entry/HardwareArduinoMLX90614


* Hardware | Arduino BMP280 고도/온도/기압 센서

- http://chocoball.tistory.com/entry/HardwareArduinoBMP280


* Hardware | BME280 sensor

- http://chocoball.tistory.com/entry/HardwareBME280



출처: http://chocoball.tistory.com/entry/Hardware-DS18B20-temperature-sensor [초코볼의 inside Tech]

* Hardware | AM2322 Temperature & Humidity Sensor

http://chocoball.tistory.com/entry/Hardware-AM2322-Temperature-Humidity-Sensor


* Hardware | Arduino 비접촉 온도센서 GY-906 MLX90614

http://chocoball.tistory.com/entry/HardwareArduinoMLX90614


* Hardware | Arduino BMP280 고도/온도/기압 센서

- http://chocoball.tistory.com/entry/HardwareArduinoBMP280


* Hardware | BME280 sensor

- http://chocoball.tistory.com/entry/HardwareBME280



출처: http://chocoball.tistory.com/entry/Hardware-DS18B20-temperature-sensor [초코볼의 inside Tech]


* Hardware | AM2322 Temperature & Humidity Sensor

http://chocoball.tistory.com/entry/Hardware-AM2322-Temperature-Humidity-Sensor


* Hardware | Arduino 비접촉 온도센서 GY-906 MLX90614

http://chocoball.tistory.com/entry/HardwareArduinoMLX90614


* Hardware | Arduino BMP280 고도/온도/기압 센서

- http://chocoball.tistory.com/entry/HardwareArduinoBMP280


* Hardware | BME280 sensor

- http://chocoball.tistory.com/entry/HardwareBME280



출처: http://chocoball.tistory.com/entry/Hardware-DS18B20-temperature-sensor [초코볼의 inside Tech]

네 그렇습니다.

온도 센서에는 기존에 확인했던 위의 센서들 말고, 준비하고 있는게 아래 3가지가 있습니다.


- K-type

- PT100 / PT100

- Cu50


이 포스트에서는 K-Type 에 대해 알아보려 합니다.





2. K-type


이번에는 K-type 온도센서 이므로, 해당의 제품을 구매합니다.


* Thermocouple K-Type Thermocouple Thermometer Probe WRNT-03 200mm*1000mm

https://www.aliexpress.com/item/Thermocouple-K-Type-Thermocouple-Thermometer-Probe-WRNT-03-200mm-1000mm/32615649856.html



일반적으로 Thermocouple K-type 은 선이 두가닥인데, 도착한 놈은 세가닥 입니다.

거기에 더해서 "Cu50" 이라는 라벨도 붙어 있습니다...


분명 난, K-Type 을 보고 주문한건데 말입니다.

사양서도 확인해 보면 WRNT-03 이라서 Probe type 의 thermocouple 이라고 생각했습니다만, 도착한건 그냥 Cu50 인듯 합니다..



세가닥 단자들 사이는 55 Ohm / 0 Ohm 의 차이를 보입니다.

100 Ohm 정도면 PT100 인데, 55 Ohm 이면 좀 애매하네요.



확실히 잘 사용되지 않는 Cu50 이 맞는 듯 합니다.

이놈은 이놈 나름대로 사용될 수 있는 방법을 찾아봐야겠습니다.



음?

테스터기로 측정하고 있을 때 눈에 들어오는 테스터용 온도 probe !!!



위 사진의 오른쪽 다발로 보이는 것이 테스터용 온도 센서 입니다.



혹시나? 하고 메뉴얼을 찾아 보니 "K-type" 이라고 적혀 있네요!



우연히 K-Type 온도센서를 구할 수 있게 되었습니다.

역시 K-Type 은 단자가 2개인게 확실합니다.





3. MAX31855


보통 온도 센서들은 아날로그 값으로 표현하므로, digital 로 변환해주는 converter 가 필요합니다.

K-Type 온도센서용으로는 MAX31855 라고 하는군요.


Arduino 용 K-Type 모듈인 MAX31855 를 구입합니다.


* MAX31855 MAX6675 SPI Type K Thermocouple Temperature Sensor Board Module For Arduino

https://ko.aliexpress.com/item/MAX31855-K-Type-Thermocouple-Breakout-Board-Temperature-200C-to-1350-Celsius-for-Arduino/32746337946.html



아래는 도착 사진 입니다.



친절하게 알아서 사용하라는 중국 생산자의 배려 입니다.



기록을 위해 뒷면도 찰칵.






4. sketch


Arduino IDE 에서 Library Manger 를 열고 max 라는 키워드로 검색하면, MAX31855 가 나옵니다.

인스톨 하세요.



패키지 인스톨 후, "File > Examples > Adafruit MAX31855 library > serialthermocouple" 을 선택합니다.



Sketch 는 다음과 같아요.


/*************************************************** 
  This is an example for the Adafruit Thermocouple Sensor w/MAX31855K

  Designed specifically to work with the Adafruit Thermocouple Sensor
  ----> https://www.adafruit.com/products/269

  These displays use SPI to communicate, 3 pins are required to  
  interface
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include "SPI.h"
#include "Adafruit_MAX31855.h"

// Default connection is using software SPI, but comment and uncomment one of
// the two examples below to switch between software SPI and hardware SPI:

// Example creating a thermocouple instance with software SPI on any three
// digital IO pins.
#define MAXDO   3
#define MAXCS   4
#define MAXCLK  5

// initialize the Thermocouple
Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);

// Example creating a thermocouple instance with hardware SPI
// on a given CS pin.
//#define MAXCS   10
//Adafruit_MAX31855 thermocouple(MAXCS);

void setup() {
  while (!Serial); // wait for Serial on Leonardo/Zero, etc
  
  Serial.begin(9600);
  
  Serial.println("MAX31855 test");
  // wait for MAX chip to stabilize
  delay(500);
}

void loop() {
  // basic readout test, just print the current temp
   Serial.print("Internal Temp = ");
   Serial.println(thermocouple.readInternal());

   double c = thermocouple.readCelsius();
   if (isnan(c)) {
     Serial.println("Something wrong with thermocouple!");
   } else {
     Serial.print("C = "); 
     Serial.println(c);
   }
   //Serial.print("F = ");
   //Serial.println(thermocouple.readFarenheit());
 
   delay(1000);
}



음? 정상적으로 동작하지 않는군요.

혹시 몰라 MAX31855 의 전 버전인 MAX6675 라이브러리를 설치하고 sketch 를 실행시켜 봅니다.



음... 안되는군요.

뭐가 문제일까요?





5. 중국 공장의 나쁜 버릇


폭풍 검색을 해도 문제를 해결한 케이스를 볼 수 없다가,

우연히 Youtube 의 댓글에서 힌트를 찾았습니다.


MAX6675 와 MAX31855 breakout 보드의 차이점은 1번과 2번 pin 이 연결되어 있느냐 없느냐의 차이라고 합니다.



제가 구입한 MAX31855 breakout 보드의 1번과 2번을 보니 붙어 있네요.



위는 MAX6675 의 breakout board 의 layout 입니다.

1번과 2번이 연결되어 있네요.



MAX31855 의 breakout board 의 1번 / 2번 pin 은 서로 붙어있지 않습니다.



Adafruit 의 정식 판매용 MAX31855 breakout board 도 1번 / 2번 pin 도 떨어져 있습니다.



위의 사진은 중국 AliExpress 제품의 소개 사진입니다.

Chip 은 MAX31855 지만, breakout board 는 전압 regulator 도 없는 MAX6675 용 breakout board 와 비슷합니다.


즉, 중국 업자들은 기존 MAX6675 breakout board 에,

스펙이 비슷한 MAX31855 chip 을 얹은게 아닌가 하는게 internet 친구들의 예상입니다.


MAX31855 는 minus 온도까지 측정할 수 있는 등 upgrade 되었으나,

MAX6675 breakout board 를 사용하면서 기능 확장도 안되고, pinout spec. 에 맞지 않게 된거죠.


쉽게 말하면,

upgrade 제품이니까 맞겠지 하고 MAX6675 breakout board 에 MAX31855 를 얹으면서 정상작동하지 않는 것이였습니다.

(이거 팔아도 되는거야? 구매한 다른사람들은 어떻게 사용한거지?)



결국 위의 사진처럼 1번/2번 pin 사이의 연결을 완전히 긁어 내어 단락시키니 정상 작동하였습니다.

아놔....





6. K-Type +/- 단자 사이에 capacitor


해결점을 찾아서 정상 작동까지는 왔으나,

값이 널을 뛰어 안정적으로 측정하지 못했습니다.



위에서 보듯이 많은 사람들이 단자에 capacitor 를 사용했더랬습니다.


* Hardware | AliExpress 에서 Ceramic Condenser 를 구입해 보자

http://chocoball.tistory.com/entry/Hardware-AliExpress-Ceramic-Condenser-buying


뭘 하려면 여러가지가 구비되어야 하는군요.

다행이 ceramic capacitor (condenser) 가 있었습니다.



사용된 것은 10nF = 0.01uF 입니다.



Capacitor 를 연결하고서야 안정적으로 값을 확인할 수 있었습니다.





7. Pinout / Layout


Pinout 은 다음과 같습니다.


 MAX31855  | Arduino Micro
---------------------------
    Vin    |      5V
    GND    |      GND
    DO     |      D3
    CS     |      D4
    CLK    |      D5
---------------------------



구성도는 다음과 같습니다.



실제 사진입니다.






8. 결과


이제서야 제대로 측정이 되었습니다.

chip 자체적으로 Internal Temp 를 측정 가능한게 신시합니다.



여름 저녁이라 거실 실내 온도가 31도군요.

올해는 더워도 너무 덥습니다. 1994년도 5월에 입대하고 기초훈련 받던 때가 생각나네요.

그때도 이만큼 더웠던것 같습니다. 유격훈련 한번 하고 나면 동기들이 탈진해서 쓰러지곤 했더랬습니다.


우리 기수, 다른 중대 훈련병 중에 행군중 탈진으로 죽은 전우가 있어,

저의 다음 기수부터는 행군을 생략했다는 이야기를 들었습니다.

저의 행군 중에도, 옆에서 쓰러진 동기는 흰자위를 보이며 땅바닥에서 경련을 일으킬 정도로 극한의 날씨였습니다.



위는 K-type thermocouple 에 라이터 불로 온도를 높혔을 때를 동영상으로 찍어 봤습니다.



EXCEL 의 그래프 작업으로 internal / sensor 의 온도변화를 그래프로 표현해 봤습니다.

흠흠, 잘 변화를 감지했군요.





FIN


제대로 함정을 밟았지만, 잘 헤쳐나온것 같습니다.

Breakout board 는 되도록 reference (Adafruit / Sparkfun) 과 잘 비교해 본 다음, 문제가 없어보이면 구입하는게 좋을것 같습니다.


And

Hardware | DS18B20 온도센서

|

1. 온도 센서

지금까지 온도센서를 4개 구동시켜 봤습니다.


* Hardware | AM2322 Temperature & Humidity Sensor

http://chocoball.tistory.com/entry/Hardware-AM2322-Temperature-Humidity-Sensor


* Hardware | Arduino 비접촉 온도센서 GY-906 MLX90614

http://chocoball.tistory.com/entry/HardwareArduinoMLX90614


* Hardware | Arduino BMP280 고도/온도/기압 센서

- http://chocoball.tistory.com/entry/HardwareArduinoBMP280


* Hardware | BME280 sensor

- http://chocoball.tistory.com/entry/HardwareBME280


온도라는 것은 생물이 살아가는 지구 환경의 특성을 나타내주는 중요한 바로메터 이기 때문에

시장에는 사용 용도에 따라서 여러 센서가 존재하는 듯 합니다.


이제 5번째 센서를 구동시켜보기로 합니다.




2. 수온 측정용 온도센서

물의 온도를 측정하기 위해서는 방수가 되어야 합니다.

알루미늄 방수캡으로 커버된 온도센서가 "DS18B20" 입니다.


원래는 아래 그림처럼 Dallas사에서 만든 세발달린 칩으로 되어 있습니다.



그것을 알루미늄 캡과 고무로 실링을 한 제품입니다.



데이터쉬트는 다음과 같습니다.


DS18B20.pdf


사양을 보면, 중간에 저항을 넣어줘야 하는 군요.

센서가 타버리지 않게 꼭 저항을 챙기도록 합니다.





3. 주문

오늘도 AliExpress 에서 구매합니다.


https://ko.aliexpress.com/item/1pcs-DS18B20-Stainless-steel-package-1-meters-waterproof-DS18b20-temperature-probe-temperature-sensor/32467815969.html





4. Layout

데이터쉬트에 표기되어 있듯이 "저항"을 꼭 챙기도록 합니다.



Datasheet 를 보면 3~5V 에서 구동한다고 되어 있으므로, Arduino Nano 에서는 3.3V 단자에 연결했습니다.


  DS18B20 | Arduino Nano
------------------------------
   Black  |     GND
    Red   |     3.3V (4.7k Ohms)
   White  |     D2 (4.7k Ohms)
------------------------------


빵판 모습은 다음과 같습니다.



Pullup 저항도 달아 줍니다. 이 pullup 저항이 왜 중요한지는 이 글의 마지막에 적어 놨습니다.

AliExpress 에서 구매한것 치고 4.7k Ohms 는 꽤나 정확하네요.



미지근한 물, 냉장고의 물, 급탕기로 뎁힌 뜨거운 물을 준비합니다.

자, 이제 준비 완료 입니다.







5. IDE Sketch

유명한 센서라서 여러 사이트에서 소개되고 있습니다.


가장 간단한 스케치는 다음과 같습니다.

https://create.arduino.cc/projecthub/TheGadgetBoy/ds18b20-digital-temperature-sensor-and-arduino-9cc806


- OneWire Library : https://github.com/PaulStoffregen/OneWire

- DallasTemperature Library : https://github.com/milesburton/Arduino-Temperature-Control-Library


/********************************************************************/
// First we include the libraries
#include <OneWire.h>
#include <DallasTemperature.h>
/********************************************************************/
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
/********************************************************************/
// Setup a oneWire instance to communicate with any OneWire devices 
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
/********************************************************************/
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
/********************************************************************/
void setup(void)
{
 // start serial port
 Serial.begin(9600);
 Serial.println("Dallas Temperature IC Control Library Demo");
 // Start up the library
 sensors.begin();
}
void loop(void)
{
 // call sensors.requestTemperatures() to issue a global temperature
 // request to all devices on the bus
/********************************************************************/
 Serial.print(" Requesting temperatures...");
 sensors.requestTemperatures(); // Send the command to get temperature readings
 Serial.println("DONE");
/********************************************************************/
 Serial.print("Temperature is: ");
 Serial.print(sensors.getTempCByIndex(0)); // Why "byIndex"? 
   // You can have more than one DS18B20 on the same bus. 
   // 0 refers to the first IC on the wire
   delay(1000);
}



cactus.io 에서 제품 자체의 시리얼 넘버까지 친절하게 보여주는 소스는 다음과 같습니다.

http://cactus.io/hookups/sensors/temperature-humidity/ds18b20/hookup-arduino-to-ds18b20-temperature-sensor


"cactus_io_DS18B20.h" 라이브러리는 다음 링크에서 다운받으면 됩니다.

cactus_io_DS18B20.zip


/* Example sketch for Maxim Integrated DS18B20 temperature sensor Written by cactus.io, and requires the cactus_io_DS18B20 library. This sketch was tested using the Adafruit Prewired DS18B20 Sensor. For hookup details using this sensor then visit http://cactus.io/hookups/sensors/temperature-humidity/ds18b20/hookup-arduino-to-ds18b20-temperature-sensor */ #include <cactus_io_DS18B20.h> int DS18B20_Pin = 2; //DS18S20 Signal pin on digital 2 // Create DS18B20 object DS18B20 ds(DS18B20_Pin); void setup() { ds.readSensor(); Serial.begin(9600); Serial.println("Maxim Integrated DS18B20 Temperature Sensor | cactus.io"); Serial.println("DS18B20 Serial Number: "); // we pass the serial number byte array into the printSerialNumber function printSerialNumber(ds.getSerialNumber()); Serial.println(""); Serial.println(""); Serial.println("Temp (C)\tTemp (F)"); } void loop() { ds.readSensor(); Serial.print(ds.getTemperature_C()); Serial.print(" *C\t"); Serial.print(ds.getTemperature_F()); Serial.println(" *F"); // Add a 2 second delay. delay(2000); } // We call this function to display the DS18B20 serial number. // It takes an array of bytes for printing void printSerialNumber(byte *addr) { byte i; for( i = 0; i < 8; i++) { Serial.print("0x"); if (addr[i] < 16) { Serial.print('0'); } Serial.print(addr[i], HEX); if (i < 7) { Serial.print(", "); } } }




6. 결과

실제로 "실내 공기 > 미지근한 물 > 냉장고의 차가운 물 > 급탕기로 뎁힌 물" 을 차례로 측정한 온도 변화 입니다.



동영상으로도 찍어 봤습니다.



전체 과정은 아래 동영상 입니다.



잘 되네요!




7. 주의

처음에 GND 와 VCC를 서로 바꿔 연결했더니만, 온도센서쪽이 불덩이가 되었습니다.

잠깐 만지기만 해도 손이 데일 정도였으니, 100도이상 순식간에 올라갔던 것 같습니다.


다행이 식힌 다음 제대로 연결했더니 센서 동작에는 문제가 없었습니다.

다른 센서들은 핀 연결을 잘못해도 문제가 생길 여지가 없는데, 이 센서는 왜 pullup 저항을 달아 놓는지 조금 이해가 갈 것 같습니다.




FIN

5개째 온돈세서 구동기였습니다.

더이상 다른 온도 센서는 없겠지?


And

Hardware | AM2322 Temperature & Humidity Sensor

|

1. 온도 센서

온도를 측정할 수 있는 센서는 매우 다양하게 있습니다.

아래 링크들은 지금까지 실험해본 센서들 입니다.


* Hardware | Arduino BMP280 고도/온도/기압 센서

http://chocoball.tistory.com/entry/HardwareArduinoBMP280


* Hardware | BME280 sensor

http://chocoball.tistory.com/entry/HardwareBME280


* Hardware | Arduino 비접촉 온도센서 GY-906 MLX90614

http://chocoball.tistory.com/entry/HardwareArduinoMLX90614



생각보다 온도 센서들이 다양하게 있습니다.

그러던 중 SHT 계얄과 AM 계열이 또 있다는 것을 알게 되었죠.


그럼 어떤게 더 좋을까 찾아 봤습니다.

정확면에서는 AM 계열이 좋다는 글을 어디선가 보았습니다.


각 온도 센서들을 비교한 사이트도 있습니다만, AM 계열은 다루기가 까다롭다는 것을 알 수 있었습니다.

(측정을 위해 연속 측정하지 않고, reset 해야 하는 등)


http://3. - https://www.kandrsmith.org/RJS/Misc/Hygrometers/calib_many.html


그렇다면, 일단 AM2321 을 구입하기로 하고 AliExpress 를 뒤져 봅니다.


옷!!!

새로운 버전인 AM2322가 나와 있네요.


https://ko.aliexpress.com/item/1pcs-AM2321-digital-temperature-and-humidity-sensors-can-replace-SHT21-SHT10-SHT11/32324748233.html



센서 계열에서 3 USD 이상이면 고가에 속합니다.

하지만 구입합니다. 당연히 배송은 무료 입니다.




2. 도착

약 한달 반 정도 걸린것 같습니다.

오래 기다렸네요.


받고 바로 드는 생각은, "작다" 였습니다.




보통 빵판의 핀 사이의 거리가 "2.54 mm" 인데, 이 센서의 다리 간격이 "1.27 mm" 입니다.

연결을 어떻게 해야할지 고민됩니다.


결국 adapter 를 살까 하다가, 주문하고 기다리는 것을 참을 수가 없어 다리를 구부리기로 합니다.

까딱 잘못하다가는 다리가 날라갈 수가 있습니다.


참고로 1.27 to 2.54 어뎁터는 아래 사이트에서 판매합니다. (거의 안파는 듯)


http://www.proto-advantage.com/store/product_info.php?products_id=2700037



향후를 위해서는 꼭 구하고 십지만, 7 USD 입니다. 배보다 배꼽이 더 큰 현실.




3. Spec.

스펙은 아래 datasheet 를 참고하세요.


AM2322_datasheet.pdf


이번 계기로, 중국어 공부에 대해서 심각하게 고민하게 되었습니다.


다행히 AM2320 에 대한 자료나 소스는 많아서, 비슷하다고 생각하고 진행해 봅니다.




4. Layout

Pin 배열은 다음과 같습니다.

판매자 사이트에 설명이 나와 있습니다.


  AM2322 | Arduino Nano
-------------------------
   Pin 1 |     3.3V
   Pin 2 |      A4
   Pin 3 |     GND
   Pin 4 |      A5
-------------------------



보드 구성은 다음과 같아요.



리드선의 피치가 작아서 아래처럼 할수 없이 다리들을 엇갈리게 구부렸습니다.




다리를 서로 간섭이 안생기도록 벌리고, 클립으로 리드선과 연결해 주었습니다.



최종 연결한 모습 입니다.

불안하게 연결되어 있어서 센서와의 통신도 자주 끊겨버리네요.


일단 동작 확인이 우선이므로, 정식으로 프로젝트 한다면 어뎁터가 꼭 있어야겠습니다.







5. Source

소스 코드는 아래 사이트를 참고하였습니다.


http://www.instructables.com/id/Connecting-AM2320-With-Arduino/


#include 
#include 
AM2320 th;

void setup() {
  Serial.begin(9600);
}

void loop() {
  switch(th.Read()) {
    case 2:
      Serial.println("CRC failed");
      break;
    case 1:
      Serial.println("Sensor offline");
      break;
    case 0:
      Serial.print("humidity: ");
      Serial.print(th.h);
      Serial.print("%, temperature: ");
      Serial.print(th.t);
      Serial.println("*C");
      break;
  }

  delay(200);
}


위의 사이트 말고도 여러 사이트를 참고하실 수 있습니다.


https://github.com/hibikiledo/AM2320

https://github.com/Ten04031977/AM2320-master




6. 결과

IDE 의 Sensor Monitor 를 통해 본 결과 입니다.



결과가 잘 나옵니다.

습도가 점점 올라가는 것은, 예상 하셨듯 입김을 불어 넣어준 결과 입니다. 잘 반응하네요.






FIN

어? 또다른 온도 센서가 하나 더 있네 ?!!!



And

Hardware | BME280 sensor

|

1. 시작하기

BMP280 을 구동시키면서 googling 해보면, "Humidity = 습도" 값을 표시해주는 글들이 심심치 않게 보였습니다.

그래서 열씸히 Humidity 를 표현하려고 이리저리 시도해 봤습니다.


또, Aliexpress 에서 구입한 BMP280 제품을 보면 GY-BME/P280 이라고 표시되어 있습니다.

할거 다 해봤습니다.


아니 그런뒈.... 그런뒈! (컬투 버전) 



2. 알아버렸다

그렇습니다. Humidity 를 하려면, 정확하게 BME280 이 있어야 합니다. BMP280 로는 안되는 것이였습니다.

아놔.




나를 깨우쳐준 글.



정말 되냐 안되냐를 확인할 수 있는 글.



3. 넌 누구냐

직접 확인해 봅니다.

SparkFun 이 제공하는 'I2C_ReadAllData.ino' sketch 를 통해서 0x58 이냐, 0x60 이냐를 확인해 봅니다.


SparkFun Library 를 아래 링크를 통해 다운받고 설치합니다.


 - https://github.com/sparkfun/SparkFun_BME280_Arduino_Library


마지막으로 I2C address 를 0x77 > 0x76 으로 바꾸고 실행해 봅니다.



아놔... 넌 BMP280 이구나...



4. BME280 구입

정말 정말 Humidity 수치를 알고 싶습니다.


한꺼번에 구입하지 못 한것을 탓하면서, 다시 주문을 넣습니다.

3주만에 오네요.



2개를 주문해서 앞뒤로 한 샷에 넣어 봅니다.



위의 부분이 센서군요. 보통 Bosch 에서 만든다고 하는데, Bosch 각인은 아닌것 같습니다.




이놈이 진짜 BME280 인지, 바로! 확인해 봅니닷!



오옷! 맞네요.
(정보를 알려준 외국인 친구 감사~!)



5. 구동해 보기

Library 를 다운받아 설치합니다.


 - https://github.com/adafruit/Adafruit_BME280_Library


I2C address 를 0x77 > 0x76 으로 꼭 변경해야 합니다.



이거 수정하지 않고 한참 해멨습니다.



이제 example sketch 를 로딩합니다.



소스는 다음과 같습니다.


/***************************************************************************
  This is a library for the BME280 humidity, temperature & pressure sensor

  Designed specifically to work with the Adafruit BME280 Breakout
  ----> http://www.adafruit.com/products/2650

  These sensors use I2C or SPI to communicate, 2 or 4 pins are required
  to interface. The device's I2C address is either 0x76 or 0x77.

  Adafruit invests time and resources providing this open source code,
  please support Adafruit andopen-source hardware by purchasing products
  from Adafruit!

  Written by Limor Fried & Kevin Townsend for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ***************************************************************************/

#include 
#include 
#include 
#include 

#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme; // I2C
//Adafruit_BME280 bme(BME_CS); // hardware SPI
//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI

unsigned long delayTime;

void setup() {
    Serial.begin(9600);
    Serial.println(F("BME280 test"));

    bool status;
    
    // default settings
    status = bme.begin();
    if (!status) {
        Serial.println("Could not find a valid BME280 sensor, check wiring!");
        while (1);
    }
    
    Serial.println("-- Default Test --");
    delayTime = 1000;

    Serial.println();
}


void loop() { 
    printValues();
    delay(delayTime);
}


void printValues() {
    Serial.print("Temperature = ");
    Serial.print(bme.readTemperature());
    Serial.println(" *C");

    Serial.print("Pressure = ");

    Serial.print(bme.readPressure() / 100.0F);
    Serial.println(" hPa");

    Serial.print("Approx. Altitude = ");
    Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
    Serial.println(" m");

    Serial.print("Humidity = ");
    Serial.print(bme.readHumidity());
    Serial.println(" %");

    Serial.println();
}

layout 은 다음과 같고, pin 구성은 BMP280 과 같이 I2C 연결과 같습니다.


- VIN : 3.3V

- GND : GND

- SCL : A5

- SDA : A4



빵판에 연결합니다.




6. 결과

얏호~!!!

이제 Humidity 를 볼 수 있어요.



더 사용폭이 많은 BME280 만 만들지, 왜 BMP280 을 만드냐고 살짝 울분을 토해봅니다..



FIN

이제 뭘하지?

And

Hardware | Arduino BMP280 고도/온도/기압 센서

|

1. 시작하기

온도, 기압, 고도센서가 하나의 기판에 달려있는, 참 고마원 BMP280 을 가지고 놀아봅니다.

원래는 Adafruit 에서 나온 정식 발매품이 있는 듯 하나, Aliexpress 를 사랑하는 저로서는 clone 품을 가지고 놀아봅니다.





2. Library

2가지 library 를 설치해야 합니다.

- Adafruit Sensor

- Adafruit BMP280


먼저, Adafruit Sensor library 를 설치합니다.

- https://github.com/adafruit/Adafruit_Sensor




그리고, BMP280 용 library 를 다운로드 받아 설치합니다.

     - https://learn.adafruit.com/adafruit-bmp280-barometric-pressure-plus-temperature-sensor-breakout/wiring-and-test




맨 마지막으로, clone 부품을 구동시키기 위해,

"Adafruit_BMP280.h" 파일을, 아래처럼 I2C 어드레스에 대해 0x77 > 0x76 으로 수정해 줘야 합니다.





3. 소스코드

위의 library 를 추가하였으면, "File > Examples > Adafruit BMP280 Library > bmp280test" 를 선택할 수 있습니다.




/***************************************************************************
  This is a library for the BMP280 humidity, temperature & pressure sensor

  Designed specifically to work with the Adafruit BMEP280 Breakout 
  ----> http://www.adafruit.com/products/2651

  These sensors use I2C or SPI to communicate, 2 or 4 pins are required 
  to interface.

  Adafruit invests time and resources providing this open source code,
  please support Adafruit andopen-source hardware by purchasing products
  from Adafruit!

  Written by Limor Fried & Kevin Townsend for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ***************************************************************************/

#include 
#include 
#include 
#include 

#define BMP_SCK 13
#define BMP_MISO 12
#define BMP_MOSI 11 
#define BMP_CS 10

Adafruit_BMP280 bme; // I2C
//Adafruit_BMP280 bme(BMP_CS); // hardware SPI
//Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);

void setup() {
  Serial.begin(9600);
  Serial.println(F("BMP280 test"));
  
  if (!bme.begin()) {  
    Serial.println(F("Could not find a valid BMP280 sensor, check wiring!"));
    while (1);
  }
}

void loop() {
    Serial.print(F("Temperature = "));
    Serial.print(bme.readTemperature());
    Serial.println(" *C");
    
    Serial.print(F("Pressure = "));
    Serial.print(bme.readPressure());
    Serial.println(" Pa");

    Serial.print(F("Approx altitude = "));
    Serial.print(bme.readAltitude(1013.25)); // this should be adjusted to your local forcase
    Serial.println(" m");
    
    Serial.println();
    delay(2000);
}



4. Layout

PIN 배열은 다음과 같습니다.

- VCC : 3.3v

- GND : GND

- SCL : A5

- SDA : A4







5. 결과

잘 나오네요.

실재로 사용시에는 기준값을 조금 수정해야 할 것 같습니다만, 일단 성공입니다.




6. 확장

아래 링크에서는 OLED 를 사용한 방법을 소개하고 있습니다.


- http://www.instructables.com/id/Standalone-Arduino-Altimeter/


바로 따라해 봅니다.

우선 아래 용도로 사용될 BMP280 library 를 다운로드 받고, libraries 폴더에 위치시킵니다.


BMP280.zip





[BMP280]

----------------------

- VCC : +3.3V

- GND : GND

- SCL : A5

- SDA : A4

- CSB : +3.3V

- SDO : GND


[0.96" I2C IIC Series 128X64 OLED]

----------------------

- SCL : A5

- SDA : A4

- VCC : +3.3V

- GND : GND


#include "U8glib.h"
#include "BMP280.h"
#include "Wire.h"
#define P0 1021.97  //1013.25 
BMP280 bmp;

// OLED Type
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);

char sT[20];
char sP[9];
char sA[9];
char sA_MIN[9];
char sA_MAX[9];
double A_MIN = 0;
double A_MAX = 0;

void draw(double T, double P, double A) {
  u8g.setFont(u8g_font_unifont);

  dtostrf(T, 4, 2, sT);
  dtostrf(P, 4, 2, sP);
  dtostrf(A, 4, 2, sA);

  u8g.drawStr( 5, 10, "Temp: ");
  u8g.drawStr( 5, 30, "Bar : ");
  u8g.drawStr( 5, 50, "Alt : ");
  u8g.drawStr( 50, 10, sT);
  u8g.drawStr( 50, 30, sP);
  u8g.drawStr( 50, 50, sA);
}

void draw2(double A_MIN, double A_MAX) {
  u8g.setFont(u8g_font_unifont);

  dtostrf(A_MIN, 4, 2, sA_MIN);
  dtostrf(A_MAX, 4, 2, sA_MAX);
  u8g.drawStr( 5, 20, "A Min: ");
  u8g.drawStr( 60, 20, sA_MIN);
  u8g.drawStr( 5, 45, "A Max: ");
  u8g.drawStr( 60, 45, sA_MAX);
}

void setup() {
  Serial.begin(9600);
  if (!bmp.begin()) {
    Serial.println("BMP init failed!");
    while (1);
  }
  else Serial.println("BMP init success!");

  bmp.setOversampling(4);

  u8g.setColorIndex(1);
  u8g.setFont(u8g_font_unifont);
}

void loop(void) {
  double T, P;
  char result = bmp.startMeasurment();

  if (result != 0) {
    delay(result);
    result = bmp.getTemperatureAndPressure(T, P);

    if (result != 0) {
      double A = bmp.altitude(P, P0);

      if ( A > A_MAX) {
        A_MAX = A;
      }

      if ( A < A_MIN || A_MIN == 0) {
        A_MIN = A;
      }

      //      Serial.print("T = \t"); Serial.print(T, 2); Serial.print(" degC\t");
      //      Serial.print("P = \t"); Serial.print(P, 2); Serial.print(" mBar\t");
      //      Serial.print("A = \t"); Serial.print(A, 2); Serial.println(" m");

      u8g.firstPage();
      do {
        draw(T, P, A);
      } while ( u8g.nextPage() );
      u8g.firstPage();
      delay(1000);

      do {
        draw2(A_MIN, A_MAX);
      } while ( u8g.nextPage() );
      u8g.firstPage();
      delay(1000);
      
    }
    else {
      Serial.println("Error.");
    }
  }
  else {
    Serial.println("Error.");
  }

  delay(100);

}





값이 잘 바뀌고 있습니다.




FIN

이제 뭘하지?

And

Hardware | Arduino 비접촉 온도센서 GY-906 MLX90614

|

1. 시작하기

오늘은 비접촉 온도센서인 MLX90614 를 가지고 놀아봅니다.


미키마우스같이 생겼네요.


뒷부분에 여러 보조 부품이 같이 실장되어 있어, Arduino 연결 시, 따로 콤포넌트를 추가하지 않아도 됩니다.





2. Library 추가하기

구동하기 위해서는 관련 library 를 추가해야 합니다.


- https://learn.adafruit.com/using-melexis-mlx90614-non-contact-sensors/wiring-and-test




3. 레이아웃

핀 연결은 다음과 같습니다.


- VIN : +3.3V

- GND : GND

- SCL : A5

- SDA : A4






4. 소스

Library 를 설치했으면, File > Example > Adafruit MXL90614 Library > mlxtest 를 가지고 이용할 수 있습니다.



/*************************************************** 
  This is a library example for the MLX90614 Temp Sensor

  Designed specifically to work with the MLX90614 sensors in the
  adafruit shop
  ----> https://www.adafruit.com/products/1748
  ----> https://www.adafruit.com/products/1749

  These sensors use I2C to communicate, 2 pins are required to  
  interface
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include 
#include 

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup() {
  Serial.begin(9600);

  Serial.println("Adafruit MLX90614 test");  

  mlx.begin();  
}

void loop() {
  Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC()); 
  Serial.print("*C\tObject = "); Serial.print(mlx.readObjectTempC()); Serial.println("*C");
  Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempF()); 
  Serial.print("*F\tObject = "); Serial.print(mlx.readObjectTempF()); Serial.println("*F");

  Serial.println();
  delay(500);
}


5. 결과

성공입니다.



다만, 다른 component 와 비교하여 단순히 온도만 내 주는건 좀 아쉽습니다.

특히 BMP280은 온도 외에, 기압, 고도도 나타내 주거든요.



6. 확장

아래 사이트를 보니, OLED 를 이용해서 표시해주는 코드를 발견했습니다.

이제 좀 있어 보이네요.


- http://www.arduinoprojects.net/lcd-projects/mlx90614-and-oled-display-example.php#codesyntax_1


바로 따라해 봅니다.



#include 
#include 
#include 
#include 
#include 
#include 
 
#define OLED_RESET 4
 
Adafruit_SSD1306 display(OLED_RESET);
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
 
//if (SSD1306_LCDHEIGHT != 32)
//error("Height incorrect, please fix Adafruit_SSD1306.h!");
//endif
 
void setup()   
{                
  Serial.begin(57600);
  Serial.println("Adafruit MLX90614 test");  
  mlx.begin();  
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)
}
 
 
void loop() 
{
    // Clear the buffer.
  display.clearDisplay();
 
  // text display tests
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.print("Ambient: ");
  display.print(mlx.readAmbientTempC()); 
  display.print(" c");
  display.setCursor(0,10);
  display.print("Object: ");
  display.print(mlx.readObjectTempC()); 
  display.print(" c");
  display.display();
  delay(2000);
  
}

잘 나오네요.

부품 2개를 연결하여 작동시킨 처음 케이스 입니다.



온도 센서 근처에 손가락을 가져가면 온도변화를 화면에 표시해 줍니다.




FIN

이제 뭘하지?

And
prev | 1 | next