Blog Home

Stream weather conditions to the cloud!

Arduino TeamNovember 26th, 2018

Weather reports on the news, your computer, or smartphone are very good—something that people 100 years ago could only dream of—but what if you want to know the exact weather in a fixed location from anywhere in the world? One solution would be Jakub Nagy’s excellent cloud-connected station.

It uses an Arduino Uno to collect data from temperature, humidity, pressure, and UV index sensors, along with a Nano to read a rain gauge. The data, with images from a webcam, are passed along to a service called Weathercloud, where this report out of the Slovak Republic can be viewed remotely. 

If you’d like to assemble a similar device to measure conditions in your area, instructions are available in his write-up, including a parts list that will run around $130.

Boards:NanoUno
Categories:ArduinoFeatured

2 Responses to “Stream weather conditions to the cloud!”

  1. arlingtondesign Says:

    Very well written.

  2. Vinod_pnwar944 Says:

    Hello All., I need your help. I am making an IoT based data logger in which I am going to store temp and humidity value in ThingSpeak server by using ESP8266 Wi-Fi module and DHT-11 sensor. Here I am struggling to send the value to ThingSpeak server. In Arduino uno monitor screen it’s not showing that my WiFi module is connected to the WiFi.

    Following is the code that I am using in Arduino uno.
    Can anybody help me out.
    Thanking you All.

    /* Arduino+esp8266 thingSpeak example
    * Example name = “Write temperature and humidity to Thingspeak channel”

    // Code to use SoftwareSerial
    #include
    SoftwareSerial espSerial = SoftwareSerial(2,3); // arduino RX pin=2 arduino TX pin=3 connect the arduino RX pin to esp8266 module TX pin – connect the arduino TX pin to esp8266 module RX pin

    #include //Attention: For new DHT11 version library you will need the Adafruit_Sensor library

    #define DHTPIN 5 // Connect the signal pin of DHT11 sensor to digital pin 5
    //#define DHTTYPE DHT11
    DHT dht;

    String apiKey = “XXXXXXXXXXXXXXXX”; // replace with your channel’s thingspeak WRITE API key

    String ssid=”XXXXXXXXX”; // Wifi network SSID
    String password =”XXXXXXXX”; // Wifi network password

    boolean DEBUG=true;

    //======================================================================== showResponce
    void showResponse(int waitTime){
    long t=millis();
    char c;
    while (t+waitTime>millis()){
    if (espSerial.available()){
    c=espSerial.read();
    if (DEBUG) Serial.print(c);
    }
    }

    }

    //================================================================================ setup
    void setup() {
    DEBUG=true; // enable debug serial
    Serial.begin(9600);

    dht.setup(5); // Start DHT sensor

    espSerial.begin(115200); // enable software serial
    // Your esp8266 module’s speed is probably at 115200.
    // For this reason the first time set the speed to 115200 or to your esp8266 configured speed
    // and upload. Then change to 9600 and upload again

    espSerial.println(“AT+CIOBAUD=9600”);
    showResponse(1000);
    // espSerial.println(“AT+RST”); // Enable this line to reset the module;
    // showResponse(1000);

    //espSerial.println(“AT+UART_CUR=9600,8,1,0,0”); // Enable this line to set esp8266 serial speed to 9600 bps
    //showResponse(1000);

    espSerial.println(“AT+CWMODE=1”); // set esp8266 as client
    showResponse(1000);

    espSerial.println(“AT+CWJAP=\””+ssid+”\”,\””+password+”\””); // set your home router SSID and password
    showResponse(5000);

    if (DEBUG) Serial.println(“Setup completed”);
    }

    // ====================================================================== loop
    void loop() {

    // Read sensor values
    float t = dht.getTemperature();
    float h = dht.getHumidity();
    if (isnan(t) || isnan(h)) {
    if (DEBUG) Serial.println(“Failed to read from DHT”);
    }
    else {
    if (DEBUG) Serial.println(“Temp=”+String(t)+” *C”);
    if (DEBUG) Serial.println(“Humidity=”+String(h)+” %”);
    thingSpeakWrite(t,h); // Write values to thingspeak
    }

    // thingspeak needs 15 sec delay between updates,
    delay(20000);

    }

    //========================================================================
    boolean thingSpeakWrite(float value1, float value2){
    String cmd = “AT+CIPSTART=\”TCP\”,\””; // TCP connection
    cmd += “184.106.153.149”; // api.thingspeak.com
    cmd += “\”,80″;
    espSerial.println(cmd);
    if (DEBUG) Serial.println(cmd);
    if(espSerial.find(“Error”)){
    if (DEBUG) Serial.println(“AT+CIPSTART error”);
    return false;
    }

    String getStr = “GET /update?api_key=”; // prepare GET string
    getStr += apiKey;

    getStr +=”&field1=”;
    getStr += String(value1);
    getStr +=”&field2=”;
    getStr += String(value2);
    // getStr +=”&field3=”;
    // getStr += String(value3);
    // …
    getStr += “\r\n\r\n”;

    // send data length
    cmd = “AT+CIPSEND=”;
    cmd += String(getStr.length());
    espSerial.println(cmd);
    if (DEBUG) Serial.println(cmd);

    delay(100);
    if(espSerial.find(“>”)){
    espSerial.print(getStr);
    if (DEBUG) Serial.print(getStr);
    }
    else{
    espSerial.println(“AT+CIPCLOSE”);
    // alert user
    if (DEBUG) Serial.println(“AT+CIPCLOSE”);
    return false;
    }
    return true;
    }

Leave a Reply

You must be logged in with your Arduino account to post a comment.