找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5417|回复: 1
打印 上一主题 下一主题
收起左侧

ph检测计arduino程序设计及其原理图

[复制链接]
跳转到指定楼层
楼主
分享个ph检测计设计及其原理图
电路原理图如下:


arduino单片机源程序如下:
  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. }



复制代码

所有资料51hei提供下载:





PH composite electrode manual.pdf

213.35 KB, 下载次数: 16, 下载积分: 黑币 -5

ph meter V1.0 layout.pdf

87.16 KB, 下载次数: 16, 下载积分: 黑币 -5

phMeterSample.zip

898 Bytes, 下载次数: 17, 下载积分: 黑币 -5

原理图.pdf

104.57 KB, 下载次数: 17, 下载积分: 黑币 -5

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:316660 发表于 2018-4-25 22:09 | 只看该作者
希望大家多多指教
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表