PRO Tutorial

From meteoplug
Revision as of 10:54, 7 March 2016 by Admin (Talk | contribs) (Define CSV Schema)

Jump to: navigation, search


This page lines out some Meteobridge PRO specific how-tows

Optimize RF Reception

Meteobridge PRO (red cap model) has a RF receiver included to directly pick-up data from Davis outdoor sensors. Compared to a Davis console where only very little computing stuff is happening, we have a high density of sensors, computing modules, Ethernet circuitry and even a WiFi module all together in a very compact housing.

To keep RF noise away from the reading Davis sensor data, we designed an external antenna. The antenna shipped with Meteobridge PRO is quite good in RF operation and picks up about 5 db more signal strength than the wire antenna of Meteostick does. However, if your sensors are far away some tweaking of RF reception might be necessary.

This section of the tutorial explains what you can do if you need improved RF sensitivity.

Turn the Meteobridge PRO into an RF strength meter and find a good place to rest

Before you start experimenting how to improve RF reach we recommend to run through the following steps:

  1. Configure your Meteobridge PRO to connect via WiFi with your network. As you might want to move the Meteobridge PRO and test for various locations, having an Ethernet cable hanging around will be annoying.
  2. Mbpro-tutorial-1.png
    Configure your Meteobridge PRO to make use of the internal RF functions and configure "Meteostick:Vantage" option according to your needs. Set correct transmitter ID, set bandwidth to "small" and set sensitivity to "-90db" to start with. Picture on the right gives an example how your settings might look like.
  3. Power your Meteobridge PRO temporarily with a USB power bank. I assume you have some 5V rechargeable battery with USB plug to feed the Meteobridge PRO laying around. Any cheap power bank for your mobile phone will do. You will need a USB cable that fits into the micro USB power socket of the Meteobridge PRO, but I am sure you have that somewhere in your household. Being on battery and WiFi you have total freedom in checking for a good place for the Meteobridge PRO to rest.
  4. Mbpro-tutorial-2.png
    Define a display service on "Services" tab that shows RF data from the outdoor sensors on the integrated display and updates the display every 5 seconds. To do so, define a new service of type "Display" and select "Periodical" as it's event type. Press "Add Service Event" and a new event will be added to the list of already defined events. Then specify "every 5 seconds" as interval and select "Meteostick RF Analysis" from the list of pre-defined standard messages. Settings for this service should look like shown on the right picture. Don't be confused by the message text that is automatically inserted. If you want to understand how this works, please have a look at page PRO_Display. For the moment you don't need to know the details ;-)

Having done so the Meteobridge PRO display will show data like this:

Mbpro-tutorial-4.png Mbpro-tutorial-3.png

Picture on the left shows reception when Meteobridge PRO is directly sitting on my desk with a lamp, some metal enclosures and the metal corpus underneath my desk in direct neighborhood. Values around -70db are not great, but still no problem to receive. When it reaches the -90 db reception will get tough. By moving the Meteobridge less than a meter away to a higher position on a shelf, reception situation improves significantly. You see that on the right picture. Signal strength in the mid -50db is much better and will allow the sensors to go further away without having the connection dropped. By the way, the display is white but my camera makes it look blue sometimes. If you like watching the numbers change, this 30 second movie might be of interest to you (moving black bars on display are just camera artifacts).

No one can tell you what best position will be in your location, but you are highly invited to check out yourself.

Change Antenna

Mbpro-tutorial-5.png
RF antenna on the back panel of the Meteobridge PRO can be unmounted and replaced by a larger and more capable model. Meteobridge PRO offers a standard SMA plug, where any antenna suitable for the RF band your Davis sensors operate in (915 MHz for US, 868 MHz for EU) will fit, as long as it has a male SMA plug. What you can do in principle is going three ways:
  1. replace small antenna by a larger one that better fits to the wave length of your sensors signals.
  2. connect an antenna that is not directly mounted to the connector but has some cable to bring the antenna further away from the RF noise the Meteobridge PRO is inevitable producing and by that giving the RF signals more head room by reducing the noise floor.
  3. connect to an antenna with some directional characteristic, which can be a small yagi or other form factors. This might be an option to consider when extreme reach needs to be achieved and if you can mount the antenna outdoors as a directional yagi antenna might not fit well to your indoor living style ;-)

