아두이노 PH 측정 센서
(PH Sensor)
개요
- 본 제품은 물속의 PH를 측정할 수 있는 PH 센서입니다.
- 0에서 14PH를 측정할 수 있으며, Ph 센서 프로브와 인터페이스 모듈이 포함되어 있는 제품입니다.
- 모듈을 통해 아두이노와 연결하여 PH를 측정할 수 있습니다.
- 5V로 동작합니다.
특징
- Measurement Range: 0-14 pH
- Operating temperature: 0-60℃
- Response time: less than 2min
- Operating voltage: 5v
문서
- 예제코드
#define Vref 4.95 unsigned long int avgValue; //Store the average value of the sensor feedback int i=0; void setup() { Serial.begin(9600); pinMode(A0, INPUT); pinMode(A1, OUTPUT); } void loop() { float sensorValue; int m; long sensorSum; int buf[10]; //buffer for read analog for(int i=0;i<10;i++) //Get 10 sample value from the sensor for smooth the value { buf[i]=analogRead(A0);//Connect the PH Sensor to A0 port delay(10); } for(int i=0;i<9;i++) //sort the analog from small to large { for(int j=i+1;j<10;j++) { if(buf[i]>buf[j]) { int temp=buf[i]; buf[i]=buf[j]; buf[j]=temp; } } } avgValue=0; for(int i=2;i<8;i++) //take the average value of 6 center sample avgValue+=buf[i]; sensorValue = avgValue/6; Serial.print(sensorValue); Serial.println(" "); Serial.print(" the PH value is"); Serial.print(7-1000*(sensorValue-365)*Vref/59.16/1023,2); Serial.println(" "); delay(1000); }