Introduction: Solar Powered Weather Station

About: I am a 20 year old student at Howest Kortrijk NMCT. I am interested in microcontrollers and programming. If you wanna chat about cryptocurrency's feel free to shoot me a message!. student NMCT at Howest (Kort…

Welcome to my solar powered weather station!

My objective was to build a self sustaining and wireless weather station, let me know what you think of it.

Step 1: Introduction

Hello, I am Thiemo Seys a 20 year old student at Howest NMCT located in Kortrijk. For a course we had to make a big project combining all the subject material we had learned during the year. When we had to choose a project i wasn't quite sure what i would take, but eventually i ended up picking a weather station.

When I began thinking about the project i decided to make it solar powered, this has several advantages such as no need to replace batteries and being better for the environment. An other important part of the project is the wireless communication between the raspberry pi and the arduino. If you want to find out how to build the weather station, continue reading the next steps!

Step 2: The Parts of the Build!

First let's by getting the required parts. I recommend ordering the parts from Aliexpress if you have the time to wait. Shipping can take a rather long amount of time. The second but more expensive option is shopping locally or ordering on Amazon, both options will get you the parts faster but at a higher price.

You can find the prices i paid for it in the included Bill Of Materials file! The cost without having anything is around 100 euro -120 euro. If you already have a raspberry pi it is about 50-60 euro cheaper.

Electronics:

1 arduino nano

1 arduino uno

1 raspberry pi3 (earlier versions should work but are not tested)

1 dht21/am2301

1 bmp180

