Raspberry Pi Weather Station

Build a personal weather station with Raspberry Pi that emails you the temperature, humidity, and rainfall.

*In a couple of weeks I will be adding a barometric pressure sensor to calculate chance of rain.

Step 1: Supplies

You will need:

Raspberry Pi b and power supply

Ethernet cable

Breadboard wires


Humidity & Temperature module (I am using the DHT11 module)

Rain gauge (Not pictured)

Housing for your weather station (Not pictured)

Hot glue gun with glue

Drill with various bitsRaspberry Pi Weather Station

Step 2: Assemble the circuit

Connect the power pin of the humidity sensor and the power for the rain gauge to the 3.3V pin of the Raspberry Pi.

Connect the ground pin of the humidity sensor to ground on the Raspberry Pi.

Connect the data pin of the humidity sensor and data wires of the rain gauge to GPIO pins (I am using GPIO pins 7,13,15,18,and 16).

Step 3: Build the Housing

Drill holes in the gauge at 1in, 1.5in, 2in, 2.5in, and at the bottom.

Drill holes in the housing for the ethernet cable, power cable, and data wires for the rain gauge and humidity sensor.

Glue the rain gauge to the back of the housing.

Thread the wires from the transistors and power out of the housing and into the rain gauge, the seal the holes with hot glue.

Put the Raspberry Pi and circuit inside the housing and connect the ethernet, power, and humidity sensor.

Power up the Raspberry Pi and connect it to the internet via ethernet cable.Raspberry Pi Weather Station schematic

Step 4: Programming the Humidity Sensor

Before we start programming, you must download the Python libraries to use the sensor. Use the command git-clone https://github.com/adafruit/Adafruit_Python_DHT.g… then, switch to that folder by using cd Adafruit_Python_DHT and run sudo apt-get install build-essential python-dev to install 2 important modules for programming the sensor. while in the Adafruit_Python_DHT folder, run sudo python setup.py install to install the libraries in python. The libraries are now installed.

We will make a demo program to test the sensor.

import Adafruit_DHT as dht

h,t = dht.read_retry(dht.DHT11, 16)

print ‘Humidity={1:0.1f}% Temp={0:0.1f}*C'.format(h,t)

run this program to make sure the sensor works. If it does not work, make sure you have everything plugged in right and have all the code typed in right.


For more detail: Raspberry Pi Weather Station

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top