Macclesfield, Cheshire Weather

53° 14.98' N | 002° 08.65' W | 174 meter | Show on map

Current Weather Conditions

16/10/24 01:00:00

Station:Tycon TP2700
Software:weewx v3.6.2
Weewx uptime:10 Days, 15 Hours, 43 Minutes
Server uptime:10 Days, 14 Hours, 59 Minutes

Current Conditions

Outside Temperature12.9°C
Wind Chill12.9°C
Heat Index12.9°C
Dewpoint11.3°C
Humidity90%
Barometer1004 mbar
Barometer Trend (3 Hours)-3 mbar
Wind2.1 m/s SSE (155°)
Rain Rate0.0 mm/h
Inside Temperature21.2°C
UV0
ET0.0 mm
Solar Radiation0 W/m²

About

This website is created through the magic that is the Raspberry Pi, Weewx weather software and a WH2320 weather station.

The weather station was purchased from Ebay. As with many weather stations it is badged up and sold under a number of different names. I should have carried out more research when buying the station as my primary aim was to get it up and running with a website. I thought this would certainly be possible to set this up with the Raspberry Pi, as it had the PC link. Whilst I was correct in the end, it wasn't as straightforward as it might have been - I will explain below. The station was sold as a Excelvan Wireless Weather Station with Solar Powered Transmitter UV PC Connect.

The first step was putting the weather station together. The instructions were very clear, it is important to make sure none of the sensors get in the way of each other. As an example, you need to make sure the rain sensor isn't positioned underneath the wind sensors, otherwise you will shelter it slightly.

Positioning of the station is crucial to how accurate your readings can be. Ideally you need it to be located away from any sheltering so that it receives the full force of any weather thrown at it. The best place to position it may not however be easily accessible, e.g. attached to a chimney. I initially placed the station in a position that was easily accessible at first, to ensure it was all working correctly.

Raspberry Pi and Weewx

I wanted to use the Raspberry Pi to run the weather station software as it is small, silent and has a low power consumption. As long as I keep the data backed up it doesn't particularly matter if either it, or the SD memory card fails.

The first job was to make sure the Pi was up to date. I decided to use the Raspbian operating system to get started, getting it up to date with sudo apt-get update followed by sudo apt-get upgrade.

I was accessing the Pi 'headless' which means without a keyboard, mouse or monitor attached, so I ensured it had a static IP address on my home network through a DHCP reservation. This meant I could access the Pi on the same IP address via Putty and SSH.

There were a couple of weather station software options I wanted to explore, both based on Python they were Pywws and Weewx. I started off trying Pywws but despite it covering many weather stations out of the box it didn't cover mine, which is a rebadged Tycon TP2700. During any investigations the /var/log/syslog was vital in troubleshooting the hurdles encountered along the way.

I had confirmed the USB connection from the weather station to the Pi was working using the lsusb command so I decided to try Weewx as the WH2320 was listed as a supported weather station. I installed Weewx following the installation instructions on the Weewx website and tested it without any success. After researching and checking the logs I eventually discovered the Weewx WH2300 driver and installed this. Finally the Pi and the weather station were talking to each other!

I quickly configured the Pi to act as a web server by installing Apache on it. The end intention was not to serve up the content from this, but it acted as a test to check everything was working correctly. I didn't want to open up my home network at all, so the intention was to upload the data from Weewx to a cloud webserver.

Out of the box Weewx has some support in place for uploading data to another server, but I wanted to use SFTP for this purpose, which by default was not an option. It was made possible by amending ftpupload.py using this resource - SFTP upload.

Now I had the website upload working it was time to add my own elements to the website. I added a forecast for the local Macclesfield area, radar information and added my Twitter feed to the home page of the website

I wasn't happy with the out of the box website template so investigated the setup of Weewx to see how this could be altered. Rather than make my own skin I was impressed with the work of Sven from Neoground, who was sharing Sofaskin for use with Weewx websites.

I installed and configured this skin and made a few adjustments to the templates to suit my setup. The skin is located in /etc/weewx/skins on my Pi. Weewx uses Cheetah, a Python powered template engine to generate the html pages for the website. The skin.conf file is what tells Cheetah which pages to generate, I copied one of the existing templates and added it to skin.conf in order to generate this about page.

Troubleshooting

Not long after I configured the weather station I noticed some ridiculously high rain and rain rate values. Considering it had not rained that day they were clearly wrong so I needed to remove them from the data. If they were left in place it would have caused problems with the statistics for the week, month and year.

Firstly I needed a way of managing the database so I could search for and remove the incorrect data. To do this I installed SQLite: sudo apt-get install sqlite3

I backed up the database at this point so I could go back to it if I encountered any issues.

Next I opened up the database with the utility: sudo sqlite3 /var/weewx/weewx.sdb

Ran a search for the incorrect data so I was happy with what I was going to alter:
SELECT * FROM archive WHERE (rain > 10000);
SELECT * FROM archive WHERE (rainRate > 10000);

When happy with the search results I ran the following to null out the problem data:
UPDATE archive SET rain=NULL WHERE (rain > 10000);
UPDATE archive SET rainrate=NULL WHERE (rainrate > 10000);

Then exit SQLite. Next drop the daily summaries, which will also include the bad data There is a Weewx database utility for this purpose:
sudo wee_database --drop-daily

And then rebuild them:
sudo wee_database --backfill-daily

Once I was happy the incorrect data had been removed I deleted the generated .png graphs in /var/www/html/weewx e.g. weekrain.png. They are automatically recreated. If you are not in any rush they will be updated eventually without deleting them.

I wanted to ensure that I did not have a repeat of the problem. To prevent glitches in values affecting your data records you can amend the StdQC section of the weewx.conf file. I added the values:
rain = 0, 40
rainRate = 0, 40