Make Your Own Graphical Weather Station




Posted in TechnologyMicrocontrollers

Introduction: Make Your Own Graphical Weather Station

About: idea + energy = instructable

Always wanted to have a graphical weather station? And with accurate sensors? Maybe this project is something for you. With this weather station you can see what the weather is "doing". Temperatures for example might rise or fall. From a normal thermometer it is not possible to see the temperature history. With this weather station you have an history of 26 hours, displayed over 320 pixels of a TFT display. Every 5 minutes a pixel is added to the graph which will enable you to see if it is having a rising or falling trend. This is done for temperature, humidity, air pressure and CO2 in different colors. Outside temperature is also included wireless. In this way you can "predict" the weather based on what the air pressure is doing.

Normal weather stations do have sensors which are some inaccurate. For example, for temperature they normally have an accurace of +/- 2 degrees. For this weather station more accurate sensors are used. The HDC1080 temperature sensor does have an accuracy of +/- 0.2 degrees which is far better. The same for humidity and air pressure.

At the top of the TFT display the measurements of the sensors are displayed and refreshed every 5 seconds. These measurements are also available via RS232.

Main features:

  • Graphs in different colors for recognizing trends
  • Accurate sensors for temperature, humidity and air pressure.
  • Factory calibration data and sensor temperature are read from sensors where possible and applied to code to get the most accurate measurements.
  • Temperatures are available in Celsius (default) or Fahrenheit.
  • Outside temperature via wireless module (optional)
  • RS232 interface for remote monitoring.
  • Nice design (even my wife tolerates it in our living room ;-)

I hope you will enjoy examining the weather conditions the same as I do !

My humble request to vote for this project in the microcontroller contest if you like it !!

Microcontroller Contest

This is an entry in the
Microcontroller Contest

Step 1: Parts

1 x TFT Module 2.8 inch without Touch Panel ILI9341 Drive IC 240(RGB)*320 SPI Interface

1 x Microchip 18f26k22 microcontroller

1 x HDC1080 module, GY-213V-HDC1080 High Accuracy Digital Humidity Sensor with Temperature Sensor

1 x GY-63 MS5611 High-resolution Atmospheric Height Sensor Module IIC / SPI

1 x MH-Z19 infrared co2 sensor for co2 monitor

1 x (optional) NRF24L01+PA+LNA wireless modules (with antenna)

1 x 5V To 3.3V DC-DC Step Down Power Supply Buck Module AMS1117 800MA

1 x Ceramic capacitor 100nF

2 x Acrylic Board 6*12cm thickness 5mm or 100*100mm thickness 2mm

1 x Black Universal Android Phone Micro USB EU Plug Travel AC Wall Charger Adapter For Android Phones

1 x PCB double sided.

Some M3 nylon spacers/screws


For outside temperature (optional)

1 x Microchip 16f886 microcontroller

1 x Waterproof DS18b20 temperature probe temperature sensor Stainless steel package -100cm wire

1 x 4k7 resistor

1 x NRF24L01+ Wireless Module

1 x Ceramic capacitor 100nF

1 x Prototype PCB breadboard

1 x 85x58x33mm Waterproof Clear Cover Plastic Electronic Cable Project Box Enclosure Case

1 x Plastic Battery Case Storage Box Holder with Wire Leads for 2 X AA 3.0V 2AA

2 x AA battery

Step 2: PCB

I used a double sided PCB for this project. The Gerber files are available. This PCB fits at the back of the TFT display. The temperature sensor is mounted at the back to prevent heating from the circuit. Connect the NRF24L01+ in the following way to the microcontroller:

pin 2 - CSN of NRF24L01+

pin 8 – GND of NRF24L01+

pin 9 - CE of NRF24L01+

pin 22 - SCK of NRF24L01+

pin 23 - MISO of NRF24L01+

pin 24 - MOSI of NRF24L01+

pin 20 – VCC of NRF24L01+

