Int'l J. of Communications, Network and System Sciences
Vol.7 No.9(2014), Article ID:49420,10 pages DOI:10.4236/ijcns.2014.79037

Design of a Microcontroller-Based Data Acquisition System for Ground Weather Observations: Evaluation of Radio Refractivity of Air

Amar Adane, Ania Ali Yahia, Essaid Mameri, Abd-El-Hamid Adane

Laboratory of Image Processing and Radiation, U.S.T.H.B., Algiers, Algeria


Copyright © 2014 by authors and Scientific Research Publishing Inc.

This work is licensed under the Creative Commons Attribution International License (CC BY).

Received 28 July 2014; revised 18 August 2014; accepted 28 August 2014


A meteorological data acquisition system is built using a PIC16F877A microcontroller and electric output-based sensors. This system is programmed in C language using the PCWH compiler. It is smart, accurate, cheap, small, light and easily movable. It is designed to automatically get instantaneous measurements of air temperature, atmospheric pressure, and relative humidity. Depending on their utilisation, these measurements are collected with repetition rate tuneable from one minute to one hour. They are displayed on LCD screen and transferred to a personal computer where they are stored and processed. As an application, such data are recorded in situ and used to estimate the radio refractivity of air near the ground in real time. This parameter is necessary to account for the propagation of radiofrequency waves through the lower atmosphere, during wireless transmissions.

Keywords:Microcontroller, Sensors, C Programming, Meteorology, Radio Refractivity

1. Introduction

Nowadays, new electronic components and integrated circuits produced by various manufacturers and dedicated to the electronic instrumentation, are available in the market. These are, for example, removable memories such as flash disks capable to store a large amount of data and programmable logic devices like microcontroller, DSP (Digital Signal Processor) and FPGA (Field Programmable Gate Array), used to build data loggers and automatic measurement systems [1] -[5] . Moreover, small sensors today commercialized, are able to measure meteorological phenomena and convert them into electric signals [6] [7] . In the case of weather observations, many meteorological stations are equipped with data collection platforms made of such devices and especially designed to automatically record ground measurements such as the time variations of solar radiation, air temperature, atmospheric pressure, relative humidity, wind speed and precipitation ratio [8] . In general, the data collection platforms are usually connected to the National and World Meteorological Centres via meteorological satellites. The atmospheric data collected by such platforms near the ground are essential for the characterization of the present climate change and its perturbations on the terrestrial environment. In spite of their high investment costs, this kind of automated system has the advantage of avoiding the tedious work of handy records, consisting in reporting the meteorological measurements on a register, as practiced in the past. Programmable logic devices were also applied to various areas like those concerning solar radiation, wind, spectrometry, wireless networks, hydrology or farming [9] -[14] . For example, a smart system managed by microcontroller was used to monitor a greenhouse so that the plants grow inside under the best conditions [14] . Another interesting application is the characterization of the atmosphere for radio communications. To fulfill such an application, the meteorological data acquisition system presented in this paper, is built using the PIC 16F877A microcontroller. Such a microcontroller has been chosen owing to its very good performance, programming facilities, availability and economical advantages. This system is designed to mainly record air temperature, atmospheric pressure, and relative humidity data near the ground. As explained hereafter, these data can be usefully exploited to probe the lower atmosphere and study the anomalous propagation of RF waves.

2. Design of the Meteorological Data Acquisition System

The block diagram of Figure 1 shows that the meteorological data acquisition system under study mainly consists of three electric sensors respectively measuring air temperature, atmospheric pressure, and relative humidity, their matching circuits, a PIC 16F8877A microcontroller, an LCD (Liquid-Crystal Display) used as alphanumerical display, and an RS232 serial interface. The microcontroller insures the management of the whole system, the processing of the meteorological measurements, the computation of air refractive index, the visualization of the obtained data on the LCD screen and their transfer, via the RS232 interface, towards a personal computer where they are stored.

The matching circuits are two input amplifiers which enhance the signals arising from the temperature and pressure sensors respectively and a voltage/frequency converter which pulses the signal provided by the humidity sensor. The PIC 16F877A is as efficient as the other programmable logic devices and much cheaper than FPGA, DSP or most of the other microcontrollers.