Picture on the right shows how the Meteobridge RF SMA female connector looks like and how the antenna SMA male plug is formed. When the antenna plug is a bit too thick to have the power connector inserted underneath, you can cut 1 mm off the white plastic from the micro-USB power plug. Please watch out not to cut too deep. While testing with alternative antennas this works rather uncomplicated. Please realize, that you do this at your own risk and it will void your warranty, so better to choose an antenna with a fitting plug.

We conducted some antenna comparisons for you. We choose a not so good reception position and swapped through different kinds of antennas while checking RF reception level.

Mbpro-ant1.jpg Mbpro-ant2.jpg Mbpro-ant3.jpg

On the left you see the Meteobridge PRO with stock antenna, next to it with a 868 MHz "H-Tronic" HT110A antenna and on the right with a multi-band GSM/UMTS antenna 88414 from "delock" which has a rather thick SMA plug and therefore needs the white power plug underneath remodeled a bit with a knife (cutting off 1 mm went fine). As you see these antennas are very close to each other, with the multi-band antenna loosing some ground. From that perspective changing stock antenna with a larger one of the same kind does not make too much of a difference, at least in our test setup.

Mbpro-ant5.jpg
What can change the game is an antenna that can be mounted away from the Meteobridge PRO. We tested the "H-Tronic" HT250A for the 868MHz band. It comes with a serious 5 meter cable to allow easy positioning far away. We were a bit worried how much antenna gain might be lost by a long cable and indeed it seems to have some impact when you look at the numbers in the picture below. While the HT250A does not seem to be a great performer sitting next to your Meteobridge on your desk (where the other antennas perform better), it is worth considering, when you have a great spot to position the antenna, but you don't want to have to Meteobridge PRO being there (on the top of your book shelf, for example).

Mbpro-ant4.jpg

Console Retransmits

When nothing else helps, you can always ask your Davis console to retransmit packets and to let Meteobridge PRO sniff data from there. As packet retransmits mostly have a lager frequency drift, you need to change the Meteostick settings on "Weather Station" tab regarding bandwidth from "small" to "normal". Furthermore, you have to select the transmitter ID the Console is using for the retransmits. Having the console just a few meters away from the Meteobridge PRO even the worst antenna will do ;-)

FTP Upload of CSV Exports

There have been may requests to upload data of a day or month in some CSV like notation onto a server via FTP. Meteobridge PRO has the building blocks (export function and FTP upload capability) to make this reality. This section explains how to set this up:

Define CSV Schema

The structure of CSV exports is defined by export templates that are user-defined and can be found in PC network share "templates". Export templates have extension ".exp" while the generated exports are stored in "export" folder and have extension ".txt". We start with pre-defined standard template "standard-iso.exp". This template defines a schema where columns show date, time, temperature, humidity, dew point, pressure, wind speed, wind gust, wind direction, rain fall holds these data the following.

# Standard CSV template with data in metric units
#
$# date, time, temperature[C], humidity[%], dew point[C], sealevel pressure[hPa], avg wind speed[m/s], gust speed[m/s], winddir, rainfall[mm]<BR>
[YYYY]-[MM]-[DD],[hh]:[mm],[th0temp-avg.1:],[th0hum-avg.0:],[th0dew-avg.1:],[thb0seapress-avg.1:],[wind0avgwind-avg.1:],[wind0wind-max.1:],[wind0dir-avg.0:],[rain0total-sum.1:]

Meteobridge PRO also allows for some pragmas to control how data is inserted:

  • "#pragma fillgap=nn" automatically fills gaps up to nn seconds to avoid empty columns when there is no data within that specific minute. Default is 300 seconds.
  • "#pragma emptyline=y" does even printout rows, when it is completely empty, which means it has no data. "emptyline=n" does not print out empty lines.