n.c - IRQ of NRF24L01+

Step 3: Outside Temperature

The 16f886 microcontroller is used to read the DS18B20 temperature sensor every 5 minutes. This temperature is transmitted via the NRF24L01+ wireless module. A prototype PCB breadboard is sufficient here. Use the following microcontroller pin configuration:

pin 2 - CSN of NRF24L01+

pin 8 - GND

pin 9 - CE of NRF24L01+

pin 14 - SCK of NRF24L01+

pin 15 - MISO of NRF24L01+

pin 16 - MOSI of NRF24L01+

pin 20 - +3 volt of the AA batteries

pin 21 - IRQ of NRF24L01+

pin 22 - DS18B20 data (use 4k7 resistor as pull up)

Step 4: RS232 Output

Every 5 seconds the measurements are provided via RS232 at pin 27 (9600 baud). You can connect this interface to your computer and use a terminal program (e.g. Putty) to get the data. It allowes you to use the measurements for other purposes.

Step 5: Code

The sensors used in this project are using different interfaces of the 18f26k22 microcontroller. So is the first serial interface used by the MH-Z19 CO2 sensor. This interface is set to 9600 baud. The second serial interface of this microcontroller is used for providing the sensor measurements at pin 27 every 5 seconds so you can connect it to your computer (also set at 9600 baud). The HDC1080 temperature/humidity sensor and MS5611 air pressure sensor operates on i2c interface. The TFT display and NRF24L01+ wireless module operates on the same SPI interface configured at 8 Mhz. The 18f26k22 microcontroller itself is set to 64 Mhz. By default, the temperatures are in Celsius. By connecting pin 21 to ground you get the temperatures in Fahrenheit. Thanks to Achim Döbler for his µGUI graphic library and Harry W (1and0) for his 64bit solution.

The 16f886 microcontroller is used for measuring the outside temperature. The DS18B20 temperature sensor is read every 5 minutes (one-wire protocol is used here) and transmitted with the SPI interface via the NRF24L01+ wireless module. Most of the time this microcontroller is in low power mode to save batteries. Of course also negative temperatures are supported. If this outside temperature feature is not used it will not appear on the TFT screen so it is optional.

For programming the 18f26k22 and 16f886 microcontrollers you need a pickit3 programmer. You can use the free Microchip IPE programming software (don't forget to set VDD to 3.0 volt and check the checkbox "Power Target Circuit from Tool" at "ICSP Options" at "Power" menu).



    • Microcontroller Contest

      Microcontroller Contest
    • Science of Cooking

      Science of Cooking
    • Pocket-Sized Contest

      Pocket-Sized Contest

    We have a be nice policy.
    Please be positive and constructive.




    My experience is that people try to compile source code against other microcontrollers hence compilation errors are the result. By using compiled hex files this problem does not happen.

    Do you have Gerber files (or other files) for the PCB so that I can have it manufactured through an inexpensive PCB site like PCBway? The PDF files won't work for that purpose as far as I know.

    2 replies

    It's indeed better to use gerber files if you use a PCB manufactorer. They are added in step 2. I have no experience with a PCB manufactorer so can you show the result? I'm interested.

    Thanks Richard. I've recently used one of the inexpensive PCB manufactures. It's pretty easy. And the prices are crazy cheap. They can do it far more cheaply and much more professionally then I can. The only downside is that it can take several weeks to get the boards. You can choose a faster delivery but then the prices go way up. I don't know if I'll get to this project anytime soon. I have a huge backlog of things waiting for me to work on. But thanks for posting the files!

    throw in an outside dew temp and I would seriously consider making one of these.

    3 replies

    Good idea!

    Can you recommend an accurate outside dew sensor?

    Dew point is calculated based on the ambient air temperature and relative humidity, so a dew sensor wouldn't be entirely necessary if you already have a temperature/humidity sensor.

    I believe humidity sensors already have a command to output the dew point, or you can calculate it.