ÀÌ ¸Å´º¾óÀº ÁÖ½Äȸ»ç Á¦ÀÌÄÉÀÌÀÌ¿¥¾¾(JK EMC) ¿¡ ÀÇÇؼ­ ¹ø¿ª, ¼öÁ¤, ÀÛ¼º µÇ¾ú°í ¼ÒÀ¯±Ç ¶ÇÇÑ
ÁÖ ½Äȸ»ç Á¦ÀÌÄÉÀÌÀÌ¿¥¾¾(JK EMC)ÀÇ °ÍÀÔ´Ï´Ù. ¼ÒÀ¯±ÇÀÚÀÇ Çã°¡¸¦ ¹ÞÁö ¾Ê°í ¹«´ÜÀ¸·Î ¼öÁ¤, »èÁ¦Çϰųª ¹èÆ÷ ÇÒ ¼ö ¾ø½À´Ï´Ù.

 

 

BMP180 °íµµ/¾Ð·Â Barometer GY-68 3.3/5V ·¹±Ö·¹ÀÌÅÍ ³»ÀåÇü ¼¾¼­ ¸Þ´º¾ó


  * Update history

- 2016.8.3 : ÇÁ·Î¼¼½Ì ÄÚµå Ãß°¡
- 2016.7.15 : Ãʱâ Release


 
1. BMP180 ¼¾¼­ ¼Ò°³
2. ¾Æ µÎÀ̳ë¿Í °°ÀÌ »ç¿ëÇϱâ
    2.1 ¼¾¼­ ȸ·Îµµ¹× ¿Ü°û Ä¡¼ö
    2.2 ¾ÆµÎÀ̳ë UNO R3 ¹è¼±µµ
    2.3 ¾ÆµÎÀÌ³ë ½ºÄÉÄ¡ ÄÚµå
3. ÇÁ·Î¼¼½ÌÀ» ÀÌ¿ëÇؼ­ 3Â÷¿ø ±×·¡ÇÈ Ç¥½Ã
    3.1 ÇÁ·Î¼¼½Ì ¼³Ä¡ Çϱâ
    3.2 ¾ÆµÎÀ̳ë UNO R3 ¹è¼±µµ
    3.3 ¾ÆµÎÀÌ³ë ½ºÄÉÄ¡ ÄÚµå
    3.4 ÇÁ·Î¼¼½Ì ÄÚµå



 

1. BMP180 ¼¾¼­ ¼Ò°³

µ¶ÀÏ º¸½¬(Bosch)»çÀÇ BMP180 ¼¾¼­´Â BMP085¸¦ ´ëüÇؼ­ º¸´Ù ´õ Á¤¹ÐÇÑ ±â¾Ð ¹× ¿Âµµ¸¦ ÃøÁ¤ÇÒ ¼ö ÀÖ´Ù. °íµµ¿¡ µû¶ó ±â¾ÐÀº ´Þ¶óÁö¹Ç·Î ±â¾ÐÀ» ¹ÙÅÁÀ¸·Î °íµµ¸¦ ÃøÁ¤ÇÒ ¼ö ÀÖ´Ù. °íµµ°¡ ³ô¾ÆÁö¸é ±â¾ÐÀÌ ³·¾ÆÁö°í °íµµ°¡ ³·¾ÆÁö¸é ±â¾ÐÀÌ ³ô¾ÆÁö´Â ¿ø¸®¸¦ ÀÌ¿ëÇÏ´Â °ÍÀÌ´Ù. À̸¦ ±â¾Ð°íµµ(Pressure Altitude)¶ó°í ÇÑ´Ù. BMP180¼¾¼­´Â I2C (Inter Integrated Circuit) Åë½Å ÇÁ·ÎÅäÄÝÀ» ÅëÇؼ­ µ¥ÀÌÅ͸¦ ÃßÃâ ÇÒ ¼ö ÀÖ´Ù.



