Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
| materiels:capteurs:ph:ph [2019/10/22 11:20] – [Capteurs - PH] philippe | materiels:capteurs:ph:ph [2025/06/19 19:30] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | [[materiels: | ||
| + | |||
| + | ===== Capteurs - pH ===== | ||
| + | |||
| + | [Mise à jour le 7/7/2022] | ||
| + | |||
| + | |||
| + | ==== Généralités ==== | ||
| + | {{ : | ||
| + | Le sigle " | ||
| + | Plus souvent, le pH mesure l’acidité ou la basicité d’une solution. Ainsi, dans un milieu aqueux à 25 °C : | ||
| + | * une solution de **pH = 7** est dite **neutre** ; | ||
| + | * une solution de **pH < 7** est dite **acide** ; plus son pH diminue, plus elle est acide ; | ||
| + | * une solution de **pH > 7** est dite **basique** ; plus son pH augmente, plus elle est basique.< | ||
| + | |||
| + | ---- | ||
| + | |||
| + | |||
| + | ==== Sonde pH + interface pro SEN0169 ==== | ||
| + | {{ : | ||
| + | * // Source // : < | ||
| + | |||
| + | <callout type=" | ||
| + | |||
| + | L' | ||
| + | |||
| + | * // Distributeur // : < | ||
| + | |||
| + | * // Caractéristiques // | ||
| + | * Alimentation: | ||
| + | * Plage de mesure de pH: 0 à 14 | ||
| + | * Température de fonctionnement: | ||
| + | * Précision: ± 0,1 pH (25 °C) | ||
| + | * Temps de réponse: ≤ 1min | ||
| + | * Dimensions: | ||
| + | * sonde: Ø33 x 180 mm | ||
| + | * interface: 43 x 32 x 15 mm | ||
| + | * Tube en plastique résistant aux chocs. | ||
| + | * La sonde est livrée avec 5 m de câble et un connecteur BNC. | ||
| + | |||
| + | {{ : | ||
| + | * // Documentation // | ||
| + | * < | ||
| + | * < | ||
| + | |||
| + | * // Modèle de la sonde de pH// | ||
| + | {{ : | ||
| + | |||
| + | * //Connexion à un shield// < | ||
| + | {{ : | ||
| + | |||
| + | * // Un premier exemple pour tester le capteur // | ||
| + | |||
| + | {{ : | ||
| + | <code cpp ph.cpp> | ||
| + | /* | ||
| + | # This sample code is used to test the pH meter V1.0. | ||
| + | # Editor : YouYou | ||
| + | # Ver : 1.0 | ||
| + | # Product: analog pH meter | ||
| + | # SKU : SEN0161 | ||
| + | */ | ||
| + | #define SensorPin A0 //pH meter Analog output to Arduino Analog Input 0 | ||
| + | #define Offset 0.00 //deviation compensate | ||
| + | #define LED 13 | ||
| + | #define samplingInterval 20 | ||
| + | #define printInterval 800 | ||
| + | #define ArrayLenth | ||
| + | int pHArray[ArrayLenth]; | ||
| + | int pHArrayIndex=0; | ||
| + | void setup(void) | ||
| + | { | ||
| + | pinMode(LED, | ||
| + | Serial.begin(9600); | ||
| + | Serial.println(" | ||
| + | } | ||
| + | void loop(void) | ||
| + | { | ||
| + | static unsigned long samplingTime = millis(); | ||
| + | static unsigned long printTime = millis(); | ||
| + | static float pHValue, | ||
| + | if(millis()-samplingTime > samplingInterval) | ||
| + | { | ||
| + | pHArray[pHArrayIndex++]=analogRead(SensorPin); | ||
| + | if(pHArrayIndex==ArrayLenth)pHArrayIndex=0; | ||
| + | voltage = avergearray(pHArray, | ||
| + | pHValue = 3.5*voltage+Offset; | ||
| + | samplingTime=millis(); | ||
| + | } | ||
| + | if(millis() - printTime > printInterval) | ||
| + | { | ||
| + | Serial.print(" | ||
| + | Serial.print(voltage, | ||
| + | Serial.print(" | ||
| + | Serial.println(pHValue, | ||
| + | digitalWrite(LED, | ||
| + | printTime=millis(); | ||
| + | } | ||
| + | } | ||
| + | double avergearray(int* arr, int number){ | ||
| + | int i; | ||
| + | int max,min; | ||
| + | double avg; | ||
| + | long amount=0; | ||
| + | if(number< | ||
| + | Serial.println(" | ||
| + | return 0; | ||
| + | } | ||
| + | if(number< | ||
| + | for(i=0; | ||
| + | amount+=arr[i]; | ||
| + | } | ||
| + | avg = amount/ | ||
| + | return avg; | ||
| + | }else{ | ||
| + | if(arr[0]< | ||
| + | min = arr[0]; | ||
| + | } | ||
| + | else{ | ||
| + | min=arr[1]; | ||
| + | } | ||
| + | for(i=2; | ||
| + | if(arr[i]< | ||
| + | amount+=min; | ||
| + | min=arr[i]; | ||
| + | }else { | ||
| + | if(arr[i]> | ||
| + | amount+=max; | ||
| + | max=arr[i]; | ||
| + | }else{ | ||
| + | amount+=arr[i]; | ||
| + | } | ||
| + | }//if | ||
| + | }//for | ||
| + | avg = (double)amount/ | ||
| + | }//if | ||
| + | return avg; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | {{ : | ||
| + | <callout type=" | ||