When you want to insert some header or footer lines into the output, these lines need to be start with a "$", where the "$" is omitted in the output text. Any other line starting with "#" is not reflected in the output and just handled as a comment.

Schedule Generation of Exports

Mbpro-tutorial-6.png
Exports can be easily generated with "Export" service on "Services" tab. Example on the right starts at the beginning of a day an export job that generates data for yesterday in resolution of minutes. Template "standard-iso" is used for data generation and a file like this results from it. Time slots where some of the data is missing does show empty values, as defined by the default settings in the template.
2015-12-13,00:00,4.8,97,4.4,1005.2,0.0,0.0,248,0.0
2015-12-13,00:01,4.8,97,4.4,1005.2,0.0,0.0,248,0.0
2015-12-13,00:02,4.8,97,4.4,,0.0,0.0,248,0.0
2015-12-13,00:12,,,,1004.7,,,,0.0
2015-12-13,00:13,5.1,97,4.7,1004.9,0.0,0.0,180,
2015-12-13,00:14,5.1,97,4.7,1004.7,0.0,0.0,248,0.2
2015-12-13,00:15,5.2,97,4.8,1004.6,0.0,0.0,248,0.0
2015-12-13,00:16,5.2,97,4.8,1004.6,0.0,0.0,248,0.0
2015-12-13,00:17,5.2,97,4.8,1004.5,0.0,0.0,248,0.2
2015-12-13,00:18,5.3,98,5.0,1004.6,0.0,0.0,248,0.0
2015-12-13,00:19,5.3,97,4.9,1004.5,0.0,0.0,248,0.0

Define Upload Service

Mbpro-tutorial-7.png
While time controlled FTP upload services are very standard to Meteobridge, the Meteobridge PRO can also trigger uploads as follow-on events of other events. In our situation we are generating an export file time controlled and the execution of the export event then triggers an upload event that pushes the just generated file onto your server. Definition is done as usual as an "FTP" service, but "Event Type" this time is "Trigger by Event". Example on the right shows that the FTP upload event is directly triggered by the export event. The file to be used for upload is specified as "export:lastexport" which automatically addresses the last generated export file. Target file name makes use of template variables [YYYY], [MM], [DD] which are replaced by year, month and day. Here the beginning of the data in the export file and not the current data when doing the upload is used. This takes care that the file will have a proper name on your server which matches the data in the file.

Doing Data Backups

Mbpro-tutorial-9.png
The Meteobridge PRO stores incoming sensor data on a minute base in the internal 8 GB USB storage. But what if the Meteobridge PRO fails or the USB data store fails or if data is lost there for any reason? As storing backups of the data onto the internal USB storage does not make too much sense we decided to support inserting an external USB stick to one of the USB connectors and to use that for backups. Meteobridge PRO allows you to automatically store data on the external USB stick as long as it is inserted. When capacity is filled up, oldest backups on the stick are automatically erased to make room for new backups. So you don't have to take care about how to keep free storage on the Backup USB stick.
Mbpro-tutorial-8.png
Picture on the right shows a typical backup definition. Backups are realized as a special script service, that can be typically activated each day or each month. When a micro USB stick is used, this can even stay plugged into the front panel USB connector without blocking display view.

Restore

Feature that still needs to be implemented is a comfortable restore function from USB stick. We will implement this latest when the first user has a need to restore data from a backup. If you need to restore a backup right now, you simply stop backup services on the web interface, insert the USB stick containing the backup and login via ssh and give these commands:

rm /home/meteohub/test5m.sh       # stop automated service restart
rcloggerd stop                    # stop data logging
/etc/init.d/databased stop        # stop database services
mount /dev/sdb1 /mnt              # mount external USB stick with stored backups
cp /mnt/dbase-xyz /tmp/mnt/dbase  # restore database backup from xyz
umount /mnt                       # unmount external USB stick
reboot                            # restart Meteobridge PRO.


Cleanup of History Data

