Skip to content

Commit 9af22ad

Browse files
committed
version 1.1
1 parent bf5ca9f commit 9af22ad

1 file changed

Lines changed: 110 additions & 0 deletions

File tree

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
2+
/*
3+
# Cet code rassemble tous les capteurs
4+
# Ver : 1.1
5+
# Product: analog pH meter, turbidity, ORP, EC Meter, Temperature, anemometre, rain jauge
6+
# Author : Bassirou NGOM
7+
# email : bassiroungom26@gmail.com
8+
*/
9+
10+
/*************************
11+
* inclusion
12+
* **********************/
13+
14+
#include <OneWire.h>
15+
16+
/***********************
17+
* Constantes *
18+
* **********************/
19+
#define SensorPinPH A0
20+
#define SensorPinEC A1
21+
#define SensorPinTurbidity A3
22+
#define SensorPinORP A3
23+
const byte BROCHE_ONEWIRE = 2;
24+
25+
/*************************
26+
* constantes PH *
27+
* **********************/
28+
#define OffsetPH 0.00 //compensation de la deviation
29+
#define LED 13 //le pin du led sur la carte
30+
#define intervalMesure 20 //intervalle de ou on lit les valeurs sur le pin SensorPinPH
31+
#define intervalConvertion 800 //intervalle ou les valeurs prises seront convertis en ph
32+
#define tailleEchantillon 40 //taille des echantillons
33+
int tableauPh[tailleEchantillon]; //tableau stokage des echantillons
34+
int indexPh=0;
35+
36+
/***************************************
37+
* constantes EC et tamperature *
38+
* ************************************/
39+
#define StartConvert 0
40+
#define ReadTemperature 1
41+
42+
const byte numReadings = 20; //the number of sample times
43+
//byte SensorPinEC = A1; //EC Meter analog output,pin on analog 1
44+
byte DS18B20_Pin = 7; //DS18B20 signal, pin on digital 7
45+
unsigned int AnalogSampleInterval=25,printInterval=700,tempSampleInterval=850; //analog sample interval;serial print interval;temperature sample interval
46+
unsigned int readings[numReadings]; // the readings from the analog input
47+
byte index = 0; // the index of the current reading
48+
unsigned long AnalogValueTotal = 0; // the running total
49+
unsigned int AnalogAverage = 0,averageVoltage=0; // the average
50+
unsigned long AnalogSampleTime,printTime,tempSampleTime;
51+
float temperature,ECcurrent;
52+
53+
OneWire dsEC(DS18B20_Pin); // on digital pin 2
54+
/* Code de retour de la fonction getTemperature() */
55+
enum DS18B20_RCODES {
56+
READ_OK, // Lecture ok
57+
NO_SENSOR_FOUND, // Pas de capteur
58+
INVALID_ADDRESS, // Adresse reçue invalide
59+
INVALID_SENSOR // Capteur invalide (pas un DS18B20)
60+
};
61+
62+
/* Création de l'objet OneWire pour manipuler le bus 1-Wire */
63+
OneWire ds(BROCHE_ONEWIRE);
64+
65+
66+
/***********************
67+
* constantes ORP *
68+
* ********************/
69+
#define VOLTAGE 5.00 //system voltage
70+
#define OFFSET 7 //zero drift voltage
71+
//#define LED 13 //operating instructions
72+
73+
double orpValue;
74+
75+
#define ArrayLenth 40 //times of collection
76+
#define orpPin 1 //orp meter output,connect to Arduino controller ADC pin
77+
78+
int orpArray[ArrayLenth];
79+
int orpArrayIndex=0;
80+
81+
82+
/******************************
83+
* declaration des Fonctions *
84+
* ***************************/
85+
byte getTemperature(float *temperature, byte reset_search);
86+
float getPh();
87+
double moyenne(int* arr, int number);
88+
float getTurbidity();
89+
double avergearray(int* arr, int number);
90+
int getORP();
91+
void initEC();
92+
float TempProcess(bool ch);
93+
float getEC();
94+
95+
//
96+
97+
void setup(){
98+
99+
}
100+
101+
void loop()
102+
{
103+
104+
}
105+
106+
107+
108+
109+
110+

0 commit comments

Comments
 (0)