Arduino Weather Station - SHProject 1

by DeviceCtrl in Circuits > Arduino

137 Views, 3 Favorites, 0 Comments

Arduino Weather Station - SHProject 1

weatherStation.png
PXL_20240613_154531430.jpg

I was interested in building a real time weather station as the reported weather conditions are measured at the nearby airport. This airport sits right next to a very large river in an large open space (obviously), while I live in a metropolitan area miles away.

Therefore the weather conditions can really vary, especially wind and precipitation. With the whole renovation of my home, including a new HVAC system, I want to monitor the costs of heating and cooling and factor in the weather conditions. This is the start of a wider project to build a smart home.

Note: While this project was completed years ago, I use a recent photo to impress on the reader how much abuse will be heaped upon completed device. ;-)

Downloads

Supplies

arduino uno pinout.png

Arduino Uno

Arduino Ethernet Shield

DS18B20 Stainless-Steel Temperature sensors - qty: 2

DHT22 Humidity & Temperature sensor

BMP089 Barometric pressure sensor

12vdc to 9vdc step down power supply

Davis Rain Collector

Davis Anemometer

Arduino Schematic

weatherstation_layout.png

I like to begin my Arduino projects by mocking up the wiring using bread boards and jumper wires. Adding each component one by one, ensuring that I have hooked them up correctly and they are giving the expected results. So follow the above diagram to construct the weather station

DS18B20 Temperature Sensor - Stainless Steel

connect-arduino-to-ds18b20-sensors.png
817nwaMSNbL._AC_SL1500_.jpg

The DS18B20 requires a 4.7k ohm resistor between power and the signal wire. The nice thing about these temperature sensors is that you can connect multiple sensors to the same digital pin. And you still only need one resistor. (see the images above) In addition, they come in different lengths and in-cased in water-resistant housings.

It's smart to start with the DS18B20 sensors because you will need to discover each device id using the example code installed when you down the Arduino library Dallas Temperature. Look for file Tester.pde or oneWireSearch.ino

There are 2 temperature sensors. One will just be mounted in the open air. Meteorologists call this the Wet Bulb. The second will also be mounted outside but shielded from the wind and rain. It referred to as the Dry Bulb. The dry bulb is what the Weather Person normally reports. The wet bulb is sometimes referred to as the "Feels Like" temperature.

Downloads

DHT22 Humidity Sensor

humidity_arm.png
arduino_dht22.png

The DHT22 temperature and Humidity sensor is rather easy to get working. The one consideration is that it cannot be exposed to outdoor conditions without some protection. In the image above, note that took I some PVC pipe and fittings to create simple housing with air holes drilled in the PVC cap.

This also serves to separate the sensor from conditions inside project box where the Arduino, power supply and other electronics reside. I use the DHT22 mainly for humidity measurements. I do read the temperature, but only use it as a sanity check for the DS18B20 temp sensors.

Note; experience showed that the project box runs about 10 degrees higher that the outside ambient temperature.

Barometric Pressure Sensor

FWQ8VTJLXC72XK5.png

The barometric pressure sensor uses I2C which are pins A5 - SCL and A4 - SDA. This sensor, like the DHT22, also cannot be directly exposed to outdoor conditions. I simply mounted it inside the project box and since the humidity sensor is housed in PVC pipe with holes the pressure equalizes with the outdoors. The readings are very accurate when compared with NOAA readings. This sensors also comes a temperature sensors. I use that reading to tell me temperature in the box where the Arduino is housed.

Robust Housing

81xNuT43cNL._AC_SL1500_.jpg
61FU1gmBGIL._AC_SL1000_.jpg

Once you have attached all the sensors and bench tested them working individually and together, its time to mount all the components in a weather proof box. I find the pictured boxes very nice. They have buckles to easily open the box and rubber gasket to ensure its water tight when closed. I also use thru panel connectors (called: cable gland) to maintain the box's integrity when cables are connected.

Arduino Ethernet Shield

61aiitos81L._AC_SL1000_.jpg

While preparing and mounting all the components, don't forget to first mount the Ethernet shield to the Arduino Uno. During the renovation of my home, I had the foresight to install Cat6 Ethernet cable and low-voltage wiring everywhere. If an Ethernet cable is not available, Arduino makes a WiFi shield for the Uno.

Polling Your New Weather Station

091-udp-user-datagram-protocol-01.png

Since this unit needs to be installed outside, it's not practical to connect a display. Instead, I have my PC poll the weather station every minute and store the readings in a SQL database. This gives me both up-to-date weather readings and daily, monthly and yearly history. (This became very important when analyzing HVAC costs/usage.)


I decided to use UDP protocol instead of TCP. Arduino's Ethernet/WIFI library include software to communicate using UDP. Every minute my PC sends a timestamp in the form of r2406131422054 - this translate to 2024-06-13 14:22:05 4=Thursday (ie day of the week)

Sending a timestamp to my Arduino devices is very handy. It allows the device to know the date and time (within a second) without any additional code, NTC sync or RTC device.


If the device receives this string, it immediately responds with a tab delimited string of the current sensor readings. like: 860\t350\t869\t94\t40\t0\t347\t101168\t1125\t3402

This is made up of Temperatures, humidity, barometric pressure, wind speed & direction, rain accumulation etc...

Troubleshooting

rain_gauge_noise-filter.png

If the Davis Rain collector is positioned to far away from the Arduino, EM interference can give you false readings. This simple noise dampener can prevent intermittent false readings.

Thanks to some unknown electrical engineer.