3. Calibration of the Input Circuits

3.1. Air Temperature

Air temperature has been measured using the LM335 sensor which is a small circuit of SGS-Thomson integrating sixteen silicon transistors and three output pins. Thanks to the sensitivity of its transistors to temperature, this sensor behaves like a semiconductor diode and can make measurements from −40˚C to +100˚C. As shown in Figure 2, an LM334 current source supplies the LM335 sensor with constant dc current previously tuned to 1 mA. Following the data sheet provided by the manufacturer, the response of LM335 for this current value is 10 mV/K, its output voltage equals 2.98 V at 25˚C and it varies proportionally to temperature. In temperate regions, air temperature range is usually measured near the ground between −15˚C and +55˚C. This means that the output voltage of LM335 will vary from 2.58 V to 3.28 V when such measurements are performed. According to the working conditions of PIC 16F877A, the signal received at each of its inputs, extends from 0 to 5 V. The matching circuit of Figure 2 mainly consists of three operational amplifiers OP07 chosen for their very good accuracy. This circuit amplifies the signal produced by the LM335 sensor, so that the voltage variations at the microcontroller input will wholly cover the temperature range under consideration. This requirement implies that −15˚C and +55˚C must be respectively assigned to 0 V and +5 V at the output. As shown in Figure 2, the signal, , coming from the LM335, is amplified and compared with a reference voltage, , corresponding to −15˚C, i.e., 258 K. This value is tuned using the potentiometer,. According to the resistance values of, , and, the gain of the matching amplifier is. The difference of input voltages is and the output voltage therefore equals.

Figure 1. Block diagram of the meteorological data acquisition system.

Figure 2. Temperature sensor and its matching amplifier.

. (1)

The calibration relationship used to measure air temperature in Kelvin is then written as

. (2)

The obtained values at ambient temperature are the same as those measured with a thermometer or a PT100 resistance sensor. As mentioned in Section 5, this signal, , will be applied to the RA0 pin of the A port of the microcontroller.

3.2. Atmospheric Pressure

The sensor used for the measurement of atmospheric pressure, is the MPX200A manufactured by Motorola. This sensor is a small silicon piezoresistive—based aneroid barometer. It is mainly composed of two volumes separated by a gelatinized silicon diaphragm. The upper volume is directly opened on the ambient air through the hole of its stainless cover and then, submitted to the external variations of the atmospheric pressure,. The lower volume is a vacuum chamber containing the piezo-resistive strain gauge. The pressure, , within this chamber is nearly equal to zero and taken as reference. The voltage at the MPX200A output is therefore proportional to the pressure difference,. Considering its data sheet, the best working conditions will be reached if MPX200A is biased with dc at 25˚C. In this case, the output voltage difference deduced from the plots of the data sheet is expressed as

. (3)

In this relationship, is given in kPa and the voltage, in mV at 25˚C. The matching amplifier of MPX200A is described in Figure 3. Its schematic is identical to that used for the LM335 sensor. However, its resistances are different, because: and. Its gain then equals:. It has been chosen sufficiently high so that the pressure voltage, will vary from 0 to 5 V at the amplifier output. This voltage will be applied to the RA2 pin of the A port of the PIC 16F877A. Expressed in volts, it is given by

. (4)

The principal disadvantage of MPX200A is the sensitivity of its strain gauge to temperature variations. For a given pressure, the voltage across the pressure sensor is found to decrease exponentially with temperature. The slope of Equation (3) will therefore change if. Thanks to a corrective routine created in the program of PIC 16F877A, the position of voltage-pressure curve is automatically readjusted versus temperature and the errors caused by temperature variations are counterbalanced. We get that the pressure will correspondingly vary from 0 to 136 kPa in the interval of the values running from 0 to 5 V. In particular, the atmospheric pressure measured by the circuit of Figure 3 under normal conditions, is found to be nearly 100 kPa, as that observed with the mercury barometer.

3.3. Relative Humidity

