Go Down

Topic: sensor HIH 43030 sparkfun [fr] (Read 371 times) previous topic - next topic

florent117

Apr 21, 2014, 10:27 pm Last Edit: Apr 22, 2014, 07:15 pm by florent117 Reason: 1
Bonjours, pouvez vous m'aider à comprendre le programme svp. C'est pour mon bac , je dois faire un programme pour mesurer la tempérarure, humidté etc. Je voudrais qu'on m'explique la partie avec les calculs. Merci de votre aide :smiley-red:

int HIH4030_Pin = A0; //analog pin 0

void setup(){
 Serial.begin(9600);
}

void loop(){

 //To properly caculate relative humidity, we need the temperature.
 float temperature = 25; //replace with a thermometer reading if you have it
 float relativeHumidity  = getHumidity(temperature);

 Serial.println(relativeHumidity);

 delay(500); //just here to slow it down so you can read it
}


float getHumidity(float degreesCelsius){
 //caculate relative humidity
 float supplyVolt = 5.0;

 // read the value from the sensor:
 int HIH4030_Value = analogRead(HIH4030_Pin);
 float voltage = HIH4030_Value/1023. * supplyVolt; // convert to voltage value

 // convert the voltage to a relative humidity
 // - the equation is derived from the HIH-4030/31 datasheet
 // - it is not calibrated to your individual sensor
 //  Table 2 of the sheet shows the may deviate from this line
 float sensorRH = 161.0 * voltage / supplyVolt - 25.8;
 float trueRH = sensorRH / (1.0546 - 0.0026 * degreesCelsius); //temperature adjustment

 return trueRH;
}

michinyon

Est google brisé dans votre pays ?



robtillaart

Please rephrase your question in English on the international part of the forum...
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up