Introduction: ESP8266 Weather Monitor Web Server (Without Arduino)

About: We are a group of makers. We work in IoT, IOS app, android app, embedded design, sensor design, raspberry pi, arduino, beaglebone, particle electron, particle photon, Bluetooth.

The “Internet of things”(IoT) is becoming an increasingly growing topic of conversation day by day. It’s a concept that not only has the potential to impact how we live but also how we work. From industrial machines to wearable devices - using built-in sensors to gather data and take action on that data across a network.

So, we decided to build a very simple yet interesting project with the concept - IoT.

Today, we will built a basic web server to monitor the weather around us. We can view the humidity and temperature values on our mobile devices and notebooks. Like i said, its a simple and basic web page to give you idea about it. You can upgarde and modify the project to your needs, like you can collect the data and use it for future use, you can create a home automation by controlling your home appliances or anything you can imagine. Always remember - The power of imagination makes us infinite (by John Muir).

So, lets begin !!

Step 1: Gather Your Tools !!

The SHT25 high accuracy humidity and temperature sensor of Sensirion has become an industry standard in terms of form factor and intelligence: Embedded in a reflow solderable Dual Flat No leads (DFN) package of 3 x 3mm foot print and 1.1mm height it provides calibrated, linearized sensor signals in digital, I2C format.

  • 1 Adafruit Huzzah ESP8266

The ESP8266 processor from Espressif is an 80 MHz microcontroller with a full WiFi front-end (both as client and access point) and TCP/IP stack with DNS support as well. The ESP8266 is an incredible platform for IoT application development. The ESP8266 provides a mature platform for monitoring and control applications using the Arduino Wire Language and the Arduino IDE.

This ESP8266 host adapter was designed specifically for the Adafruit Huzzah version of the ESP8266, allowing I²C interface.

Step 2: Connecting Hardware..

Take the ESP8266 and gently push it over the USB Programmer. Then connect the one end of I2C cable to SHT25 sensor and the other end to the USB Programmer. And you are done. Yes, you read it right. No headaches, sounds cool. Right !!

With the help of ESP8266 USB Programmer, it is very easy to program ESP. All you need to do is plug the sensor into USB Programmer and you are good to go. We prefer to use this product range because it makes a lot easier to connect the hardware. Without these plug and play USB Programmer there is a lot of risk of making wrong connection. A bad wiring can kill your wifi as well as your sensor.

No worrying about soldering the pins of ESP to the sensor or reading the pin diagrams and datasheet. We can use and work on multiple sensors simultaneously, you just need to make a chain.

Here you check the whole product range by them.

Note: While making connections please make sure the brown wire of the connecting cable is connected to the ground terminal of the sensor and same for USB Programmer.

Step 3: Code

The ESP8266 code for SHT25 can be downloaded from our github repository

Before going on to the code, make sure you read the instructions given in the Readme file and setup your ESP8266 according to it. It will take just 5 minutes to setup the ESP.

Now, download (or git pull) the code and open it in the Arduino IDE.

Compile and upload the code and see the output on Serial Monitor.

Note: Before uploading, make sure you enter your SSID network and password in the code.

Copy the IP address of ESP8266 from the Serial Monitor and paste it in your web browser.

You will see a web server with humidity and temperature reading. The output of the sensor on Serial Monitor and Web Server are shown in the picture above.

For your comfort you can copy the working ESP code for this sensor from here also:





// SHT25 I2C address is 0x40(64) #define Addr 0x40

const char* ssid = "your ssid network"; const char* password = "your password"; float humidity, cTemp, fTemp;

ESP8266WebServer server(80);

void handleroot() { unsigned int data[2];

// Start I2C transmission Wire.beginTransmission(Addr); // Send humidity measurement command, NO HOLD master Wire.write(0xF5); // Stop I2C transmission Wire.endTransmission(); delay(500);

// Request 2 bytes of data Wire.requestFrom(Addr, 2);

// Read 2 bytes of data // humidity msb, humidity lsb if (Wire.available() == 2) { data[0] =; data[1] =;

// Convert the data humidity = (((data[0] * 256.0 + data[1]) * 125.0) / 65536.0) - 6;

// Output data to Serial Monitor Serial.print("Relative Humidity :"); Serial.print(humidity); Serial.println(" %RH"); }

// Start I2C transmission Wire.beginTransmission(Addr); // Send temperature measurement command, NO HOLD master Wire.write(0xF3); // Stop I2C transmission Wire.endTransmission(); delay(500);

// Request 2 bytes of data Wire.requestFrom(Addr, 2);

// Read 2 bytes of data // temp msb, temp lsb if (Wire.available() == 2) { data[0] =; data[1] =;

// Convert the data cTemp = (((data[0] * 256.0 + data[1]) * 175.72) / 65536.0) - 46.85; fTemp = (cTemp * 1.8) + 32;

// Output data to Serial Monitor Serial.print("Temperature in Celsius :"); Serial.print(cTemp); Serial.println(" C"); Serial.print("Temperature in Fahrenheit :"); Serial.print(fTemp); Serial.println(" F"); } // Output data to web server server.sendContent ("<html><head><meta http-equiv='refresh' content='5'</meta>" "<h1 style=text-align:center;font-size:300%;color:blue;font-family:britannic bold;>CONTROL EVERYTHING</h1>" "<h3 style=text-align:center;font-family:courier new;><a href= target=_blank></a></h3><hr>" "<h2 style=text-align:center;font-family:tahoma;><a href= \n" "target=_blank>SHT25 Sensor I2C Mini Module</a></h2>"); server.sendContent ("<h3 style=text-align:center;font-family:tahoma;>Relative Humidity = " + String(humidity) + " %RH"); server.sendContent ("<h3 style=text-align:center;font-family:tahoma;>Temperature in Celsius = " + String(cTemp) + " C"); server.sendContent ("<h3 style=text-align:center;font-family:tahoma;>Temperature in Fahrenheit = " + String(fTemp) + " F"); delay(300); }

void setup() { // Initialise I2C communication as MASTER Wire.begin(2, 14); // Initialise serial communication, set baud rate = 115200 Serial.begin(115200);

// Connect to WiFi network WiFi.begin(ssid, password);

// Wait for connection while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.print("Connected to "); Serial.println(ssid);

// Get the IP address of ESP8266 Serial.print("IP address: "); Serial.println(WiFi.localIP());

// Start the server server.on("/", handleroot); server.begin(); Serial.println("HTTP server started"); }

void loop() { server.handleClient(); }

Step 4: Conclusion

The SHT25 humidity and temperature sensor series takes sensor technology to a new level with unmatched sensor performance, range of variants, and new features. Suitable for a wide variety of markets, such as home appliances, medical, IoT, HVAC, or industrial. With the help of ESP8266, we can increase its capacity to a greater length. We can control our appliances and monitor there performance form our notebooks and mobile devices. We can store and manage the data online and study them anytime for modifications.

We can use such ideas in medical industries, for a moment just say to control a ventilation in a patient room when humidity and temperature increases automatically. The medical staff can monitor the data online without going in the room.

Hope you like the effort and think about the more possibilities with it. Like i said above, Imagination is the Key. :)

For more information about SHT25 and ESP8266, check out the links below:

For more info, visit ControlEverything.