The sensor chosen for the measurement of humidity ratio is an capacitive hygrometer produced by Philips. It is made of two metalized polyamide films, the thickness of its dielectric material is about few microns and its nominal capacity is equal to 122 pF. It acts by trapping the molecules of water suspended in the air, which modify the dielectric constant of the polyamide layers. The resulting capacity, , of this sensor therefore depends on the humidity concentration. In particular, it is proportional to the relative humidity, , when the latter ranges from 10% to 75% and its expression in pF, it is given by

. (5)

The capacity variations do not exceed ±15%. To account for these variations, a voltage/frequency conversion is applied to the signal produced by the H1 sensor, using the circuit of Figure 4. This circuit mainly consists of the NE555 component which is a timer working as astable circuit. The period of the pulses delivered at the NE555 output, is proportional to the capacity,. It is written as:

. (6)

The nominal period of these pulses calculated for, is equal to 17 ms and the nominal frequency is. Since the sensor capacity depends on the relative humidity, the pulse frequency will also vary against this parameter. The pulses of frequency generated by NE555, will be transmitted to the TICK pin of port, which inputs the timer 1 of the PIC 16F877A operating as counter.

4. Evaluation of Water Vapour Pressure and Refractive Index of Air

Let be the pressure of saturated water vapour, namely the pressure of water vapour contained in the atmosphere when the air is saturated relatively to liquid water or ice at the same air pressure, , and temperature,. The relative humidity expressed in %, is defined as [15] [16] .

. (7)

Thanks to Equation (7), the partial pressure of water vapour, , in the atmosphere is evaluated using the -measurements performed with a hygrometer. The saturated water vapour of wet air, , is previously deduced from the numerical tables giving the saturated water vapour, , under pure phase conditions at different temperatures, i.e., the gas concentration in a medium made of only water vapour [15] [16] .

Considering the ratio, the relation between and is generally written as

. (8)

Under normal meteorological conditions (and), is nearly equal to unity with deviations less than 0.5% whereas at higher pressure, this parameter increases quickly. Since 100 kPa is the or-

Figure 3. Pressure sensor and its matching amplifier.

Figure 4. Humidity sensor and its matching circuit.

der of magnitude of atmospheric pressure prevailing in the lower atmospheric layer, we get and. Considering the numerical values of, we have plotted this parameter against temperature.

For −15˚C £ T £ 55˚C, the resulting curve was then smoothed by the following polynomial

. (9)

The correlation coefficient of this adjustment was found to equal 0.9998. The air refractive index, , and therefore the radio refractivity, , can be indirectly determined from the measurements of air temperature, , atmospheric pressure, , and partial pressure of water vapour, , using the following equation [17] [18] .

. (10)

This equation where and are respectively given in hPa and, in K, expresses the mixture of dry air and water vapour considered as perfect gazes. The obtained -values are usually estimated in the RF range with error of about 0.5%. Moreover, such a relationship is recommended by the Radio Communication Sector of International Telecommunication Union (ITU-R) for the applications of radio frequencies up to 100 GHz.

5. Building and Programming the Microcontroller Card

PIC 16F877A is a microcontroller manufactured by Microchip following the CMOS technology. Supplied with only 5 V dc, it consumes very little electrical energy. The number of its pins equals 40, including 33 inputs/outputs. It works at 20 MHz provided that 20 MHz quartz is connected at the pins of its internal oscillator. The internal structure of PIC 16F877A integrates all the components of a computer. It is mainly composed of its ALU (Arithmetic and Logic Unit) , internal clock, three timers, five input/output ports, Analogue-to-Digital converter having eight 10-bit channels, RAM (Random Access Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), Flash memory and interface circuits such as USART (Universal Synchronous Asynchronous Receiver Transmitter), MSSP (Master Synchronous Serial Port) and PSP (Parallel Slave Port). As explained in Section 4, the A port is used for the analogue-to-digital conversion of the temperature and pressure signals, the C port, for the reception of the humidity signal through the timer 1, after voltage/frequency conversion, and the communication with a personal computer (PC) via the USART serial port, the D port, to control the LCD lying at the output and the B port, to control the reset and LEDs. To talk with the PC, four sorts of interface are available, namely the RS232 or USB serial interfaces and the GPIB or Centronix parallel ones. Considering the slowness of the meteorological measurement cycles (about only few minutes), RS232 has been chosen because this interface is simpler to use and sufficiently rapid for the transmission of the meteorological data under consideration. The PIC 16F877A has been configured using the PCWH compiler developed by CCS (Computer Composer Studio), PRO-PIC programmer and IC-PROG software. Being dedicated to the PIC family of microcontrollers, PCWH is written in C language [3] [19] . It is as efficient as assembly language, but much easier and faster to implement. The microcontroller was programmed following several steps which principally are:

● To carry out all the tasks of the meteorological data acquisition system, an appropriate program is set up in the PC and written in C language using PCWH compiler [19] .

● This program is compiled so as to generate a hexadecimal file (HEX).

● The PIC 16F877A is placed into the PRO-PIC programmer

● The program previously converted into HEX, is transferred to IC-PROG software.

● The PRO-PIC programmer holding PIC 16F877A is connected to the PC through the GPIB port and then, put into service.

● Finally, the HEX program is transferred from the PC to the microcontroller.

During a few hundred microseconds, the data are collected by the microcontroller, displayed on the LCD screen and transmitted to the RS232 interface of the PC via MAX232 circuit and DB9 connectors. The transfer of these data was performed in sharing time. For that, they were sampled into sequences of 8-bits accompanied with their start and stop bits. These sequences are successively assigned to temperature, pressure, humidity and refractive index of air. Their reception, reconstitution, storage and processing are managed in the computer using Delphi applications (insertion of TComPort and TComLed components of Delphi). The resulting meteorological data are recorded every one minute (or more) with very good accuracy and automatically reported on a table of five columns (time, temperature, pressure, humidity, air refractivity).

6. Experimental Prototype

The meteorological data acquisition system is compacted in a 6 × 15 × 23 cm3 box which incorporates all its sensors and electronic devices. The photo of Figure 5 is the fragmented view of the whole system. It shows that the latter is composed of three electronic cards and LCD board. These cards respectively contain the matching circuits of temperature, pressure and humidity sensors, the PIC 16F877A and the electrical power supply. Eagle and Sprint Layout were the software used to design the cards and optimize the implantation of their electronic components on a single sided PCB (Printed Circuit Board). The power supply is classical. It is made of ac transformer, bridge of diodes, current regulators, Zener diodes and appropriate capacitive and self filters. It produces all the required dc voltages from the 220 V 50 Hz mains, namely ±12 V for OP07 operational amplifiers, +5 V for PIC 16F877A microcontroller, +12 V for LM334 + LM335, +3 V for MPX200A and +12 V for NE555. The bias voltage of the sensors is adjustable with trimmers. Notice that if the data acquisition system must work in a remote site, it can also be supplied with only batteries. This system consumes less than 2.5 W. Connected with a portable PC, it has been tested in Algiers under various weather conditions.

7. In Situ Tests

Outdoor measurements were performed in Algiers under various meteorological conditions, showing the exactness of the relations of sensor calibration given in Section 4. Table 1 reports the experimental results obtained at the ground, for this location on days of fine and bad weather. These results summarize four situations respectively characterized by hot and dry atmosphere, hot air charged with humidity, standard atmospheric conditions and rainfall perturbations.

Figure 5. Photo of the meteorological data acquisition system: (a) sensor card; (b) microcontroller card; (c) power supply; (d) LCD board; (p) pressure; (T) temperature and (H) humidity sensors.

Table 1. Experimental values of air temperature, T, atmospheric pressure, p, relative humidity, H, and radio refractivity, N0, obtained at the ground, in Algiers on days of fine and bad weather: ew is the saturated water vapor pressure and e, the water vapor pressure in the atmosphere.

The obtained refractivity values range from 293 to 382. To account for the time variations of the refractive index of lower atmosphere, the plot of Figure 6 has been recorded every five minutes on midday for a period of fine weather, with hot and dry air near the ground. It shows that the refractivity of air decreases slightly in time. These variations are explained by weak increases of air temperature at maximum sun elevation angle, whereas atmospheric pressure and relative humidity remain constant during the period of record. Indeed, the obtained measurements are, and. From this plot, it is deduced that the ground measurements of refractive index of air vary from 1.000286 to 1.000295. Thanks to its small size and weight, the meteorological data acquisition system of Figure 5 can easily be carried from one place to another and measure the spatial variations of refractivity of air.

