How to make a weather station with Arduino

By on March 21, 2013
Pin It


There are many shields available almost for every application. Today we want to show you how to use your Arduino as a wheater station which can be improved, unlike commercial products that cannot be expanded or easily modified. Our shield uses three analog sensors in order to measure enviromental temperature, relative humidity and atmosferic pressure. As an extra feature we added a RTC, based on the famous DS1307 ic made by Maxim.


The used sensors are:


-Microchip MCP9700A for the temperature;

Honeywell HIH-5030-001 for the relative umidity;

-Freescale MPXH6115A6U for the absolute pressure.




The analog pins used are A0 (pressure), A1 (humidity) and A2 (temperature).


mcpMCP9700A should be used in the voltage range 2.3-5.5V, it has a linear transduction characteristic (10mV/°C) with an output of 500mV@0°C (see figure) not require any calibration: the manufacturer guarantees an accuracy of +/-2°C in the full operating range (-40÷125°C) and +/-1°C in the commercial temperature range (0÷70°C). We selected the TO92 package version and located the component near the PCB edge in order to have more flexibility in case somebody needs to measure the temperature of objects. C3 is the usual 100nF bypass ceramic capacitor; the 220Ω R2 resistor reduces the output noise.






HIH-5030-001 should work in the range 2.7-5.5V; the ouput is proportional to the umidity as reported by the following relation: VOUT=(VSUPPLY) [0.00636 (sensor RH) + 0.1515 (typic value @25°C). The accuracy is +/-3% in the range 11-89%. The relation between Vout and RH is linear with a negligible histeresys (@25°C), as visbile in figure which shows also a narrow deviation of the transduction characteristic in the range 0-70°C. A 100K
Ω resistor as been added to the output as required by the datasheet.





MPXMPXH6115A6U requires 5V to work; its accuracy is +/-1.5% of Full Scale Span (VFSS is defined as the algebraic difference between the output voltage at full rated pressure and the output voltage at the minimum rated pressure). As the previous components, the linearization has performed by the transducer itself and no offset correction or settings are required. There are pressure transducers which require 3.3V (e.g. MP3H6115A) therefore on the PCB there are two voltage selector jumpers (J3.3V and J5V) to select the appropriate voltage. For the temperature and humidity transducers we have chosen 3.3V as working voltage.






The RTC schematic section is the one in the datasheet with the 32.768 Khz quartz and the two I2C 1K pull-up resistors R6 and R7. The auxiliary clock SQW output is available at A3 for future needs.






R1: 51 kohm (0805)
R2: 220 ohm (0805)
R3: 100 kohm (0805)
R4: 100 ohm (0805)
R5: 1 kohm (0805)
R6: 1 kohm (0805)
R7: 1 kohm (0805)
R8: 22 ohm (0805)

C1: 100 nF
C2: 47 pF
C3: 100 nF
C4: 100 nF
C5: 100 nF

IC1: MPXH6115A6U
IC2: MCP9700A
IC3: HIH-5030-001
IC4: DS1307SO8

Q1: 32768 kHz

LCD: Display LCD 16×2




The libraries necessary are three: 

Wire.h and RTClib.h are required by I2C and DS1307 data communication with Arduino;

LiquidCrystal.h is required for data visualization on a 16X2 LCD display.

As usual LiquidCrystal lcd(7, 6, 5, 4, 3, 2);” is necessary to tell to Arduino which are the phisical connection with the LCD; “define TEMP 2”, “define UMID 1”, “define PRESS 0” give information to the Arduino board about sensors and their connections to the ADC pins.


“byte degree[8] = { //









has been used to create the character “°C” togheter with “lcd.createChar(0, degree);“ and “lcd.write((uint8_t)0);” as detailed in the Arduino’s “Reference” page.



lcd.write((uint8_t)0);” is the code for IDE 1.X; for previous IDE version use “lcd.createChar(0, degree);.


The other code lines are used to send RTC and sensors data to LCD and to the serial port; before the value is displayed, the average value of 100 samples is calculated for analog data coming from each sensor in order to reduce noise and fluctuations, working as a low pass filter.

The sensors used do not require any calibration or adjustment anyway it is possible to increase the accuracy by adding a correction value: “TCORR”, “RHCORR”, “PCORR”. If necessary, these values have to be defined by comparison with other sensors e.g. with a commercial weather station which have a higher accuracy.

The pressure measured by barometers is the relative atmospheric pressure but the one coming from our sensor is the absolute atmospheric pressure. Atmospheric pressure is related to the altitude and this relation is used by many commercial altimeters which are barometric instruments. Relative atmospheric pressure is measured at sea level. A easy way to have relative atmospheric pressure from absolute atmospheric pressure is to add a constant (DPR in our code) which is the difference between the value displayed by a commercial weather station and our shield.


The combination of our shield and the solar shield made by Seeedstudio is a complete stand alone weather station which can be used everywhere, requiring only a solar panel to recharge a lithium battery used to power the whole system.




  1. Pingback: Arduino | Pearltrees

  2. Pingback: An Easy and Customizable Arduino powered Weather Station connected with Xively | Open Electronics

Leave a Reply