Nanomesher
Published © GPL3+

Multi-Location Weather Station

Build your own multi-location weather station and display the data wirelessly on one screen.

IntermediateShowcase (no instructions)5,423
Multi-Location Weather Station

Things used in this project

Hardware components

Wemos D1 Mini
Espressif Wemos D1 Mini
×1
Nanomesher Human Machine Interface
×1
Sensirion SHT31
×1
Resistor 4.7k Ohm
×2
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

WeatherSender Schematic

A very simple weather logger which uses SHT3x sensor with i2c interface. The Arduino software will read data and send the data to Nanomesher HMI via HTTP

Code

WeatherSender

Arduino
Arduino code for reading Humidity and Temperature from SHT31 and update data on the display.

Before using the code, change:
- SSID / PASSWORD
- ip address in http://192.168.1.12/TextSetText?p=0&n=line1&v=
- line1 - line4 depending on location of the sensor in http://192.168.1.12/TextSetText?p=0&n=line1&v=
#include <Arduino.h>

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <Wire.h>
#include "Adafruit_SHT31.h"
#include <ESP8266HTTPClient.h>

#define USE_SERIAL Serial

ESP8266WiFiMulti WiFiMulti;

float t = 0;
float h = 0;


Adafruit_SHT31 sht31 = Adafruit_SHT31();

void setup() {

    USE_SERIAL.begin(115200);
   // USE_SERIAL.setDebugOutput(true);

    USE_SERIAL.println();
    USE_SERIAL.println();
    USE_SERIAL.println();

    for(uint8_t t = 4; t > 0; t--) {
        USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
        USE_SERIAL.flush();
        delay(1000);
    }

    WiFiMulti.addAP("SSID", "PASSWORD");

}

void loop() {
    // wait for WiFi connection
    if((WiFiMulti.run() == WL_CONNECTED)) {

        t = sht31.readTemperature();
        h = sht31.readHumidity();

        
        char temp[10];
        dtostrf(t,1,1,temp);

        char humid[10];
        dtostrf(h,1,1,humid);
        
        String url = "http://192.168.1.12/TextSetText?p=0&n=line1&v=";
        
        HTTPClient http;

        USE_SERIAL.print("[HTTP] begin...\n");
        http.begin(url + temp + "c " + humid + "%"); //HTTP

        USE_SERIAL.print("[HTTP] GET...\n");
        // start connection and send HTTP header
        int httpCode = http.GET();

        // httpCode will be negative on error
        if(httpCode > 0) {
            // HTTP header has been send and Server response header has been handled
            USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);

            // file found at server
            if(httpCode == HTTP_CODE_OK) {
                String payload = http.getString();
                USE_SERIAL.println(payload);
            }
        } else {
            USE_SERIAL.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
        }

        http.end();
    }

    delay(10000);
}

Credits

Nanomesher

Nanomesher

1 project • 5 followers
We are a new startup developing IOT products.

Comments