In particular, the measurements of refractive index of air with altitude, , will be helpful for the implementation of models of atmospheric boundary layer and the characterization of terrestrial radio communications [17] [20] . Such models usually generate the vertical profiles of modified refractivity, , and use them to compute the RF rays propagating near the Earth. Let us recall that the modified refractivity of air is defined as

. (11)

In this equation, is the modified refractive index of air which includes the effect of terrestrial curvature. It therefore depends on the Earth radius, , the altitude, , measured from the sea level and the refractive index of air, , obtained at altitude, namely

Figure 6. Time variations of refractivity of air measured at the ground, in Algiers on day of fine weather: ● measurement, − smooth curve.

. (12)

The -variations with altitude are better appraised by computing their index gradient expressed as

. (13)

Notice that the assessment of radio refractivity of air near the ground is generally fundamental for wireless transmissions because it contributes to know the refractive index profiles and the trajectories of electromagnetic waves within the troposphere [17] . Indeed, in spite of the weakness of the refractive index variations, the latter are more sensitive with altitude and then, significantly influence the propagation of RF waves. Briefly, the lower troposphere is generally submitted to either sub-refraction or super-refraction [17] [18] . Sub-refraction occurs when the gradient of refractive index of air obtained from its vertical profile, is greater than zero. In this case, the path followed by the RF waves, is curved towards the sky. Super-refraction is characterized by vertical gradient of atmospheric refractive index which always takes negative values. The resulting refractivity variations with altitude yield that the RF rays are bent down to the ground and cover long distances. In particular, if these variations are sufficiently strong, atmospheric ducts will set up over the terrestrial surface and transmit RF waves beyond the horizon, over very large distances. The anomalous propagation so described is generally observed in tropical and equatorial regions, over the seas and plains, when atmosphere is quiet and submitted to important temperature and humidity variations [17] . In the Mediterranean region, this phenomenon especially happens along the Algerian cost, during fine weather periods of summer. To detect atmospheric ducts near the Earth surface, the outdoor measurements of radio refractivity of air can be simply performed with altitude by connecting our data acquisition system with a portable PC and moving the whole set from the ground to the floors of a construction. For example, during hot and wet day of summer, the air refractivity measured with this system, was found to be at the ground and at the top of our Institute (i.e., at about 10 m of height). From this example, we get that:, , and. From this value of index gradient, we infer that an evaporation duct was probably present in the region of Algiers during this experimentation.

8. Conclusion

During the various tests performed in Algiers, the meteorological data acquisition system presented above has well worked without any failure. Thanks to the electric sensors and microcontroller chosen to build such a system, ground measurements of atmospheric pressure, air temperature, and relative humidity have been automatically collected with a reasonably good precision (~1%). These data are displayed on LCD screen and transferred every five minutes (or more) to a personal computer where they are archived and processed. They have also been used to evaluate the refractive index of air near the ground, in view of applications to RF terrestrial transmissions such as those operating at VHF, UHF and microwaves. Notice that such data are pertinent indicators to define the type of weather prevailing in the region where the meteorological data acquisition system is installed. In addition, this system is easily transportable and consumes little electrical energy. Supplied with autonomous energy source such as a small stand-alone photovoltaic system and equipped with a wireless data transmission system, it could therefore be used for meteorological observations in remote locations. All the electronic devices and sensors composing this system are advantageously available at low cost in the market, the necessary documentation and software have been quickly downloaded from internet and the programming tools used such as PCWH are easily implemented. However, some difficulties appeared when designing the electronic circuits. These are, for example, unwanted oscillations, then eliminated by self/capacity filtering and programming errors, detected and corrected in due time. The principal drawback was due to the calibration of the pressure sensor. Since the latter is sensitive to temperature variations, its pressure-voltage relation must be continuously readjusted in conformity with temperature variations. To improve the working conditions of this sensor, the gain of its matching amplifier has been increased and a corrective routine was introduced in the program of PIC 16F877A. These modifications make the measurements more accurate around the normal atmospheric pressure. To check the reliability of the data acquisition system and the calibration of its sensors, it will be obviously necessary to pursue the experimentation in situ during long periods. For instance, the obtained ground measurements of air refractivity could be employed to identify the type of propagation medium and input the models describing the propagation of RF waves in the low atmosphere. However, the vertical profile of air refractive index must be known to yield more realistic radio communication previsions. Thus, among the possible approaches, instrumentations based on either multi-sensors or airborne concept could be good options for the measurement of air refractivity with altitude.


Many thanks to Dr. Rabah NAILI, Director of C.N.I.M. (National Office of Meteorology, Algiers) for the access to this Centre and the calibration of the sensor devices used in our work.


  1. Bolton, W. (2009) Programmable Logic Controller. 5th Edition, Newnes, Oxford.
  2. Tavernier, C. (2004) Les Microcontroleurs: Description et mise en Euvre. Dunod, Paris.
  3. Crisp, J. (2004) An Introduction to Microprocessors and Microcontrollers. Elsevier, Boston.
  4. Smith, S.W. (2003) Digital Signal Processing: A Practical Guide for Engineers and Scientists. 3rd Edition, Newnes, Oxford.
  5. Hartmut, F., Sadrozinski, W. and Wu, J.Y. (2010) Applications of Field-Programmable Gate Arrays in Scientific Research. Taylor & Francis, Boca Raton.
  6. Asch, G. (2010) Les capteurs en instrumentation industrielle. 7th Edition, Dunod, Paris.
  7. Gardner, J.W. (1994) Microsensors: Principles and Applications. John Wiley & Sons, New York.
  8. TD 16 (2012) Meteosat Data Collection and Distribution Service. Eumetsat, Darmstadt.
  9. Pereira, A.C. and Brito, A.A.S. (1990) A Microprocessor-Based Semiconductor Solar Radiometer. Solar Energy, 44, 137-141.
  10. Ozcan, O. and Gündüz, M. (2014) Investigation and Implementation of a PIC-Based Sensor Node for Wireless Sensor Networks. Journal of Computer and Communications, 2, 90-98.
  11. Laghrouche, M., Adane, A., Boussey, J., Ameur, S., Meunier, D. and Tardu, S. (2005) A Miniature Silicon Hot Wire Sensor for Automatic Wind Speed Measurements. Renewable Energy, 30, 1881-1896.
  12. Bhaskar, P., Bhagyajyoti and Immanuel, J. (2012) Design and Development of Microcontroller-Based Photoacoustic Spectrometer. Sensors & Transducers, 14, 26-34.
  13. Deep, G.S., Rabelo, E.B., Cavalcanti, J.H.F. and Perkusich, A. (1987) Microcomputer-Based Data Acquisition System for Transient Studies in Hydrology. IEEE Transactions on Instrumentation and Measurement, IM-36, 940-944.
  14. Ameur, S., Laghrouche, M. and Adane, A. (2001) Monitoring a Greenhouse Using a Microcontroller-Based Meteorological Data-Acquisition System. Renewable Energy, 24, 19-30.
  15. Wexler, A. (1976) Vapor Pressure Formulation for Water in Range 0 to 100°C. Journal of Research of the National Bureau of Standards, A Physics and Chemistry, 80A, 775-785.
  16. Wexler, A. (1977) Vapor Pressure Formulation for Ice. Journal of Research of the National Bureau of Standards, A Physics and Chemistry, 81A, 5-20.
  17. Boithias, L. (1987) Radio Wave Propagation. Mc Graw-Hill, New York.
  18. Sauvageot, H. (1992) Radar Meteorology. Artech House, Norwood.
  19. Tavernier, C. (2005) Programmation en C des PIC. Dunod, Paris.
  20. Haddad, B. and Adane, A. (1998) Modelling of the Diurnal Structure of the Surface Boundary Layer. Proceedings WREC V, 5th World Renewable Energy Congress, Florence, 20-25 September 1998, 2484-2487.