Mission 7- Weather Station
 DuinoKit Jr. - View Only. See new "Mission Manual" forum for manual and code   Started by Daniel Alich   2017-06-27 18:31:10 -04:00   Comments: 4    Viewed: 3964

  1. Daniel Alich
    Daniel Alich Member Staff Member
    252_1498602610_Mission 7-1.jpg

    252_1498602602_Mission 7-2.jpg

    We are trying something a little bit different here.  This program requires you to install a "library file" to understand data from the DHT11 (Digital Temperature and Humidity Sensor) so we can make the weather station function.

    Included in this .ZIP file is the instructions for installing the library file OR you should be able to run the program directly from the downloaded folder.  You will notice the library files are included in the file folder and will open in a separate tab wile opening the .ino file.  There are also instructions in the code if you wish to install the library directly on your computer for future reference.

    https://drive.google.com/open?id=1Nyu8g-xSiArth5dkIfAGcH24x8nWFMcj

    Daniel Alich, 2017-06-27 18:31:10 -04:00
  2. Andy Eades
    Andy Eades Member
    I couldn't get the above sketch to work.  Below is the sketch I created that seems to work with the DHT11.zip libraries in the post and wired as shown.

    //
    //

    #include <LiquidCrystal.h>
    #include <dht.h>
    LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

    dht DHT;

    #define DHT11_PIN 8
    #define DHT21_PIN 5
    #define DHT22_PIN 6

    void setup()
    {
    Serial.begin(115200);
    Serial.println("DHT TEST PROGRAM ");
    Serial.print("LIBRARY VERSION: ");
    Serial.println(DHT_LIB_VERSION);
    Serial.println();
    Serial.println("Type,tstatus,tHumidity (%),tTemperature (C)");
    lcd.begin(16, 2);
    }

    void loop()
    {

    // READ DATA
    Serial.print("DHT11, t");
    int chk = DHT.read11(DHT11_PIN);
    switch (chk)
    {
    case DHTLIB_OK:
    Serial.print("OK,t");
    break;
    case DHTLIB_ERROR_CHECKSUM:
    Serial.print("Checksum error,t");
    break;
    case DHTLIB_ERROR_TIMEOUT:
    Serial.print("Time out error,t");
    break;
    default:
    Serial.print("Unknown error,t");
    break;
    }
    // DISPLAY DATA
    Serial.print(DHT.humidity,1);
    Serial.print(",t");
    float t = DHT.temperature;
    float h = DHT.humidity;
    t = t* 9/5 + 32;
    Serial.println(t,1);
    if (isnan(t) || isnan(h)) {
    lcd.setCursor(0, 0);
    lcd.print("Failed to read from DHT");
    //Serial.println("Failed to read from DHT");
    } else {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Humidity: ");
    lcd.print(h);
    lcd.print("%");
    lcd.setCursor(0, 1);
    lcd.print("Temp: ");
    lcd.print(t);
    lcd.print(" f");
    }
    delay(1000);
    }
    //
    // END OF FILE
    //
    Andy Eades, 2018-08-24 20:28:39 -04:00
  3. Noah
    Noah Member Saint Clair Shores
    Hi, 
    I'm getting an error code for this sketch. It is saying, "Error compiling for board Arduino Nano"
    Any advice?
    I used both the Sketch that was included on the thumb drive as well as the code above. The code above however was giving me far more complicatede errors than the included sketch.
    Noah, 2020-04-13 14:39:47 -04:00
  4. Elisha Wu
    Elisha Wu Member Revesby
    IT don't work for aduino nano oldbootloader or new.
    Elisha Wu, 2020-06-12 04:32:25 -04:00
  5. (You must log in or sign up to post here)

Report Post

Write your reason

Log in | Sign up
Terms & Conditions!
Help!