temperature and humidity supervision System


temperature and humidity supervision System

in this project temperature and humidity supervision ,this system  is based on arduino as controller and DHT22 sensor interfaced with labview . 

first i will begin with the arduino part :
to begin with lets connect  the  sensor to the arduino like in the picture below

  • pin 1  to VCC (red wire)
  • pin 2  Data pin with pin 2 inthe arduino (yellow wire )
  • pin 3 not used 
  • pin 4 to GND (black wire )


                             
now the arduino code :

                   #include <dht.h>  // import library
                   dht DHT;
                   #define DHT22_PIN 2 // data pin of the DHT22 sensor connected to pin 2
                   void setup()
                   {
                    Serial.begin(9600);  // prepare serial communication 
                    }
                   void loop()
                  {
                  int chk = DHT.read22(DHT22_PIN);  // read value from the sensor
                  float hu =DHT.humidity;                     // get humidity
                  float te =DHT.temperature;                // get temperture
                        if(Serial.available() > 0) {              // if there is data in serial port
                              if(Serial.read() =='t') {            // if the data == 't'
                                     Serial.println(te);             // print temperture
                               }
                               else if(Serial.read() == 'm') { // if data == 'm'
                                     Serial.println(hu);            // print humidity
                               }
                       }
                  }


now to the labview part
i m going to devide it to two sections :

  • serial communication
the picture below present how the communication with the arduino is done ,the main idea is to read the temperature and humidity one at a time so after preparing the serial communication i send to the arduino the letter 't' so that the arduino will return the value of the temperature
and the same for the humidity after sending the letter 'm' to the arduino it will send back the value of the humidity . and the role of the while loop is just to let enough time to receive the value from the arduino






the basics of serial communication :







the first step is to open the serial port using VISA SERIAL



to write data to the serial port we use this bloc




to read data from serial we  use this bloc


  • plotting and saving Data 
in this part the goal is to save Data in the text file and make it look simple and easy to read
so we use the concatinate bloc ,this bloc is used to concatinate strings
concatinat block
the basics of saving data in text file are :




to open or create a file using this bloc







to write in the txt file use this one






and at the end to close the file                                                                   




in the picture below you can find the hole diagramme of the second part







an this is the result
data saved in the text file































Commentaires

  1. Well we extremely get a kick out of the chance to visit this site, numerous valuable data we can arrive. environmental chamber price

    RépondreSupprimer

Enregistrer un commentaire

Posts les plus consultés de ce blog

controle a PWM output in Arduino using LabView

CORDIC Algorithm