While Meteobridge just stores average, minimum and maximum values for the current day, yesterday, current month, current year and all time, the new Meteobridge PRO does store data from sensors in a per minute resolution from when you started using Meteobridge PRO. The "History" tab gives you access to all this data and allows you to change, create or delete data on this per minute time resolution. To make yo familiar with how to work with this data, we will run through the use case "How to delete a spike in rain fall caused by cleaning the rain sensors funnel by pouring water through it?".

Find Data to be Corrected

We still remember that rain funnel cleaning was done in December 2015, but not exact day and time. When looking at the year view on rain data (sensor "rain0total") we see that December indeed has a bit high rain readings (abt 60mm).

Mbpro-rep1.png

So we drill down into December 215 and can see that December 7 has a peak with nearly 50 mm rain fall. Looks like this was the day the rain funnel was washed with water.

Mbpro-rep2.png

Next drill-down is on the hours of December 7 shows that we have a peak at 14h.

Mbpro-rep3.png

When reaching detail sof an hours all the minutes are listed as values to allow editing. Here we see that the false reading incident was at 14:33 (marked in orange when moving the mouse over it) and 14:34.

Mbpro-rep4.png

Edit Data Set

Editing is easy. Just click onto the value field you like to edit and you see a dialog opening where you can insert the right values. If you don't add a unit to your input, metric/ISO units are assumed. If you want to insert in imperial units, please add "in", "F", "inhg", "mph" to it. Meteobridge will then convert automatically. When you want the data to be displayed in imperial units as well, please set the "Use Imperial Units" mark on top of the "Edit Data" field. We decide to enter "0" for 14:33 into this dialog. Mbpro-rep5.png


When having inserted "0" and having pressed enter the screen updates and applies your correction. As you see, rain value has changed to "0.0mm" on 14:33.

Mbpro-rep6.png

As we are bored to repeat that with the false reading next to it (14:34) we decide just to delete this reading. Deletion can be done by clicking onto the time stamp. When moving the mouse over it a balloon help is shown.

Mbpro-rep7.png

After clicking the time stamp this dialog appears to prevent you from deleting data by accident.

Mbpro-rep8.png

When this is done, false reading for December 7 is corrected and monthly rain report looks like this.

Mbpro-rep9.png


New "Large" Weather Data Screens

Meteobridge PRO can make use of its display to show weather data. Yes, you know that, but I think you might be interested in the new, just rolled-out templates "BIG-scroll-IMP" and "BIG-scroll-ISO", which show data with larger digits. Video to the right shows a full run-through of the screens. Please ignore the flickering, which is a camera artifact only. This time we made a bit more used of the graphical capabilities of the display. Wind direction is illustrated by an oriented line in a circle. You might ask, when first temp curves show up? We'll see ;-) As you might expect having these 8 screens defined is not done before breakfast, but it is also no rocket science. When you are keen for all the details, please have a look at the wiki section "PRO Display". Code below shows the definition of one screen you see on the right.

It starts with a clean up of the screen, then "Helvetica 14pt bold" is selected as font, a white rounded box is drawn with black text "WIND" inside and the white text "mph" to the right.

Mbpro-disp1.png
*addloop b3 5 300 \
  #clear\n\
  #font helvB14\n\
  #color 1\n\
  #rbox 0 0 70 18 5\n\
  #color 0\n\
  #string 8 16 WIND\n\
  #color 1\n\
  #string 85 16 mph\n\
  #font fub30\n\
  #string 0 60 [wind0wind-avg1=mph.1:--]\n\
  #circle 105 43 20\n\
  #if#[wind0avgwind-act.1:0.0]#then##pline 105 43 20 [wind0dir-act.0:0]\n#else##fi##disc 105 43 4

Then font is changed to "Free Universal 30pt bold" (fub30) and average wind speed of last minute is displayed in mph and with one decimal resolution. On the right side of this a circle (center 105/43, radius 20) is drawn. If average wind speed of last minute is not zero then a line starting from the center of the circle with length 20 is drawn oriented by the current wind direction. The last step draws a small filled disc into the center of the circle. How #if# #then# #else# #fi# statements operate is explained at the end of "Templates" section of the wiki.