4 6V 1W solar cells (ordering some extra can't hurt in case some are broken upon arrival or when you drop them

1 TP4056 lithium charging board

1 boost converter to 5V with usb port

2 2x 18650 battery holder

4 18650 battery cells 3.7V

1 433mHz rf transmitter

1 433mHz rf receiver

2 lcd 16x2

2 lcd to i2c adapters (mostly for convenience and using less wires)

Miscellaneous:

jumper wires

arduino to usb cables

duct tape (if you can't fix it with duct tape, nothing can fix it)

some sort of wood/material to make a case for the project.

copper wire (to make the antennas)

Tools:

soldering iron

Stanley knife

Drill

Saw

screwdriver

sand paper

Volt meter

Measuring instrument

Some explanation about certain part choices:

The reason i chose a arduino nano to receive the data instead of wiring the receiver directly to the pi is for modularity, we can juts unplug the USB cable from the pi and have everything working separately. This is handy so we can reuse the pi for other projects without having to destroy everything.

I went with 433 mHz rf communication because it offers a nice blend of performance for the price when coupled with a decent antenna. 433mHz is also pretty good at penetrating walls which is desirable for this project.

The choice for an arduino nano was mainly for lower power consumption and better form factor, do note that an arduino uno would also work but would use more power.

The 18650 batteries are very good at storing energy in a small form factor, the only downsides is that they are tricky to charge and are rather expensive. A lead based acid battery is also a possibility but will add a lot of weight and space to the project. Also note that for the lead battery you would have to step down the voltage.

Step 3: Installing the Solar Panels

Because the solar pannels and accesories arrived first i decided to put them together first.

Lets start off by deciding the role and need of each part of the circuit.

The solar pannels themselves have a positive and negative terminal. Because we want to keep the 6V and only increase the power, we wire them in parallel connecting every positive terminal and negative terminal together.

When you have done this you can put the solar panels in the Sun and test if you get a reasonable voltage, in bright sunlight this should be between 5.5-7V.

After this is done let's start by wiring the batteries. First you will have to connect the terminals of the battery holders. When you have done this insert the batteries in the holders, all batteries need to face the same direction. Test the voltage when you have done this, it should be around 3.7V.

Take the usb voltage step up booster and connect wires to the positive and negative terminals.

Now is the time to connect everything to our charger board, if you can you can wait to connect the solar pannels to the charging board and charge the batteries first with a smartphone power adapter.

Start by connecting the USB at the back of the charging board in the outer terminals. Then connect the battery to the inner back terminals.

The solar panels have to be connected at the front next to the mini usb power socket. When this is done congratulations the power for the arduino is finished.

Step 4: Preparing the Arduino

If you want a clear picture of how to connect everything i suggest looking at the included fritzig schema.

Step 1: Connect the i2c adapter to the lcd, solder these two together.

step 2: Connect wires to the bmp180 and plug them in the breadboard, remember to feed the bmp180 with 3.3V not with 5V!!

step 3: Connect wires to the i2c adapter and plug them in the breadboard, use 5V for it.

step 4: Connect the sla and slc wires from the i2c adapter and the bmp180 together.

step 5: Connect the dht21 to 5V and the yellow cable to digital pin 2 on the arduino.

step 6: Connect analog pin 4 to sla, and analog pin 5 to slc, make sure both the bmp180 and the i2c adapter are wired to it.

step 7: Wire the rf transmitter to 5V and digital pin 11 of the arduino nano.

step 8: connect your arduino to your laptop and upload the included sketch arduinoTransmitter

On the lcd you should be able to see the readout of the sensors, because the arduino only reads every 15 minutes, you will only see innit for the first 15 minutes. You can change this polling rate in the arduino file where you see delayInMinuten=15.

Step 5: Preparing the Receiver

Now we are going to wire the receiver that is going to catch the sensor data and pass it via USB to the raspberry pi.

This is the easiest circuit of them all.

Start by connecting the lcd the same way as with the previous arduino and then connect the rf receiver to digital pin 12 of the arduino. Make sure to attack an antenna to the receiver to optimize the range of communication.

Proceed by uploading the arduinoReceiver sketch.

When the receiver gets the data from the transmitter it will display it on the lcd and pass it through to the raspberry pi.

Step 6: Setting Up the Pi

  • First start by installing raspian to your pi. After that we will install the necessary software.

Start by updating your pi to the newest version by using:

  • sudo apt-get update
  • sudo apt-get upgrade

Now install the required parts for the mysql database by using:

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

Now make an mysql account and use the following command to login:

  • mysql -uroot -p

As last step use Filezilla to put the included database in the mysql database weerstationdb.

  • use weerstationdb;
  • source weerstationdb.sql;

Now we have everything we need, we only need to upload the website code, you can get this from: https://github.com/1NMCT1ThiemoSeys/flaskProject

To let the website start on bootup we have to change some configuration files of the pi.

open up the terminal and use the command: sudo nano /etc/rc.local.

add the following line before the exit. python3 /yourpath/flaskProject.py &

and then add python3 /yourpath/arduinoLezen.py &

The script arduinoLezen reads the serial input the pi is getting from the arduino.

You can acces the website by surfing to the ip of the pi and using te port 8080. Log in using admin/admin

The css is a WIP adjust to your own taste!

Step 7: Making Cases

For the case of the arduino nano i opted to use a type of laminate. It looks decently and i already had it laying around. I made from equal tiles that were 20cm * 20cm, only the roof was bigger to accommodate the 4 solar panels. 20*20 gives you plenty of room to add extra sensors or batteries depending on your need.

First let start by sawing 5 20cm * 20cm tiles.

Now saw a 20*27cm tile, this will be the roof of the case.

Now get a stick, we will put one in every corner of the case, this is used to connect every part to.

We drill holes through both the tiles and the stick and connect them together with screws.

Now place some duct tape at the corners to conceal the edges. Screw everything tightly and if you want you can attack some feet to the bottom of the case.

I decided to not permanently fix the roof so i could access the internals of the build, the only downside is that you will have to be careful with the wires so you don't break the connection between the solar panels and the battery.

I chose to put the raspberry pi in an old wine box because i did not have the materials to make an other case out of laminate. It is easy and cheap method that doesn't look to bad, the only downside is the case is way too big.

Step 8: Rejoice!

Rejoice! You just finished the project. If you have any questions or are wondering why i did certain things the way i did, don't be afraid to ask them! I will gladly answer every question. If you have any suggestions write them down in the comments.

Internet of Things Contest 2017

Participated in the
Internet of Things Contest 2017