29 - 11 - 2020

Simple weather station

Experiment: Simple weather station.

AltonaLab diagram: KIT_SimpleWeatherStation.nsm

Used hardware:

  • Numato 8 channel USB GPIO Module;
  • Connector board for ADC 5V;
  • AltonaLab temperature sensor;
  • AltonaLab humidity sensor;
  • 5V multi connector power supply board;
  • 220V to 12V, 2A power supply;

It is time to build your first simple weather station. At the end of this article is explained how to add some additional sensors and your weather station will become professional.

The idea of the weather station is: A non stop running computer with the hardware shown below is gathering data for temperature and humidity and save the sensors values to a DBF database. The computer has a WEB cam directed to some outside area, which is interested to be seen when we want to know more about real weather condition. The diagram has a Forecast block, which shows the forecast information for current Earth location. All this information is uploaded to the FTP server on every 10 min in order to support a weather WEB site.

 

Warning!!! Before starting the AltonaLab diagram, you must to do the next:

  • To set some properties in block FTPUploader:  FTP Server, FTP User, FTP Password, FTP Port, FTP Folder;
  • To create an account in WEB site: MyWeather2.com, to get an unique access code from this WEB site and then to set property UniqueAccessCode inblock ForecastMyWeather2. This process is explained below in this article.

 

The used hardware is:

 

The used AltonaLab diagram is:

A Demo WEB site of the weather station is published at the URL below:

http://altonalab.com/kit/SimpleWeatherStation/kit_simple_weather_station.php

The content of the WEB page of a weather station can be downloaded from the URL below:

https://scada.altonalab.com/images/KIT_WEBSimpleWeatherStation.zip

 

This experiment is very similar to the experiments - Logger of temperature and humidity and the next one - WEB publisher and mostof the blocks, theirs purpose and properties are already explained. The new in this experiment is:

  • This is very important!!! The real weather station has to work many years without stop. This is the reason, because every block in diagram has to be optimized for minimal load of computer's processor, memory, hard drive;
  • The parameter FastMode of a Numato block is unchecked and parameter CommunicatePerSec is set to 2 sec. In this mode, the communication with the device is slowly, but because we save one record in database per one min, this period of communication is fine;
  • The logger time period is one week, this means we store in DBF database records for a last week. The input Append of a DBFStorage block is connected to a PulseGenerator, which pulse is once per a minute - we store at the DBF database one record per minute. For one week, the DBF database will store 7(days)*24(hours)*60(min) = 10,080 records. The input DeleteOld of a DBFStorage block is connected to a PulseGenerator, which pulse is once per 24 hours., this means one time per 24 the old records in the DBF database, older than 7 days, will be deleted automatically and the database will not grow to a dangerous size. When the size of the database is too large, it can crash. The true is, DBF database will survive if the time period is one month or one year. For one month, the number of records will be: 30(days)*24(hours)*60(min) = 43,200 records, for one year: 365(days)*24(hours)*60(min) = 535,600 records.
  • The upload period to the FTP Server is 10 min. If we upload on every 5 min or least, every uploaded picture will increase a lot the internet traffic to the FTP server. If the weather station will work months and years, we have to save the communication resource, so communication session per 10 or 15 min is fine. In this experiment, temperature and humidity values are uploaded only with text in info.xml file, instead of converting the text controls to JPG files and upload the JPG files to the FTP Server. This way saves a lot of internet traffic too;
  • The diagram contains a block ForecastMyWeather2. The block is well explained at the Weather library documentation of AltonaLab, please read the article in URL below:

https://scada.altonalab.com/index.php/en/descriptions-of-the-functional-blocks/weather-library

The Forecast block is easy for use, just set its properties Latitude and Longitude with a GPS location of your living place. Then you have to create your account to a WEB site: MyWeather2.com.  The created from account - unique Access Code has to be entered in block's property UniqueAccessCode. Finally just set the property Connect to image control - a name of an existing image control ImageForecast, which is located at a top right angle of the diagram. When the input DoForecast becomes to a high level, the block will draw the forecast information for today and tomorrow at the image control. When is time for a FTP session, to the FTP Server will be uploaded the contents of an ImageForecast control converted to a JPG file.

 

Some tips about weather station equipment:

  • The both sensors for temperature and humidity can work without problems with 20 meters long cables between sensors and a connector board. So the 24h running computer, Numato board and other hardware can be placed inside the house and the sensors to be mounted outside with up to 20 meters long cable;
  • The outside mounted sensors have to placed inside the weather shelter. The purpose of the shelter is to protect the sensors from a direct sun light and against a rain and a dust. The sensors have to placed at 2 meter distance over the ground, for USA at 1.6m over the ground. The low cost plastic shelter is shown below:

 

The shelter can be made from a wood. At this case the measured temperature will be professional and will have very small error. Below is a picture of a professional shelter:

 

 

Some ideas for improvement of a weather station:

  • Numato 8 channel USB GPIO module used in this experiment is not the best choice for a weather station. A better choice is a SNMP device shown below:

https://altonalab.com/shop/snmp_controllers/smnp-controller/

The SNMP board is an ethernet device, which can work up to 50meters distance from a computer and can be placed inside the outside weather shelter, very close to temperature and other sensors. The device works well in 20 degrees centigrade under zero. It has 8 analog inputs 0..3.3V, so the connector board has to be:

https://altonalab.com/shop/connector-boards/connector-for-adc-3-3v/

  • An Air pressure sensor can be added to the weather station. An air pressure information is very interesting. The sensor is easy to use and has a block in AltonaLab software designed to it. The name of the block is AltonaSensorAirPress.

https://altonalab.com/shop/sensors-analog-out/altonalab-air-pressure-sensor/

  • From AliExpress can be bought a Wind speed and Wind direction sensors with voltage output in range 0..2.5V or range 0..5V. AltonaLab software has a block AverageValAngle from a library Mathematical, whichcan calculates an average value of input signal, which is in degrees or radians:

  • To the AltonaLab diagram can be added a block WindRose and then the Wind speed and direction can be shown as Wind Rose in Image control:

The idea of Wind Rose control is to show the wind speed and direction for last 12h in 6 roses, every rose is for 2h. Then we will know how the wind speed and direction are changed in last 12h. Of course a number of roses and theirs periods can be changed.

  • From AliExpress can be bought a rain sensor. The more it rains, the more often it switches the normally closed contact of the sensor.

 

The contact of the sensor can be connected to a Contact sensor board:

https://altonalab.com/shop/sensors-analog-out/contact-sensor-board/

The output of a Contact sensor board can be connected to analog input of a SNMP board. Then we will have an information about the rain and to show this information together with other sensors.

 

An Image control with a weekly complex information from sensors for temperature(red), humidity(light blue), air pressure(black), wind speed(red) and rain (dark blue) is shown below, It is from a real running weather station working with AltonaLab software: