# Weather forecast based on pressure, temperature and humidity only (for implementation in Arduino)

I have a project for my school to make, and I'd like to have some materials of research/graphs of dependencies about how the weather is predicted (i.e. cloudy, sunny, rainy). I've been searching the internet for the past few days but couldn't find something rather helping.

I can use an Arduino UNO and a bunch of sensors (i.e. atmospheric pressure, temperature, humidity, etc.), but my main problem is how to accurately interpret the parameters measured.

Such simple algorithms are empirical and for the same reason very local, so depending on your location they can have very bad performance. In the other hand, some people argue that properly calibrated they can be over 90% accurate.

Most of them are based in the Zambretti algorithm or some variant of it. This algorithm was originally implemented in a forecaster device produced by the firm Negretti and Zambra in the early XX century.

It considers the absolute value of the pressure, the trend of the pressure, the season and the wind direction (although wind direction and season have a small impact in the output). The algorithm is well described and translated to formulas in this article, but in summary it works calculating a tabulated forecast number $$Z$$ as follows:

1. From your measured pressure $$P$$, temperature in Celsius $$T$$ and the altitude in meters $$h$$ compute the atmospheric pressure reduced to sea level $$P_0$$. There are many formulas for this, a common one is:

$$P_0=P\left(1-\frac{0.0065 h}{T + 0.0065 h+ 273.15}\right)^{-5.257}$$

1. Compute the pressure trend and
• If the pressure is falling compute the forecast number as $$Z = 130-\frac{P_0}{81}$$
• If the pressure is steady compute the forecast number as $$Z = 147 -\frac{5 P_0}{376}$$
• If the pressure is rising compute the forecast number as $$Z = 179-\frac{2 P_0}{129}$$
1. Adjust $$Z$$ for wind direction:
• For Northerly winds adjust $$Z=Z+1$$
• For Southerly winds adjust $$Z=Z-2$$
1. Adjust $$Z$$ for the season:
• If Winter and pressure is falling, adjust: $$Z=Z-1$$
• If Summer and pressure is rising, adjust: $$Z=Z+1$$
1. Look up for the forecast from the following table:

This was made for the UK, and many people have developed modified version to work in other areas. You will find many implementations online with downloadable code, as this one in javascript, or this one in C for Arduino UNO, an explanation of this Arduino UNO implementation can be found here.

• Sir you are a life salver! Thank you so much. Mar 2, 2019 at 13:49
• P in mb or in Hg both seem to basically give Z values way off the chart, over 100, unless I'm missing something? Jul 20, 2022 at 23:59
• @camilo-rada for 𝑍=130−𝑃0/81 if P0 = 100-hpa, Z = 117, so what the unit of pressure apply to this, I see the original page and it is the same. Aug 2, 2022 at 2:43

In the Zambretti's documentation on Winter the Z number falling is lower by 1 unit, and the Summer Rising improves the prospect to 1 unit, therefore we have to adjust:

Winter Z=Z+1 Summer Z=Z-1

To compensate the derivation.

• Camilo's answer (and the article cited in the answer) states the opposite. May 27, 2020 at 9:24
• I checked the sources and verified that you have to substract 1 in winter. Although, I corrected my answer as this needs to be done only if the pressure is falling. Do you have a source to support your claim? Feb 9, 2022 at 21:55