Notice: This page contains information for the legacy Phidget21 Library. Phidget21 is out of support. Bugfixes may be considered on a case by case basis. Phidget21 does not support VINT Phidgets, or new USB Phidgets released after 2020. We maintain a selection of legacy devices for sale that are supported in Phidget21. We recommend that new projects be developed against the Phidget22 Library.
|
Weather Station
Description
The project described here is a simple weather station that measures air temperature, humidity, and surface temperature of the ground below the weather station. We want it to:
- Run on battery power
- Refresh the battery via a solar panel
- Sample conditions once per minute
- Write data to a text file
- Save the data to a USB key
- Back up the data to an additional USB key when one is inserted
- Use a webcam to take and save pictures of the current conditions
- Be reasonably weather resistant, with a sturdy tripod and attachments
This weather station was designed and built for late winter and early spring conditions, so it is not entirely waterproof (though it could be made so).
Overview
As with any of our described projects, Phidgets takes care of the electrical component design. Still, a project of this magnitude require a time investment in addition to a monetary investment. Designing projects like these is hard.
But the reward is deep - and very real. A full, functional system that you can build to whatever specifications you like... ask any hobbyist and you may see their eyes light up remembering their latest project. Building such things is a special kind of freedom!
We design these application guides to:
- Provide template ideas that you can then modify to be your own
- Inspire you to try new projects
- Give you an idea of the time (both in software and assembly) that this type of project entails
Time: About 6 full days of work, including gathering components, writing code, and drilling/assembling
Phidgets
Task | Phidget |
---|---|
|
1072 - PhidgetSBC2 |
|
1045 - PhidgetTemperatureSensor IR |
|
1125 - Humidity/Temperature Sensor |
|
1018 - PhidgetInterfaceKit 8/8/8 |
|
3402 - USB Webcam |
|
3601 - 10mm Green LED / 3600 - 10mm Red LED |
Phidget Infrared Temperature Sensor (IR Sensor)
Measuring the temperature of the ground is useful for things such as highway temperature in the summer, or snow surface temperature in the winter. The IR board can face downward to do this without contacting the surface itself.
The IR board should be:
- Encased and sealed (such as with low-temperature caulk) against the weather
- Suspended at the right height for the sample size of ground needed (see the 1045 - PhidgetTemperatureSensor IR specifications for the degrees of view you have)
- Suspended far enough away from the station that it is measuring only ground, and not measuring the base of the station
- Reasonably protected from solar heating (having a large station arm above it and shading it will probably do it)
Note that you will need to calibrate the data received from this sensor. When you can control all of the variables around what you are using the IR board to measure, you can get very accurate measurements. But in the out-of-doors with a weather station, you will use the board temperature, any shaded temperatures you get from the second temperature sensor, and thermal measurement theory to correct the value the sensor receives. Error includes:
- Warming of the IR board itself (i.e. you may need corrections based on board temperature)
- Emissivity of your subject being less than 1.0 (for more information on emissivity, see the 1045 - PhidgetTemperatureSensor IR product page)
- Measurement of any reflected heat in addition to emitted heat (this also depends on the emissivity)
These concepts and terms should help you get started in your research on how to correct the data specific to your needs - or if you need to do so at all - but a full course in correction is beyond our scope here.
Phidget Temperature and Humidity Sensor
Webcam
Whatever webcam you choose, you should test it outside to properly set the exposure and focus. Most webcams are not weatherproof. Your webcam can either be housed in a weather resistant housing such as those designed for outdoor floodlights, or sealed directly (except the lens) with thick, low-temperature caulk.
Communication
Because of the power requirements (as discussed further in the power section), we chose not to include a wireless connection to transfer data and check on status. Rather, this task can be split up into two parts:
- LEDs can provide visible status
- USB keys can store and transfer data
Power
From the Phidget documentation, we know that the Single Board Computer (SBC) will run at 1.2 watts with no power consumed by devices in its USB ports, and 2.5 watts maximum if all USB port devices are drawing power to maximum specification. Because the power to all sensors and USB devices is included in this estimate, this is what we use to pick a battery and a solar panel.
Although we chose our Phidgets first, and are now designing a power system to support them, the Phidget selection also included some power concerns. With a little forethought, we can guess that the wireless internet adaptor is probably the most power hungry thing that we can plug into a Phidget SBC. A wireless adaptor has two important benefits:
- You can download data over the network
- You can change code, settings, and scheduling of data gathering as the station is operating
You don't necessarily need an internet connection to use the wireless, as you can connect to it via its phidgetsbc.local
local link address.
On the other hand, without a wireless adaptor, the SBC is essentially running autonomously. You can save a lot of power this way, but if the SBC gets into an undesirable state (extreme weather causes it to reboot, a USB Phidget wiggles loose and doesn't properly attach in software, etc) your only options are to either reboot, or add a network connection to log in and change things.
As we do not use wireless here, but do use a webcam, we use an estimate of 2.0 watts to run the SBC.
Solar Panel
We would like to have a power setup that will operate continuously, rather than having to replace the battery. This involves solar power, and it also involves knowing something about the expected weather (namely, the sunshine) in the installation location. Your solar watt capacity should be big enough that in periods of sun it can recharge the battery much faster than the SBC will drain it.
To take an example as to why this matters, imagine installing a 2.0 watt solar panel into your system. If there were sunshine 100% of the time, this would be a closed, self-refreshing system because the SBC would draw 2.0 watts from the battery, and the solar panel would put 2.0 watts back in. But with only a short period of dark, the battery will be drained slightly and never refreshed. So we need to consider all of the factors that could cause darkness (or relative darkness) and determine from them how big a solar panel we need.
We start with choosing amorphous solar panels because of their low cost, and (more importantly) their ability to charge a battery in low or indirect light conditions.
Then, we account for nightfall. This at least doubles our solar needs, especially in winter when nights are long. We assume 3/5 dark time, as twilight conditions are poor for power generation, and the station will be installed in a valley with high ridges blocking the sun for morning and evening. So even assuming every day is sunny, we will only receive 2/5 charge time, and will need 5/2 (5 watts) of power via the solar cell simply due to location and season.
Then, we account for weather. An average long storm for the interior Rocky mountains is about two weeks. Although we chose amorphous solar panels for their low-light performance, the conservative assumption is that the battery will get little recharge during such a storm. Therefore, we want to recharge quickly between storms. In late winter, the mountain sky is cloudy about 2/3 of the time, leaving us one week to top off the battery after two weeks of drain. From our more general power needs section, we can learn that our 2.0 watt SBC will draw 0.17 amps if we use a 12 V battery. So our drain - at worst - will be:
- Two weeks = 24 hours per day x 14 days = 336 hours
- 336 hours at 0.17 amps = 57 amp-hours
To recharge 57 amps at 12 V, with a 10 watt panel this would take (the concepts are from the more general power needs section):
- 57 amps * N hours = 10 watts / 12 V
- N = 68
...68 hours. At 2/5 charge time from the nightfall calculation (giving ten hours a day of charge), a 10 watt panel would recharge in the expected week (6.8 days). This gives us an idea of what class of solar panel we are looking for, and from here we can examine 10 watt and larger panels with respect to cost and size.
After examining cost, a 10-watt panel was nearly the same size and cost as an 18-watt panel ($80), and so an 18-watt panel was used here. The 18-watt panel also would help add a buffer when - even on non-storm days - high mountain clouds form and further reduce the available sun.
Battery
Your battery amp capacity should be big enough that the SBC can run continuously, with reserves, in times of cloudy weather. Even with a proper type of battery, if your SBC completely drains your battery, depending on the battery type it has a chance of dying completely (which is called bricking) and will lose its capacity to recharge.
We have an in-depth description of how to choose batteries in a more general power needs section. From the information in that section, we can determine that we will probably be using a 12 V battery, and that the SBC will draw 0.17 amps with a 12 V battery.
Using this in the solar power section, we calculated that the drain on the battery during a long storm would be, at worst, 57 amp-hours, and so this is the minimum usable capacity we need for the battery.
At more than about 30 amp-hours, the battery that makes the most sense is the large car-battery type lead acid battery. However, typical car batteries won't work as they are not deep cycle that is, they are designed to stay fully charged most of the time. Drawing current from this type of battery continuously will only damage and eventually destroy it. Batteries for RVs, boats, electric golf carts, and the like are designed to be used up through most of their amperage capacity, recharged, and used again and again - these batteries are deep cycle batteries.
Most batteries list this usable capacity for their specification, but if not, consider only 60% of the capacity to be usable. Some example specifications are:
- 70 Amp-hours (110 reserve) - this battery has 70 usable amp hours
- 70 Amp hours - this battery probably only has 42 amp hours, but you can call the manufacturer to make sure
The battery will probably be a higher cost than the solar panel. A 60-70 usable amp-hour lead acid battery will be about $100 and 50 lbs. When choosing a battery, the 'buy in bulk' philosophy can come into play. For example, this station ended up using a 110 amp-hour battery, which was $115 and 65 lbs. This is not much weight or price difference for nearly double the power capacity. And extra power capacity will give you extra buffer for when your wires wiggle loose, or when you are testing your system at the beginning.
There are many different types of deep cycle batteries - not just lead acid - and they vary in price significantly. There are resources all over the Internet about different battery types to use with solar panels, so we will not describe them here. The key deciding factor is how long the installation is designed to last. Lead acid batteries have a lifespan of about three years. Longer than that, and you will need to purchase a more expensive battery.
Structural System
With these types of projects, it is easy to lose track of all the little details. Even in something contained like a weather station there are lots: zip ties, cold weather silicone caulk for sealing the case, silica gel packets for desiccant within the SBC case, etc - so plan to spend a while working your particular system out with diagrams, lists, or whatever works for you. The list of major components for this weather station is:
Component | Cost Estimate |
---|---|
Station Tripod | |
Commercial lightweight tripod | $50 |
Extension masts and guy wires | $70 |
Protective screen for temperature and humidity sensor | $40 |
Wires | |
Exterior-grade power cable | $25 |
Hookup wire for LEDs and Long Phidget Sensor wires | $15 |
Solder and heatshrink | $15 |
Misc Hardware | |
Horizontal arm for measuring surface temperature (Pipe plus U-bolts and pipe strapping) | $20 |
Solar panel and SBC case mounting (Metal frame or wide clamps with locks, with U-bolts) | $70 |
Battery box to keep snow off the terminals | $15 |
Pelican 1200 waterproof case for SBC | $60 |
The details of each major connecting part (e.g. mounting the solar panel on the mast, mounting the SBC within the case and to the mast, etc) will depend on many different details specific to your application, such as:
- Snow depth, expected winds, and primary weather
- Length of the horizontal arm and any sensors also on the end
Code
We will be writing our Phidget code in Python. This code will then be scheduled to run - via cron on the SBC - to sample data once per minute and take a webcam photo once every thirty minutes.
Since the weather station runs autonomously - on its own, in the wild - you will need to write code that runs on the SBC itself, as you will have no external computer to control the SBC. This depends on the SBC being set up as described in the 1072 - Getting Started page, and then additionally as described in the OS - Phidget SBC page. Namely, to follow along with this particular station design, you will need:
- SSH enabled
- Python installed
Of course, there are many, many other ways to design this code - in Java, to run at boot rather than as a cron job, and so on - and many of these alternatives are outlined on the OS - Phidget SBC page.
Station
Webcam
Scheduling
Putting it All Together
Future directions
The ports can sample at any time interval up to the maximum data rate of the Interface Kit attached to the SBC.
The Single Board Computer is just that - a computer! So you could