Introduction: Weatherstation

Hello!

In this schoolproject we will be making a weatherstation that can measure temperature, air pressure, rain and humitidy. All the data that the Arduino 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 Arduino Uno
  • 1x BMP180
  • 1x DHT11 met shield
  • 1x Rain Sensor
  • Breadboard kabels
  • 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

DHT11 with shield:

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

BMP180:

  • 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 AO Pin

Step 4: Setting Up the Raspberry Pi

This is a link to the very basics of setting up a Raspberry Pi:
https://www.raspberrypi.org/documentation/setup/

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: 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 6: 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.

https://www.raspberrypi.org/documentation/remote-a...

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 7: Install Flask

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

sudo apt-get install python3-flask

Step 8: The Code

You can find the code on github.

https://github.com/dorandegraeve/Weerstation

Step 9: Finished Product