You are here:

Weather station under $10

Table of Contents

Data Science and AI/ML

We help enterprises to unlock and transform data into valuable insights, and actionable strategies using AI/ML which enables them to attract and retain customers with optimized operations and personalized, predictive and effortless customer experience.

Table of Contents

The objective of this blog is to motivate developers to start experimenting with programmable electronics and sensors, ultimately taking them to a point where they are comfortable doing their own IoT mashups.

The components required for the weather stations are simple and minimal. I have given the eBay link for each item.


      1. Any Arduino based micro-controller : Arduino Nano

      1. A temperature sensor : DHT11

      1. A display module : I2C Serial Display

      1. A few LEDs


    Once you have the required items ready its time to get the relevant software & drivers. First visit Arduino download page and download & install the Arduino IDE. Next we need to get the required libraries for the temperature sensor and display. The display requires 2 libraries which can be downloaded from the following links.  

      1. Adafruit-GFX-Library
      1. Adafruit_SSD1306

    The library for the DHT11 temperature sensor can be downloaded from the following link.

    Once you have all the required drivers downloaded, they need to be added to the Arduino IDE. To do this in the Arduino IDE, select Sketch > Include Library > Add .ZIP Library… and add the downloaded libraries.

    Now when you need to call a library all you need to do is use the#include<{Library Name}> and replace the Library Name with the library heard file name. or simple you can add the following code.

    #include <dht.h>
    #include <SPI.h>
    #include <Wire.h>
    #include <Adafruit_GFX.h>
    #include <Adafruit_SSD1306.h>

    As you can see from the code, the temperature sensor library and the display libraries have been added along with the SPI and Wire libraries which will be used for I2C communication between the devices.

    Next step is to define pins, mostly this will be the data pin for the sensor and the OLED reset pin. For the OLED Rest we will be using pin 4 and for the sensor we will be using pin 14. Once the pins are defined we can go ahead with initializing the sensor and the display. The code below defines the pins and initializes the components.

    #define OLED_RESET 4
    #define DHT11_PIN 14

    Adafruit_SSD1306 display(OLED_RESET);
    dht DHT;

    Now to add in the setup function. In Arduino when you create a new project there are two functions that are created for you.

      1. Setup function: For all the initial set up code.
      1. Loop function: All programs that needs to be executed in the Micro controller.

    These function basically perform as their name call them. So the in the setup function we will set up the initial parts of the display and the setup of serial messaging. Here follows the completed setup function.

    void setup() {

     // Setup Serial Messaging for Logging
     Serial.println(“Tempreature & Humidity Reading”);
     Serial.println(“Temperature, Humidity”);

     // Initialise Disply
     display.begin(SSD1306_SWITCHCAPVCC, 0x3C);

     // Hold the Display Image

     // Clear Display

    Once the the setup function is completed we will need to write the components for the loop function this is where most of the fun part happens.

    void loop() {
     // Read Data from Temp Sensor

     // Log Tempreature and Humidity Information
     Serial.print(“, “);

     // Display Text

     // Print Required Text Information
     display.print(“Tempreature: “);
     display.print(DHT.temperature, 1);
     display.print(“Humidity: “);
     display.print(DHT.humidity, 1);

     // Few more additiona to alert Hot / Cold
     display.setTextColor(BLACK, WHITE);
     if(DHT.temperature >= 30.00){
     }else if(DHT.temperature <= 18.00){

     // Load data to display

     // Wait 1s before re-executing

    Once the looping function has been written, we can compile the program and upload it to the Micro-controller. This can be done by clicking the Upload button. Once its uploaded we have a running weather station under $10.

    Now You Can Download

    Data Science & AI/ML Datasheet

    You can get an idea about Data Science & AI/ML solutions and investigations by referring this document.

    Now You Can Download

    Data Science & AI/ML Datasheet

    You can get an idea about Data Science & AI/ML solutions and investigations by referring this document.