Remote Meteorological Station with UDOO - pt 1: Sensors

Discussion in 'Other Projects' started by jey86, Jan 16, 2014.

  1. jey86

    jey86 New Member

    Joined:
    Jan 16, 2014
    Messages:
    4
    Likes Received:
    0
    http://www.youtube.com/watch?v=YEwICJazC3o

    Hello guys, this is the first part of a project which will help you to create a remote meteorological station that monitors humidity, temperature and pressure. We are dividing the projects in few parts in order to allow you to better understand the logics and components behind the project. All the data collected by the meteorological station could be remotely accessed via web thanks to a UDOO's self hosted server made with apache and MySQL, this means that we will browse our meteorological data from anywhere with our favorite devices: smartphone, tablets or directly on UDOO.

    In this first tutorial we are going to connect DHT11, a temperature and humidity sensor, with UDOO through the Arduino IDE.

    For this tutorial you need:


    - a UDOO board (Dual or Quad is the same)
    - a DHT11 sensor (for example you can find it here http://www.adafruit.com/products/386)
    - 2 colored LEDs
    - a breadboard


    Let's start

    First you need to insert the micro SD in your UDOO, connect the HDMI, the keyboard and mouse then power it up.

    Ok, you are now ready to download the DHT11 library (http://playground.arduino.cc/main/DHT11Lib/)
    The library has two file: one header and one file .cpp, so copy the code of dht11.h in a new file with the same name and do the same with dht11.cpp.
    Create a new folder with the name "DHT11" and put the files into, then move the folder in /Home/Arduino/libraries

    Now go to Arduino IDE and add the library at the sketch, then you will see:
    Code:
    #include 
    
    void setup() {
    }
    
    void loop() {
    }
    Create a new object of type DHT11 and define the pins for the sensor and for the alert LEDs.

    Code:
    dht11 DHT11;
    
    #define DHT11PIN 13
    int led_hum = 12;
    int led_temp = 11;
    In void setup() initialize the serial monitor with 9600 baud, then insert two strings of text for the physical aspect of the sketch and set in output the pinmode of the two alert led

    Code:
    void setup() {
      delay(5000);
      Serial.begin(9600);
      Serial.println("UDOO & DHT11 - TEST PROGRAM By Alessandro Paghi");
      Serial.println("Humidity (%)\tTemperature (C)\tLed_Hum\t\tLed_Temp");
      pinMode(led_hum, OUTPUT);
      pinMode(led_temp, OUTPUT);
    
    }
    In void loop() call the function read() with the parameter DHT11pin

    Code:
      DHT11.read(DHT11PIN);
    Then print in the serial monitor the value of humidity and temperature
    Code:
     Serial.print(DHT11.humidity);
     Serial.print("\t\t");
     Serial.print(DHT11.temperature);
     Serial.print("\t\t");
    Execute a control on a value of humidity. If it has a value greater than 45%, turn on the green alert led, else turn off.

    Code:
     if(DHT11.humidity>45)
      {
        digitalWrite(led_hum, HIGH);
        Serial.print("ON\t\t");
      }
      else
      {
        digitalWrite(led_hum, LOW);
        Serial.print("OFF\t\t");
      }
    Execute a control on a value oh temperature. If it has a value greater than 23°C, turn one the white alert led, else turno off.
    Code:
      if(DHT11.temperature>23)
      {
        digitalWrite(led_temp, HIGH);
        Serial.println("ON");
      }
      else
      {
        digitalWrite(led_temp, LOW);
        Serial.println("OFF");
      }
    Insert a deley of two seconds
    Code:
    delay(2000);
    Okay guys, now connect physically the component and compile and run the sketch.
    When humidity is greter than 45% led green turn on and when temperature in greater than 23°C led white turn on.

    For download the Arduino sketch: http://udoo.org/wp-content/uploads/2013/11/UDOO_DHT11.ino

    Let's start the discussion!
     
  2. gonne

    gonne New Member

    Joined:
    Jul 24, 2014
    Messages:
    6
    Likes Received:
    0
    I have a doubt! If you supply the sensor DTH11 with 5V, the serial data level should be 5V, but aren't UDOO pin 3.3V only?
     

Share This Page