Adds

25 June 2015

Arduino with DHT11 - Prints temperature and humidity to PLXDAQ Excel spreadsheet and serial monitor

Code gets:

- Temperature and Humidity from a DHT11 sensor

Prints the data to the Serial Monitor

Data is sent to an Excel spreadsheet through data acquisition software, PLX-DAQ, Download here

Please let me know if you experience any problems with this code. Be sure to check back for more Arduino code.

Schematic:




Code:


 /*  
   
 Oliver Holden  
 Created 28/10/2014  
   
 Components:  
 * Arduino UNO  
 * DHT11  
 * 4.7K resistor  
   
 - Gets Temperature and Humidity from a DHT11 sensor  
   
 - RGB LED changes colour depending on the Temperature   
   
 Prints the data to the Serial Monitor  
   
 Data is sent to an Excel spreadsheet through data   
 acquisition software, PLX-DAQ, Download http://www.parallax.com/downloads/plx-daq  
   
 Schematic for this project is on  
 http://breadboarder.blogspot.co.uk/  
   
 */  
   
   
 #include <dht.h>   // Including libary to read DHT11   
    
 dht DHT;   // Need this   
   
 int x = 0;   // For PLX-DAQ  
 int row = 0;   // For PLX-DAQ  
   
 int dht_dpin = A0;   // DHT11 data pin attached to A2   
    
 void setup(){     
    
  Serial.begin(9600);   // Opening serial connection at 9600bps   
  Serial.println("Humidity and temperature");   // Printing Serial Monitor header  
  Serial.println("LABEL, Time, T (C)");   // Setting headers of colums in PLX-DAQ spreadsheet  
  delay(1000);   // Wait 1 second before printing data to Serial Monitor  
  }  
    
 void loop(){     
    
  DHT.read11(dht_dpin);   // Reading data from DHT11  
    
   Serial.print("Current humidity = ");   // Printing text  
    
   Serial.print(DHT.humidity);     
   Serial.print("% ");     
   Serial.print("temperature = ");     
   Serial.print(DHT.temperature);     
   Serial.println("C ");     
     
 row++;   // For PLX-DAQ  
 x++;   // For PLX-DAQ  
    
  delay(1000);   // Sensor shouldn't be read too frequently so delay of 1s  
    
  }  

1 comment:

  1. i am not getting output on excel sheet and i am using windows.Please help me

    ReplyDelete