Introduction: Weatherstation


In this schoolproject we will be making a weatherstation that can measure temperature, air pressure, rain and humitidy. All the data that the Raspberry pi gathers will be stored inside a MySQL server on the pi and will be displayed on a webserver!

Step 1: List of Materials

  • 1x raspberry pi
  • 1x BMP180
  • 1x DHT11 met shield
  • 1x Rain Sensor
  • 1x Adafruit Pi T-Cobbler plus kit
  • Breadboard kabels
  • 1x MCP3008
  • Breadboard
  • 2x scharnier
  • hout
  • houtlijm

Step 2: The Enclosure

My enclosure is made out of wood, you can use any wood you'd like. The dimensions are 15cm on 25 cm. The sides are glued together with wood glue. For the cap i used 2 hinges. I used some black to cover the hole i got for using the hinges on the inside of the box. But it has a nice finishing touch.

Step 3: Connecting Components / Fritzing

Connect the T cobbler to the GPIO pins on the raspberry pi and place it on a breadboard

DHT11 with shield:

  • Connect the 3v3 to 3v3
  • Connect the GND pin to the ground
  • Connect D4 to Pin 4


  • Connect the 3v3 to 3v3
  • Connect the GND pin to the ground
  • Connect the SDA to the SDA
  • Connect the SCL to the SCL

Rain sensor:

  • Connect the VCC to 3v3
  • Connect the GND pin to the ground
  • Connect the AO pin to 1 of the MCP3008 pins


  • Connect pin 16 to 3v3
  • Connect pin 15 to 3v3
  • Connect pin 14 to the ground
  • Connect pin 13 to SCLK
  • Connect pin 12 to MISO
  • Connect pin 11 to MOSI
  • Connect pin 10 to CEO
  • Connect pin 9 to the ground
  • Connect pin 8 to the AO pin of the rain sensor

Step 4: Setting Up the Raspberry Pi

This is a link to the very basics of setting up a Raspberry Pi:

Make sure you are running the latest version of Debian. You can upgrade by typing in the terminal:

sudo apt-get update && sudo apt-get upgrade

Step 5: Install 1-wire and I2C

If the Pi is setup its time to install the 1-wire and the i2C.

You can do that by typing :

sudo raspi-config

when in raspi-config you have to go to interfacing options.

After you enabled them you can reboot.

sudo reboot

Now you have to install them

sudo apt-get install i2c-tools

Step 6: Set Up MySQL

Let's set up the database where we can store all our needed data.

To install MySQL type:

sudo apt-get install mysql-server
sudo apt-get install mysql-client

When you are installing the client you'll have to choos your password.

Step 7: Running the Database Script

First you'll have to get your script on your pi.
To do that i used Filezilla it's an easy way to do it.

Once the script is on your Pi you can run it by typing in the terminal:

mysql -uroot -p

source /path/to/script.sql

Step 8: Install Flask

The webserver uses Flask. To install it use the code in the terminal:

sudo apt-get install python3-flask

Step 9: End Product


Swansong made it! (author)2017-06-20

That looks good :)

About This Instructable




More by dorandegraeve:Weatherstation
Add instructable to: