找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 6276|回復(fù): 1
收起左側(cè)

ph檢測(cè)計(jì)arduino程序設(shè)計(jì)及其原理圖

[復(fù)制鏈接]
ID:316660 發(fā)表于 2018-4-25 22:08 | 顯示全部樓層 |閱讀模式
分享個(gè)ph檢測(cè)計(jì)設(shè)計(jì)及其原理圖
電路原理圖如下:
0.jpg

arduino單片機(jī)源程序如下:
  1. /*
  2. # This sample codes is for testing the pH meter V1.0.
  3. # Editor : YouYou
  4. # Ver    : 0.1
  5. # Product: pH meter
  6. # SKU    : SEN0161
  7. */

  8. #define SensorPin 0          //pH meter Analog output to Arduino Analog Input 0
  9. unsigned long int avgValue;  //Store the average value of the sensor feedback
  10. float b;
  11. int buf[10],temp;

  12. void setup()
  13. {
  14.   pinMode(13,OUTPUT);  
  15.   Serial.begin(9600);  
  16.   Serial.println("Ready");    //Test the serial monitor
  17. }
  18. void loop()
  19. {
  20.   for(int i=0;i<10;i++)       //Get 10 sample value from the sensor for smooth the value
  21.   {
  22.     buf[i]=analogRead(SensorPin);
  23.     delay(10);
  24.   }
  25.   for(int i=0;i<9;i++)        //sort the analog from small to large
  26.   {
  27.     for(int j=i+1;j<10;j++)
  28.     {
  29.       if(buf[i]>buf[j])
  30.       {
  31.         temp=buf[i];
  32.         buf[i]=buf[j];
  33.         buf[j]=temp;
  34.       }
  35.     }
  36.   }
  37.   avgValue=0;
  38.   for(int i=2;i<8;i++)                      //take the average value of 6 center sample
  39.     avgValue+=buf[i];
  40.   float phValue=(float)avgValue*5.0/1024/6; //convert the analog into millivolt
  41.   phValue=3.5*phValue;                      //convert the millivolt into pH value
  42.   Serial.print("    pH:");  
  43.   Serial.print(phValue,2);
  44.   Serial.println(" ");
  45.   digitalWrite(13, HIGH);      
  46.   delay(800);
  47.   digitalWrite(13, LOW);

  48. }



復(fù)制代碼

所有資料51hei提供下載:





PH composite electrode manual.pdf

213.35 KB, 下載次數(shù): 20, 下載積分: 黑幣 -5

ph meter V1.0 layout.pdf

87.16 KB, 下載次數(shù): 18, 下載積分: 黑幣 -5

phMeterSample.zip

898 Bytes, 下載次數(shù): 17, 下載積分: 黑幣 -5

原理圖.pdf

104.57 KB, 下載次數(shù): 19, 下載積分: 黑幣 -5

回復(fù)

使用道具 舉報(bào)

ID:316660 發(fā)表于 2018-4-25 22:09 | 顯示全部樓層
希望大家多多指教
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表