Characteristic Value Unit
Supply Voltage 1.5 ~ 3.6 V
Supply Current Ultra low power mode : 3 
Standard mode : 5
High resolution mode : 7 
Ultra high res. mode : 12
uA
Pressure resolution 0.03 hPa



2. ¾ÆµÎÀ̳ë¿Í °°ÀÌ »ç¿ëÇϱâ

2.1 ¼¾¼­ ȸ·Îµµ¹× ¿Ü°û Ä¡¼ö

(1) BMP180 ¼¾¼­ ȸ·Îµµ
     - BMP180 PDF ȸ·Îµµ ´Ù¿î·Îµå
     - BMP180 µ¥ÀÌÅͽÃÆ® ´Ù¿î·Îµå(http://www.jkelec.co.kr)
     - BMP180 DXF ijµå ÆÄÀÏ ´Ù¿î·Îµå

bmp180

(2) BMP180 ¼¾¼­ ¿Ü°û(mm´ÜÀ§) Ä¡¼ö

      atmega128

2.2 ¾ÆµÎÀ̳ë UNO R3 ¹è¼±µµ

(1) ¾ÆµÎÀ̳ë UNO R3¿Í ¿¬°áÇؼ­ ¿Âµµ, °íµµ, ¾Ð·Â µ¥ÀÌÅÍ Ãâ·Â Çϱâ
º» Á¦Ç°Àº ³»ºÎ¿¡ ȸ·ÎÀûÀ¸·Î 3.3VÀü¿ø ·¹µâ·¹ÀÌÅÍ¿Í I2C ·¹º§½¬ÇÁÅ͸¦ ³»ÀåÇÏ°í À־ 5.0V¿Í 3.3V ¿¡¼­ ¸ðµÎ »ç¿ëÀÌ °¡´É ÇÏ´Ù. STM32, ¶óÁ¸®ÆÄÀÌ µî°ú °°ÀÌ 3.3V Àü¿øÀ» »ç¿ëÇÏ´Â ÇÁ·Î¼¼¼­¿¡¼­ »ç¿ëÇÒ °æ¿ì¿¡´Â VCC ´ë½Å¿¡ 3.3V ÇÉÀ» ÅëÇؼ­ Àü¿øÀ» ¹Ù·Î ¿¬°áÇØ ÁÖ¸é µÈ´Ù.


     - Fritzing ÆÄÀÏ ´Ù¿î·Îµå

bmp180

 



2.3 ¾ÆµÎÀÌ³ë ½ºÄÉÄ¡ ÄÚµå

´Ü¼øÈ÷ ¼¾¼­ÀÇ ¿Âµµ, °íµµ, ¾Ð·Â µ¥ÀÌÅ͸¦ ½Ã¸®¾ó µ¥ÀÌÅÍ·Î Ãâ·ÂÇÏ´Â ¿¹Á¦ ÀÌ´Ù.

(1) ¾ÆµÎÀÌ³ë ½ºÄÉÄ¡ ÄÚµå
     - BMP180 raw µ¥ÀÌÅÍ Ç¥½Ã ½ºÄ³Ä¡ ÆÄÀÏ ´Ù¿î·Îµå

/*
BMP085 / BMP180 Barometric Pressure & Temperature Sensor. Simple Example (Integer equations)
Read more: http://www.jarzebski.pl/arduino/czujniki-i-sensory/czujniki-cisnienia-bmp085-bmp180.html
GIT: https://github.com/jarzebski/Arduino-BMP085-BMP180
Web: http://www.jarzebski.pl
(c) 2014 by Korneliusz Jarzebski
*/
#include <Wire.h>
#include "bmp180.h"
BMP085 bmp;
double referencePressure;
void setup() {
Serial.begin(9600);
// Initialize BMP180 sensor
Serial.println("Initialize BMP180 Serial");
// Ultra high resolution: BMP085_ULTRA_HIGH_RES
// (default) High resolution: BMP085_HIGH_RES
// Standard: BMP085_STANDARD
// Ultra low power: BMP085_ULTRA_LOW_POWER
while(!bmp.begin(BMP085_ULTRA_HIGH_RES))
{
Serial.println("Could not find a valid BMP085 or BMP180 sensor, check wiring!");
delay(500);
}
// Enable or disable SOSS (Software oversampling)- Use with BMP085_ULTRA_HIGH_RES !
// For applications where a low noise level is critical, averaging is recommended if the lower bandwidth is acceptable
// Conversion time pressure: 76.5ms, RMS noise 0.02 hPA / 0.17 m
// bmp.setSoftwareOversampling(0);
// Get reference pressure for relative altitude
referencePressure = bmp.readPressure();
// Check settings
checkSettings();
}
void checkSettings()
{
long bmpVersion = bmp.getVersion();
Serial.print("Chip version: ");
Serial.print(bmpVersion >> 8); Serial.print("."); Serial.print(bmpVersion & 0xFF);
Serial.print(" (0x"); Serial.print(bmpVersion, HEX); Serial.println(")");
Serial.print("Oversampling: ");
Serial.println(bmp.getOversampling());
Serial.print("Software Oversampling: ");
Serial.println(bmp.getSoftwareOversampling());
}
void loop()
{
// Read raw values
int rawTemp = bmp.readRawTemperature();
uint32_t rawPressure = bmp.readRawPressure();
// Read true temperature & Pressure
double realTemperature = bmp.readTemperature();
long realPressure = bmp.readPressure();
// Calculate altitude
float absoluteAltitude = bmp.getAltitude(realPressure);
float relativeAltitude = bmp.getAltitude(realPressure, referencePressure);
Serial.println("--");
Serial.print(" rawTemp = ");
Serial.print(rawTemp);
Serial.print(", realTemp = ");
Serial.print(realTemperature);
Serial.println(" *C");
Serial.print(" rawPressure = ");
Serial.print(rawPressure);
Serial.print(", realPressure = ");
Serial.print(realPressure);
Serial.println(" Pa");
Serial.print(" absoluteAltitude = ");
Serial.print(absoluteAltitude);
Serial.print(" m, relativeAltitude = ");
Serial.print(relativeAltitude); Serial.println(" m");
delay(1000);
}

BMP180ÀÇ Slave Address´Â ±âº»ÀûÀ¸·Î 0x77ÀÌ´Ù.

#define BMP085_ADDRESS (0x77)

Âü°í·Î BMP085¿Í BMP180ÀÇ ·¹Áö½ºÅÍ ¼¼Æ®°¡ µ¿ÀÏÇϱ⠶§¹®¿¡ ´Ù½Ã ¸»Çϸé ȣȯÇϱ⠶§¹®¿¡ BMP085ÀÇ ¾ÆµÎÀÌ³ë ¶óÀ̺귯¸®¸¦ ±×´ë·Î ÀÌ¿ëÇÏ¿´´Ù.

(2) ½ÇÇà °á°ú 
BMP180°úÀÇ I2C Åë½Å »óŸ¦ °Ë»çÇÏ°í ¿Âµµ, ¾Ð·Â, °íµµ °ªÀ» ¹Ýº¹Çؼ­ º¸¿©ÁØ´Ù.

mpu9250

º» ¸Þ´º¾óÀÇ ¾ÆµÎÀ̳ë ÄÚµå´Â ¾Æ·¡ https://github.com/jrowberg/i2cdevlib ÀÇ ³»¿ëÀ» ÂüÁ¶ÇÏ¿© ÀÛ¼º ÇÏ¿´´Ù.

3. ÇÁ·Î¼¼½ÌÀ» ÀÌ¿ëÇؼ­ 3Â÷¿ø ±×·¡ÇÈ Ç¥½Ã

3.1 ÇÁ·Î¼¼½Ì ¼³Ä¡ Çϱâ

¾ÆµÎÀ̳븦 ÀÌ¿ëÇؼ­ ¼¾¼­¿¡¼­ µ¥ÀÌÅ͸¦ ÃßÃâÇؼ­ ½Ã¸®¾ó µ¥ÀÌÅÍ·Î Ãâ·ÂÀ» Çؼ­ µ¥ÀÌÅÍ °ªÀ» È®ÀÎÀ» ½±°Ô ÇÒ ¼ö ÀÖ¾ú´Ù. ±×·¸´Ù¸é ÅؽºÆ® µ¥ÀÌÅÍ°¡ ¾Æ´Ï¶ó Á¶±Ý´õ ½Ã°¢ÀûÀΠǥÇö ¹æ¹ýÀÌ ¾øÀ»±î? ±×°Íµµ ¾ÆÁÖ ½±°Ô.. 
ÇÁ·Î¼¼½ÌÀ» ÀÌ¿ëÇÏ¸é ¾ÆµÎÀÌ³ë ½ºÄÉÄ¡ Äڵ带 ÀÔ·ÂÇϵíÀÌ ¾ÆÁÖ ½±°Ô ½Ã°¢ÀûÀΠǥÇöÀÌ °¡´ÉÇÏ´Ù. ¿ì¼± ÇÁ·Î¼¼½Ì °³¹ß ȯ°æÀ» ¼³Ä¡Çϴ°ͺÎÅÍ Çغ¸ÀÚ.

(1) ÇÁ·Î¼¼½Ì ¼³Ä¡
      - ÇÁ·Î¼¼½Ì °³¹ßȯ°æ ¼³Ä¡ Çϱâ(»õâ)
ÇÁ·Î¼¼½ÌÄÚµå´Â BMP180 ¸ðµâ¿¡¼­ Ãâ·ÂÇÏ´Â µ¥ÀÌÅ͸¦ ½Ã¸®¾ó(RS232) Åë½ÅÀ» ÅëÇؼ­ ÀÔ·ÂÀ» ¹Þ¾Æ µ¥ÀÌÅ͸¦ ó¸® Çϵµ·Ï µÇ¾î ÀÖ´Ù. ÀÌÁ¦ ¾ÆµÎÀ̳ë¿Í BMP180 ¸ðµâÀ» ÀÌ¿ëÇؼ­ ÇÁ·Î¼¼½Ì¿¡¼­ ó¸® Çϱâ À§ÇÑ µ¥ÀÌÅÍ Ãâ·ÂÀ» Çغ¸ÀÚ.

3.2 ¾ÆµÎÀ̳ë UNO R3 ¹è¼±µµ

¹è¼±µµ´Â ÀÌÀü ¿¹Á¦¿Í µ¿ÀÏÇÏ´Ù.

mpu6050

3.3 ¾ÆµÎÀÌ³ë ½ºÄÉÄ¡ ÄÚµå

(1) ¾ÆµÎÀ̳ë ÇÁ·Î¼¼½Ì ÄÚµå
ÇÁ·Î¼¼½Ì Äڵ忡¼­ ÇÑ°¡Áö ÁÖÀÇ ÇؾßÇÒ »çÇ×Àº ó¸® ¼Óµµ¸¦ ºü¸£°Ô Çϱâ À§Çؼ­ ½Ã¸®Åë Åë½ÅÀÇ ¼Óµµ¸¦ 115200bps ·Î ¼³Á¤À» ÇÏ¿´´Ù. ±×·¸±â ¶§¹®¿¡ ¾ÆµÎÀ̳ëÀÇ ½Ã¸®¾ó ¸ð´ÏÅÍâ¿¡¼­µµ µ¿ÀÏÇÑ Åë½Å¼Óµµ¸¦ ¸ÂÃß¾î ÁÖ¾î¾ß ÇÑ´Ù.

     - BMP180 ¾ÆµÎÀ̳ë, ÇÁ·Î¼¼½Ì ½ºÄ³Ä¡ ÆÄÀÏ ´Ù¿î·Îµå


/*
BMP085 / BMP180 Barometric Pressure & Temperature Sensor. Output for BMP085_processing.pde
Read more: http://www.jarzebski.pl/arduino/czujniki-i-sensory/czujniki-cisnienia-bmp085-bmp180.html
GIT: https://github.com/jarzebski/Arduino-BMP085-BMP180
Web: http://www.jarzebski.pl
(c) 2014 by Korneliusz Jarzebski
*/
#include <Wire.h>
#include "bmp180.h"
BMP085 bmp;
void setup() {
Serial.begin(115200);
// Initialize BMP085 or BMP180 sensor
// Ultra high resolution: BMP085_ULTRA_HIGH_RES
// (default) High resolution: BMP085_HIGH_RES
// Standard: BMP085_STANDARD
// Ultra low power: BMP085_ULTRA_LOW_POWER
while(!bmp.begin(BMP085_ULTRA_HIGH_RES))
{
delay(500);
}
}
void loop()
{
// Disable Software Oversampling
bmp.setSoftwareOversampling(0);
// Read true temperature & Pressure (Integer equations)
double realTemperature = bmp.readTemperature();
long realPressure = bmp.readPressure();
double realAltitude = bmp.getAltitude(realPressure);
// Read true temperature & Pressure (Floating-point equations)
double floatTemperature = bmp.readFloatTemperature();
double floatPressure = bmp.readFloatPressure();
double floatAltitude = bmp.getAltitude(floatPressure);
// Enable Software Oversampling
// Read true temperature & Pressure (Floating-point equations) /.Software oversampling
bmp.setSoftwareOversampling(1);
double sossTemperature = bmp.readFloatTemperature();
double sossPressure = bmp.readFloatPressure();
double sossAltitude = bmp.getAltitude(sossPressure);
// Output
Serial.print(realTemperature);
Serial.print(":");
Serial.print(floatTemperature);
Serial.print(":");
Serial.print(sossTemperature);
Serial.print(":");
Serial.print(realPressure);
Serial.print(":");
Serial.print(floatPressure);
Serial.print(":");
Serial.print(sossPressure);
Serial.print(":");
Serial.print(realAltitude);
Serial.print(":");
Serial.print(floatAltitude); Serial.print(":");
Serial.print(sossAltitude); Serial.println();
}

(2) ½ÇÇà °á°ú

mpu6050

¾ÆµÎÀÌ³ë ½Ã¸®¾ó ¸ð´ÏÅÍâ¿¡¼­ ¹Ýµå½Ã º¸µå·¹ÀÌÆ®(Baudate)¸¦  115200 À¸·Î ¼öÁ¤ ÇØ¾ß ÇÑ´Ù. ±×·¸Áö ¾ÊÀ¸¸é ½Ã¸®¾ó ¸ð´ÏÅÍ Ã¢¿¡ ¾Æ¹«·± µ¥ÀÌÅÍ°¡ Ç¥½ÃµÇÁö ¾Ê°Å³ª À߸øµÈ µ¥ÀÌÅÍ°¡ Ç¥½ÃµÉ °ÍÀÌ´Ù. ÇÁ·Î¼¼½Ì µ¥ÀÌÅ͸¦ ó¸®Çϱâ À§ÇÑ µ¥ÀÌÅÍ À̹ǷΠµ¥ÀÌÅ͸¦ ¹Ù·Î Æǵ¶Çϱâ´Â ¾î·Æ´Ù. µ¥ÀÌÅÍ°¡ ¿Ã¹Ù¸£°Ô Ç¥½ÃµÇ´Â°ÍÀ» È®ÀÎ ÇÏ¿´´Ù¸é ÇÁ·Î¼¼½Ì¿¡¼­ µ¿ÀÏÇÑ ½Ã¸®¾óÆ÷Æ®¸¦ »ç¿ëÇØ¾ß Çϱ⠶§¹®¿¡ ¾ÆµÎÀÌ³ë ½Ã¸®¾ó ¸ð´ÏÅÖ Ã¢À» ´Ýµµ·Ï ÇÏÀÚ.

3.4 ÇÁ·Î¼¼½Ì ÄÚµå

ÇÁ·Î¼¼½Ì Äڵ忡¼­ ÇÑ°¡Áö ÁÖÀÇ ÇؾßÇÒ »çÇ×Àº ½Ã¸®¾ó Æ÷Æ®¸¦ °¢ÀÚÀÇ È¯°æ¿¡ ¸ÂÃ߾ ¼öÁ¤À» ÇØÁÖ¾î¾ß ÇÑ´Ù´Â °ÍÀÌ´Ù.
¾Æ·¡ ÇÁ·Î¼¼½Ì Äڵ忡¼­ "[0]" ÀÇ 0À̶ó´Â ¼ýÀÚ´Â ÀåÄ¡°ü¸®ÀÚ¿¡¼­ COMÆ÷Æ®ÀÇ ¹øÈ£°¡ ¾Æ´Ï¶ó Æ÷Æ®ÀÇ ¼ø¼­¶ó´Â°Í¿¡ ÁÖÀÇ ÇØ¾ß ÇÑ´Ù.

mpu6050

À§ÀÇ ÀåÄ¡°ü¸®ÀÚ È­¸é¿¡¼­ ¿¹¸¦ µç´Ù¸é ´ÙÀ½°ú °°´Ù.

Serial.list()[0]; // --> COM31
Serial.list()[1]; // --> COM5

ÇÁ·Î¼¼½Ì Äڵ带 ½ÇÇàÇÒ¶§ Å×½ºÆ®ÇÏ´Â PCÀÇ COM Æ÷Æ® »óÅ¿¡ µû¶ó¼­ "Serial.list()[0]" ÀÇ ¼ýÀÚ¸¦ ¹Ù²Ù¾î ÁÖ¾î¾ß ÇÑ´Ù.

(1) ÇÁ·Î¼¼½Ì ÄÚµå

/*
BMP085/BMP180 Barometric Pressure & Temperature Sensor. Processing for BMP085_processing.ino
Read more: http://www.jarzebski.pl/arduino/czujniki-i-sensory/czujniki-cisnienia-bmp085-bmp180.html
GIT: https://github.com/jarzebski/Arduino-BMP085-BMP180
Web: http://www.jarzebski.pl
(c) 2014 by Korneliusz Jarzebski
*/
import processing.serial.*;
Serial myPort;
// Data samples
int actualSample = 0;
int maxSamples = 70;
int sampleStep = 10;
boolean hasData = false;
// Charts
PGraphics pgChart;
int[] colors = { #ff4444, #33ff99, #5588ff };
String[] compareSeries = { "Integer", "Float", "Float+SOSS" };
// Data for compare
float[][] pressureValues = new float[3][maxSamples];
float[][] temperatureValues = new float[3][maxSamples];
float[][] altitudeValues = new float[3][maxSamples];
void setup ()
{
size(770, 670, P2D);
background(0);
// Serial
myPort = new Serial(this, Serial.list()[0], 115200);
myPort.bufferUntil(10);
}
void drawChart(String title, String[] series, float[][] chart, int x, int y, int h, boolean symmetric, boolean fixed, int fixedMin, int fixedMax, int hlines) {
int actualColor = 0;
int maxA = 0;
int maxB = 0;
int maxAB = 0;
int min = 0;
int max = 0;
int step = 0;
int divide = 0;
if (fixed)
{
min = fixedMin;
max = fixedMax;
step = hlines;
} else
{
if (hlines > 2)
{
divide = (hlines - 2);
} else
{
divide = 1;
}
if (symmetric)
{
maxA = (int)abs(getMin(chart));
maxB = (int)abs(getMax(chart));
maxAB = max(maxA, maxB);
step = (maxAB * 2) / divide;
min = -maxAB-step;
max = maxAB+step;
} else
{
min = (int)(getMin(chart));
max = (int)(getMax(chart));
if ((max >= 0) && (min <= 0)) step = (abs(min) + abs(max)) / divide; if ((max < 0) && (min < 0)) step = abs(min - max) / divide; if ((max > 0) && (min > 0)) step = (max - min) / divide; if (divide > 1)
{
min -= step;
max += step;
}
}
}
pgChart = createGraphics((maxSamples*sampleStep)+50, h+60);
pgChart.beginDraw();
// Draw chart area and title
pgChart.background(0);
pgChart.strokeWeight(1);
pgChart.noFill();
pgChart.stroke(50);
pgChart.rect(0, 0, (maxSamples*sampleStep)+49, h+59);
pgChart.text(title, ((maxSamples*sampleStep)/2)-(textWidth(title)/2)+40, 20);
// Draw chart description
String Description[] = new String[chart.length];
int DescriptionWidth[] = new int[chart.length];
int DesctiptionTotalWidth = 0;
int DescriptionOffset = 0;
for (int j = 0; j < chart.length; j++)
{
Description[j] = " "+series[j]+" = ";
DescriptionWidth[j] += textWidth(Description[j]+"+000000.00");
Description[j] += nf(chart[j][actualSample-1], 0, 2)+" ";
DesctiptionTotalWidth += DescriptionWidth[j];
}
actualColor = 0;
for (int j = 0; j < chart.length; j++)
{
pgChart.fill(colors[actualColor]);
pgChart.text(Description[j], ((maxSamples*sampleStep)/2)-(DesctiptionTotalWidth/2)+DescriptionOffset+40, h+50);
DescriptionOffset += DescriptionWidth[j];
actualColor++;
if (actualColor >= colors.length) actualColor = 0;
}
// Draw H-Lines
pgChart.stroke(100);
for (float t = min; t <= max; t=t+step)
{
float line = map(t, min, max, 0, h);
pgChart.line(40, h-line+30, (maxSamples*sampleStep)+40, h-line+30);
pgChart.fill(200, 200, 200);
pgChart.textSize(12);
pgChart.text(int(t), 5, h-line+34);
}
// Draw data series
pgChart.strokeWeight(2);
for (int i = 1; i < actualSample; i++)
{
actualColor = 0;
for (int j = 0; j < chart.length; j++)
{
pgChart.stroke(colors[actualColor]);
float d0 = chart[j][i-1];
float d1 = chart[j][i];
if (d0 < min) d0 = min;
if (d0 > max) d0 = max;
if (d1 < min) d1 = min;
if (d1 > max) d1 = max;
float v0 = map(d0, min, max, 0, h);
float v1 = map(d1, min, max, 0, h);
pgChart.line(((i-1)*sampleStep)+40, h-v0+30, (i*sampleStep)+40, h-v1+30);
actualColor++;
if (actualColor >= colors.length) actualColor = 0;
}
}
pgChart.endDraw();
image(pgChart, x, y);
}
void draw() {
if (!hasData) return;
background(0);
drawChart("Pressure compare [Pa]", compareSeries, pressureValues, 10, 10, 150, false, false, 0, 0, 4);
drawChart("Temperature compare [C]", compareSeries, temperatureValues, 10, 230, 150, false, false, 0, 0, 2);
drawChart("Altitude compare [m]", compareSeries, altitudeValues, 10, 450, 150, false, false, 0, 0, 2);
}
float getMin(float[][] chart)
{
float minValue = 0;
float[] testValues = new float[chart.length];
float testMin = 0;
for (int i = 0; i < actualSample; i++)
{
for (int j = 0; j < testValues.length; j++)
{
testValues[j] = chart[j][i];
}
testMin = min(testValues);
if (i == 0)
{
minValue = testMin;
} else
{
if (minValue > testMin) minValue = testMin;
}
}
return ceil(minValue)-1; }
float getMax(float[][] chart)
{
float maxValue = 0;
float[] testValues = new float[chart.length];
float testMax = 0;
for (int i = 0; i < actualSample; i++)
{
for (int j = 0; j < testValues.length; j++)
{
testValues[j] = chart[j][i];
}
testMax = max(testValues);
if (i == 0)
{
maxValue = testMax;
} else
{
if (maxValue < testMax) maxValue = testMax;
}
}
return ceil(maxValue); }
void nextSample(float[][] chart)
{
for (int j = 0; j < chart.length; j++)
{
float last = chart[j][maxSamples-1];
for (int i = 1; i < maxSamples; i++)
{
chart[j][i-1] = chart[j][i];
}
chart[j][(maxSamples-1)] = last;
}
}
void serialEvent (Serial myPort)
{
String inString = myPort.readStringUntil(10);
if (inString != null)
{
inString = trim(inString);
String[] list = split(inString, ':');
String testString = trim(list[0]);
if (list.length != 9) return;
// Temperature compare
temperatureValues[0][actualSample] = (float(list[0]));
temperatureValues[1][actualSample] = (float(list[1]));
temperatureValues[2][actualSample] = (float(list[2]));
// Pressure compare
pressureValues[0][actualSample] = (float(list[3]));
pressureValues[1][actualSample] = (float(list[4]));
pressureValues[2][actualSample] = (float(list[5]));
// Pressure compare
altitudeValues[0][actualSample] = (float(list[6]));
altitudeValues[1][actualSample] = (float(list[7]));
altitudeValues[2][actualSample] = (float(list[8]));
if (actualSample > 1)
{
hasData = true;
}
if (actualSample == (maxSamples-1))
{
nextSample(temperatureValues);
nextSample(pressureValues);
nextSample(altitudeValues);
} else
{
actualSample++;
}
}
}

(2) ½ÇÇà °á°ú



º» ¸Þ´º¾óÀÇ ÇÁ·Î¼¼½Ì ÄÚµå´Â ¾Æ·¡ URLÀÇ ³»¿ëÀ» ÂüÁ¶ÇÏ¿© ÀÛ¼º ÇÏ¿´´Ù.
https://github.com/jarzebski/Arduino-BMP085-BMP180

* ´Ù¸¥ ¼¾¼­µéÀÇ ¾ÆµÎÀ̳ë¿Í ÇÁ·Î¼¼½Ì ¸Þ´º¾ó º¸±â

(1) MPU6050 GY-521 ¼¾¼­ ¾ÆµÎÀ̳ë, ÇÁ·Î¼¼½Ì ¸Þ´º¾ó(»õâ)
(2) MPU9250 GY-9250 ¼¾¼­ ¾ÆµÎÀ̳ë, ÇÁ·Î¼¼½Ì ¸Þ´º¾ó(»õâ)
(3) L3G4200D GY-50 ¼¾¼­ ¾ÆµÎÀ̳ë, ÇÁ·Î¼¼½Ì ¸Þ´º¾ó(»õâ)
(4) HMC5883L GY-271 ¼¾¼­ ¾ÆµÎÀ̳ë, ÇÁ·Î¼¼½Ì ¸Þ´º¾ó(»õâ)
(5) BMP180 GY-68 ¼¾¼­ ¾ÆµÎÀ̳ë, ÇÁ·Î¼¼½Ì ¸Þ´º¾ó(»õâ)
(6) ADXL345 GY-80 ¼¾¼­ ¾ÆµÎÀ̳ë, ÇÁ·Î¼¼½Ì ¸Þ´º¾ó(»õâ)
(7) ADXL335 GY-61 ¼¾¼­ ¾ÆµÎÀ̳ë, ÇÁ·Î¼¼½Ì ¸Þ´º¾ó(»õâ)