Sơ thứ kết nối cảm biến Đo Độ pH
Ngõ ra của cảm biến ở đơn vị mili Voltage tỉ lệ với độ pH nghỉ ngơi 25 độ C
Hình ảnh thực tế của sản phẩm
Cảm đổi mới Đo Độ pHCảm biến đổi Đo Độ pHCảm đổi thay Đo Độ pH phiên bản trắngCảm biến chuyển Đo Độ pH phiên bản trắngCảm trở thành Đo Độ pHSơ đồ gia dụng chân cảm ứng Đo Độ pH————————-CODE demo SẢN PHẨM———————–
Code đo pH:
/* * Kết nối: * VCC ---- 5V (Arduino) * GND ---- GND (Arduino) * P0 ---- A0 (Arduino) * * */#define SensorPin A0 //pH meter Analog output to Arduino Analog input 0#define Offset 0.70 //deviation compensate Bù TRỪ PHunsigned long int avgValue; //Store the average value of the sensor feedbackvoid setup() pinMode(13,OUTPUT); Serial.begin(9600); Serial.println("Ready"); //Test the serial monitorvoid loop() int buf<10>; //buffer for read analog for(int i=0;i10;i++) //Get 10 sample value from the sensor for smooth the value buf=analogRead(SensorPin); delay(10); for(int i=0;i9;i++) //sort the analog from small to lớn large for(int j=i+1;j10;j++) if(buf>buf
/* Kết nối: LM35 (Cảm biến chuyển nhiệt độ) Arduino VCC 5V T1 A1 GND GND*/int sensorPin = A1; void setup() Serial.begin(9600); void loop() int reading = analogRead(sensorPin); float voltage = reading * 5.0 / 1024.0; float tempF = voltage * 100.0; float tempC = (tempF-32)/1.8000; Serial.println(tempC); delay(500); Serial.println(tempF);Code đo sức nóng độ cảm biến DS18B20:
/* * Kết nối: * VCC ---- 5V (Arduino) * GND ---- GND (Arduino) * T2 ---- 2 (Arduino) * * */ #include OneWire.h> #include DallasTemperature.h>#define ONE_WIRE_BUS 2 OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire);void setup(void) Serial.begin(9600); // Start up the library sensors.begin(); void loop(void) Serial.print(" Requesting temperatures..."); sensors.requestTemperatures(); Serial.println("DONE"); Serial.print("Temperature is: "); Serial.print(sensors.getTempCByIndex(0)); delay(1000);