element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Home Automation
  • Challenges & Projects
  • Project14
  • Home Automation
  • More
  • Cancel
Home Automation
Blog Mini Weather Station
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Home Automation to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: carmelito
  • Date Created: 21 Jan 2019 1:25 AM Date Created
  • Views 2364 views
  • Likes 13 likes
  • Comments 7 comments
  • homeautomationch
  • 3D Printing
  • homeautomation
  • esp8266
  • miniweatherstation
Related
Recommended

Mini Weather Station

carmelito
carmelito
21 Jan 2019

This is a small Weather Station based on the ESP8266, and will only need a small spot on you study table or workbench image .

image

Update 1 : Here is a quick looks at the circuit, and the components used

image

  • Adafruit HUZZAH ESP8266 Breakout
  • DHT22 temperature and Humidity sensor
  • 10K ohms resistor
  • SSD1306 OLED – I think I purchased this about a year ago, and finally have got around to using it.
  • Breadboard and wire for now, but as part of the final build we will add all these components to the 3D printed parts.

 

Update 2: 3D design and 3D printing

To put all these electronic components neatly together, the idea is to 3D print a case , which will make the OLED screen easily visible and give enough air to the DHT22 sensor so that we can capture the indoor temperature and humidity. The 3D printed components were designed in Fusion 360 and the STL files for the base and top lid are attached below. In my case I used 1.75 mm red PLA to print the STL files on a Flashforge Creator Pro.

image

 

Detecting Indoor temperature and Humidity using DHT22 sensor, and displaying it on OLED screen

image

Here is the code put together with the help of some Adafruit libraries, using the Arduino IDE

#include <Wire.h>  
#include "SSD1306.h" 
SSD1306  display(0x3c, 5, 4); // SDA on OLED connected to HUZZAH ESP8266 #4 and SCL to #5


/* DHT22 */
#include "DHT.h"
#define DHTPIN 0 // DHT pin connected to pin#0 on HUZZAH ESP8266   
#define DHTTYPE DHT22 
DHT dht(DHTPIN, DHTTYPE);
int localHum = 0;
int localTemp = 0;


void setup() 
{
  Serial.begin(115200);
  display.init(); 
  display.flipScreenVertically();
}


void loop() 
{
  getDHT(); // getting value of temperature C and humidity %
  display.clear();
  drawDHT(); // display temperature and humidity on the OLED
  display.display();
  delay (2000);
}




void getDHT()
{
  float tempIni = localTemp;
  float humIni = localHum;
  localTemp = dht.readTemperature(); // this is in centigrade 
  localHum = dht.readHumidity();
  if (isnan(localHum) || isnan(localTemp))   // read failed
  {
    Serial.println("Failed to read from DHT sensor!");
    localTemp = tempIni;
    localHum = humIni;
    return;
  }
}


void drawDHT() 
{
  int x=0;
  int y=0;
  display.setFont(ArialMT_Plain_10);
  display.setTextAlignment(TEXT_ALIGN_LEFT);
  display.drawString(0 + x, 5 + y, "Hum");
  
  display.setFont(ArialMT_Plain_10);
  display.setTextAlignment(TEXT_ALIGN_LEFT);
  display.drawString(43 + x, y, "INDOOR");


  display.setFont(ArialMT_Plain_24);
  String hum = String(localHum) + "%";
  display.drawString(0 + x, 15 + y, hum);
  int humWidth = display.getStringWidth(hum);


  display.setFont(ArialMT_Plain_10);
  display.setTextAlignment(TEXT_ALIGN_LEFT);
  display.drawString(95 + x, 5 + y, "Temp");


  display.setFont(ArialMT_Plain_24);
  String temp = String(localTemp) + "°C";
  display.drawString(70 + x, 15 + y, temp);
  int tempWidth = display.getStringWidth(temp);
}

 

Update 3: Adding the electronic components to the 3D printed parts

Now to add the electronic components to the 3D printed parts you will have to use a smaller beadboard as shown in the picture below, and also use bread-boarding wire cut to length as space it limited in the 3D printed base. In addition you will also have to solder breadboarding  wire to the 4 pins on the I2C OLED display. And a suggestion here, is to add the the DHT22 sensor to the mini breadboard after placing it in the 3D printed part using forceps, and then push the breadboard to the right of so that the DHT22 sensor just comes out half way through the 3D printed part.

image

And, you will also need a USB Micro-B breakout board, or you can cut the end of a USB cable and solder the +ve and -ve to the HUZZAH ESP8266 VBAT and GND pins.

image

In my case, as you see in the picture above, I have still FTDI serial cable still connected to the   HUZZAH ESP8266 , as I am still in the process of implementing the Arduino sketch for getting data from the Openweathermap.org API to show the weather forecast. Here is a picture showing the inside temperature and humidity based on the sketch above.

 

image

 

 

Update 4: Getting weather data from Openweathermaps

To get weather from the Openweathermaps.org you will have to create an account and generate an API key, and then upload the code from - https://github.com/ThingPulse/esp8266-weather-station-color  to the ESP8266. As part of the code don 't forget to update your API key for Openweathermap , your home WiFi network name and password. Here are the board setting to upload the ino file to the ESP8266. In my case, I also modified the code to add the indoor temperature and humidity from the DHT22 sensor.

image

 

Here is a picture showing the date and time, and as part of the code remember to update the time zone variable TZ

image

Showing the weather condition and temperature in your town/city, to get an accurate reading update your town/cities location id variable in the ino file.

image

This picture shows the Forecast for the next few days

image

Getting the indoor temperature from the DHT22 sensor

image

 

Here is a video demo of the Mini Weather station in a dark room image....

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

  • Sign in to reply

Top Comments

  • three-phase
    three-phase over 6 years ago +3
    There have been a lot of reported issues of OLEDs 'ageing' on Keysight multimeters. The U1253B has had a lot of problems and I did get a replacement U1461A from Keysight that had a dimmed display. Dimmed…
  • dubbie
    dubbie over 6 years ago +2
    I like the display. OLEDs are very clear, although fairly expensive. Dubbie
  • three-phase
    three-phase over 6 years ago +2
    Great project. Will be interesting to see how long the OLED display lasts before it starts to dim. Kind regards
  • dubbie
    dubbie over 6 years ago in reply to three-phase

    Donald,

     

    There does indeed seem to be a problem with the OLEDs, that is good to know. But then again LCDs have problems as well. Myhome phone has an LCD display and after quite a few years the numbers are barely visisble. I guess nothing lasts forever.

     

    Dubbie

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • aspork42
    aspork42 over 6 years ago

    Awesome job! Nice and compact, and functional!

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • carmelito
    carmelito over 6 years ago in reply to three-phase

    Looks like I am going to have to report back in a couple of years image on how the OLED performed, setup a calendar entry for March 2021 ..

    - Carmelito

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • three-phase
    three-phase over 6 years ago

    There have been a lot of reported issues of OLEDs 'ageing' on Keysight multimeters. The U1253B has had a lot of problems and I did get a replacement U1461A from Keysight that had a dimmed display.

     

    Dimmed screen on left, original in inset on right.

     

    image

     

    The original screens seemed to show problems after around 5 years, so it may be an issue that has been resolved with newer OLED displays. There are reports though of LG OLED TVs suffering from burn in / ghosting on the screens.

     

    Kind regards.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 6 years ago in reply to three-phase

    Donald,

     

    Do OLED displays dim? I've not heard that before.

     

    Dubbie

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube