There are a number of weather reporting desktop and mobile software packages available for free or at a low cost. But this software relies on a Windows Operating System as the hosting system. The requirement for Windows gives a small number of alternatives for realtime systems. Some vendors offer realtime operating systems and hypervisors that permit guest operating systems to run concurrently with other OSes. TenAsys (1) supports their hard realtime OS, INtime RTOS, and Microsoft®'s (2) Windows® OS. Real Time Systems GmbH (3) RTS's Hypervisor provides partitioning for standard OSes, including an RTOS, and a non-realtime OS for user interface applications. RTS supports as one of the guest operating systems Microsoft Windows XP.
Generally, selecting a single vendor for a software platform is a simplifying decision. But in this case we need to be certain of the platform’s ability to support both a Real Time Operating System (RTOS) and the user interface code. For this system I’ve chosen the TenAsys INtime RTOS and Microsoft Windows OS. The TenAsys virtualization platform provides a virtual machine that hosts real-time and embedded operating systems running alongside Microsoft® Windows®. It also provides communication channels to link embedded and Windows applications.
The INtime kernel and realtime processes always have higher priority than any Windows process. This ensures that the realtime portions of the system are provided time to complete. The INtime operating system features a proprietary OS Encapsulation Mechanism (OSEM) that creates and separates the two virtual machines: one for the Windows operating system and one for the INtime RTOS. Once encapsulated, Windows executes as a single, low priority, real-time thread in the context of the real-time root process. However, software doesn’t work without hardware.
Intel recently sent me an ATOM demo system that is really cool. I’ve written about my initial impressions on TechBites.com, and as a preview – I’m impressed! The demo kit is not an optimized or purpose built hardware platform. But it makes a ready-made prototyping tool that allows systems decisions and development to proceed before final hardware is available. With the TenAsys INtime RTOS and Intel’s demo system, we’re ready to start software development. Fortunately since we’re able to split environments for realtime from user interface and legacy code, we can use normal Windows development tools for that portion of the development. ATOM software development tool chains have been covered in a previous blog.
Windows weather monitoring software includes http://www.weather.com, http://www.weatherbug.com, and http://www.wunderground.com all of which offer free access to basic weather data. Different systems contain different amounts of historical data. One rich source of data is the US Government via http://www.weather.gov. All of these services provide near term forecasts, some for one week and others for 10 days or more. In addition to providing historic and forecast data, access to web-based interactive tools permits users to explore the facts of weather and forecasts as they desire. This is one of the unexpected strengths of modern embedded systems that incorporate general purpose operating systems primarily to operate complex user interfaces.
Historic weather data is interesting and can be incorporated into the control system for irrigation. But realtime or near realtime data is more important for controlling turn on and off schedules for individual water valves. One control algorithm for lawn watering simply turns off the water valve when it starts raining. More sophisticated controls rely on moisture sensors that measure moisture content of the soil such as Onset’s sensor. Although at first glance it seems to be a simple task, soil monitoring remains a research topic for computer scientists. Also read.
All of the weather data that we’ve discussed so far has relied on an Internet connection. Fortunately the ATOM kit includes an Ethernet port. Providing that there is a local Internet connection, we have access to as much historical data as we want.
It seems like a lot of work and expenses to save a little water. The water savings can be deceptive. I live in the American South West and rely on water hauled by truck to fill my water tanks. Water costs me 3 cents per gallon. My first attempt at irrigation control reduced water usage during the summer from 8,000 gallons per month to 5,000 gallons, or a reduction of about $90 per month. Computerized timing of watering for precise quantities, on schedule, and at more effective time made a huge difference. But the irrigation control was open loop and was made using simple timers. My next refinement was to close the loop. Closing the loop can take several approaches: direct monitoring of the amount of water delivered, measuring water stress in plants, or precision measurememts of the amount of water present in the soil.
To give precise measurement of soil moisture, we use Time Domain Reflectometry. The water content reflectometer can be used to monitor soil water to calibrate less expensive sensors, and provide base measurements to evaluate our system. TDR measures the volumetric water contents by using a TDR based on the dielectric constant of the soil. Two to four probe rods act as wave guides. The dielectric constant of the soil surrounding the rods varies with the amount of water in the soil. The quality of soil moisture measurements is also affected by several other factors, such as soil electrical conductivity, salinity, clay content, and soil compaction, and thus the calibration has to be modified based on locally effects.
The ATOM prototype demo system can be used both to pulse/measure the probe data and calibrate the TDR soil probes in real time. This allows less expensive measurements to be taken because we do not require a self contained piece of electronics. TDR works in soil moisture measuring by accurately determining the permittivity (dielectric constant) of a material from wave propagation. There is a strong relationship between the permittivity of a material and its water content. TDR for soil moisture measurement generally employs phase shift measurement. TDR works in a fashion similar to RADAR. An electrical impulse of from 2ns to 20ns in width and a sharp rise time is impressed on a wire to the probe. The reflected waveform is analyzed to determine the phase shift. By using a commercially available TDP soil sensor, we can choose to sample the probe at a 200kHz rate. The samples need to be averaged in order to achieve reliable results. Within the irrigation control system, controlling the sensors is a realtime operation that is best performed in a hard realtime fashion. Interfacing between the ATOM development board and the sensor is through the development kit’s parallel port. Most commercial sensors may have from 8 to 64 sensors multiplexed on a single parallel port.
Although the choice of a commercially available moisture sensor reduces the amount of time used to read the sensors, there is still a requirement for high performance during the reading process. The return impulse ranges from 16 to 32 microseconds from the impulse impressed on the probe. This allows the ATOM processor to measure the time in a software timing loop. The basic systems time for at ATOM processor is 1.6MHz, which permits a 10 ns resolution for determining the return time of the pulse. During this time, the timing thread must be of the highest priority and be non-interruptible. Resolution of the sensor/timing loop combination may be extended by repeated readings of the sensor. Each reading is added to the previous reading and the radix point finally shifted to the right for every power of two reading that were averaged. So if four samples are added, the radix point is shifted two places to the right to arrive at the true value.
Although not a complex correction, the data from TDR sensors need to be adjusted by a quadratic equation to achieve a corrected measure of water content. A parametric correction for soil types is a more complex correction, but significant in computational complexity.
To determine the time remaining to the next watering cycle, we need to develop a rate of change for the water content. Some agricultural experts use a 5 minute sampling interval for reading the water levels. This number makes sense because in many locations the soil temperature and wind speed can dry the soil fairly quickly. With a number of soil moisture samples available, we can calculate the rate of change and consequently predict the time before the next irrigation cycle.
Assume that we have four soil probes, then every 5 minutes the critical sampling periods would consume about 1 milliseconds in non-interruptible time. The remainder of realtime tasks are in the category of soft realtime. For example, individual valves used to supply water to irrigation lines are a latching valve that once turned on, re,aim on until tirned off. Controling these valves is a soft realtime task because there is no harm in being say a few seconds late in turning on the valves.
Alternatively, microsensors are in experimental development at Cornell University http://www.news.cornell.edu/stories/July09/plantWaterStress.htmlas remote sensors in fields employing wireless communications to transmit data to a central computer. The sensor is an analog of a plant vascular system that mimics the flow of water in plants through the use of microfluidic tubes. The advantage to using such a sensor when fully developed, is that irrigation should be initiated when the plant shows signs of water stress. When operational the sensor will communicate via a wireless connection, such as WiFi. The ATOM development kit supports up to six USB ports which will allow a transceiver for the microsensors to transmit information to the ATOM kit.
ATOM makes an ideal processor to be used in similar situations because it supports realtime and Windows legacy code in a high performance configuration that can consume small amounts of power. In this article we’ve discussed one application of realtime software combined with user interface code. In this application there are wide variations in processing power required: high performance for relatively short duration followed by ultra-low power consumption between monitoring and controlling realtime watering with occasionally needs for intensive user interface usage.
What applications can you think of that needs realtime control combined with sophisticated user interface?
- TenAsys is an Affiliate Member of the Intel Embedded Alliance
- Microsoft is an Associate Member of the Intel Embedded Alliance
- Reatime Systems GmbH is an Affiliate Member of the Intel Embedded Alliance
Roving Reporter (Intel Contractor)
Intel(r) Embedded Alliance