pH Meter Arduino Code / 아두이노 pH 센서 코드

2025. 4. 13. 17:447080기술창고

반응형

 

아두이노 pH 센서

 

 
 
 

 

아두이노 연결 방법

 

pH 센서 교정 코드

 
#include <Arduino.h>
const int adcPin = A0;


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


void loop() {
int adcValue = analogRead(adcPin);
float phVoltage = (float)adcValue * 5.0 / 1024;
Serial.print("ADC = "); Serial.print(adcValue);
Serial.print("; Po = "); Serial.println(phVoltage, 3);
delay(1000);
}

 

pH 값 측정 코드

#include <Arduino.h>
const int adcPin = A0;


const float m = -5.436;


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


void loop() {
float Po = analogRead(adcPin) * 5.0 / 1024;
float phValue = 7 - (2.5 - Po) * m;
Serial.print("ph value = "); Serial.println(phValue);
delay(5000);
}

 

 

반응형