Measuring Temp./humidity With DHT11 Using Arduino

72

2

This is the brains of our operation and it will help us to collect data using temperature and humidity through some of our other sensors that are attached and will be explained in the instructable later. -Jace

Step 1: DHT Sensor

This is our DHT sensor and this is what plugs into our Arduino as explained earlier. This sensor will collect the temperature and humidity while orbiting in the air. -Jace

Step 2: Breadboard

This is the breadboard and it is used to connect wiring from sensors to the arduino. -Taylan

Step 3: Wiring

This is our wiring and it connects the code from one sensor to the arduino so that it can collect the data electronically. In this picture we have the DHT11 sensor connected to the arduino and USB data recorder. The use of this is so we can measure accurate temperature of mars's atmosphere. -Taylan

Step 4: Building Cube Sat

As my other group members are working on coding and wiring, i have been building our 10X10X10 cube sat. As you can see by the picture i used 6 Popsicle sticks. 4 to build a square and then 2 more across each other. i built 5 of these and hot glued them all together. I put metal rods on the sides to help it to be sturdier to pass our shake test. -Jace

Step 5: Cube Sat Continued

Since i only built 5 sides of the cube sat, i attacked a piece of cardboard to the top using screws and metal holders to push down on the cardboard to keep it secure. This is very helpful for easy access to put our Arduino and breadboard in the cube sat so that it will be secured on the shelf that I built. -Jace

Step 6: Flight Test Video

This is our flight test video showing our cube sat orbiting around mars. This shows that our cube sat can withstand the forces against it while orbiting. -zach

Step 7: Coding

This is me working on the code so that it will display the data taken from our studies to save the data on the SD card. When the data saves, i can export this to my computer and we can see what the temperature and the humidity was on Mars. This was a very hard part for me as the SD card was not saving the data very well.-zach

Our Code:

#include
#include

#include #include #include

// Example testing sketch for various DHT humidity/temperature sensors // Written by ladyada, public domain

// REQUIRES the following Arduino libraries: // - DHT Sensor Library: https://github.com/adafruit/DHT-sensor-library // - Adafruit Unified Sensor Lib: https://github.com/adafruit/Adafruit_Sensor

#define DHTPIN 2 // Digital pin connected to the DHT sensor // Feather HUZZAH ESP8266 note: use pins 3, 4, 5, 12, 13 or 14 -- // Pin 15 can work but DHT must be disconnected during program upload.

// Uncomment whatever type you're using! #define DHTTYPE DHT11 // DHT 11 //#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321 //#define DHTTYPE DHT21 // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V // NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1 // to 3.3V instead of 5V! // Connect pin 2 of the sensor to whatever your DHTPIN is // Connect pin 4 (on the right) of the sensor to GROUND // Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

// Initialize DHT sensor. // Note that older versions of this library took an optional third parameter to // tweak the timings for faster processors. This parameter is no longer needed // as the current DHT reading algorithm adjusts itself to work on faster procs. DHT dht(DHTPIN, DHTTYPE);

File Data;

void setup() { dht.begin(); pinMode (10, OUTPUT); SD.begin (4); Serial.begin(9600); Serial.println(F("DHTxx test!"));

}

void loop() { // Wait a few seconds between measurements. delay(2000);

// Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)

float h = dht.readHumidity(); // Read temperature as Celsius (the default) float t = dht.readTemperature(); // Read temperature as Fahrenheit (isFahrenheit = true) float f = dht.readTemperature(true);

// Compute heat index in Fahrenheit (the default) float hif = dht.computeHeatIndex(f, h); // Compute heat index in Celsius (isFahreheit = false) float hic = dht.computeHeatIndex(t, h, false);

Data = SD.open ("Log.txt", FILE_WRITE); //opens file called "Log" if (Data) { //will only do rest if file successfully created

Serial.print(F("Humidity: ")); Serial.print(h); Serial.print(F("% Temperature: ")); Serial.print(t); Serial.print(F("°C ")); Serial.print(f); Serial.print(F("°F Heat index: ")); Serial.print(hic); Serial.print(F("°C ")); Serial.print(hif); Serial.println(F("°F")); } Data.print(h); //writes temp data to file Data.print(","); //prints comma in file Data.print(t); //write temperature in ferinheit to file Data.print(","); //prints comma in file Data.println(f); //writes temperature to file Data.close(); //closes file }

Share

    Recommendations

    • Frozen Treats Challenge

      Frozen Treats Challenge
    • Fandom Contest

      Fandom Contest
    • Pets Challenge

      Pets Challenge

    Discussions