Introduction: Solar Weather Station

Have you ever wanted real-time weather information from your backyard? Now you could buy a weather station in the store but those usually require batteries or need to be connected to an outlet. This weather station doesn't need to be connected to the grid because it has solar panels that rotate towards the sun for more efficiency. With its RF modules it can transfer data from the station outside to a Raspberry Pi inside your home. The Raspberry Pi hosts a website on which you can view the data.

Step 1: Gather Materials

Materials

  • Raspberry Pi 3 model B+ + adapter + Micro SD Card 16GB
  • Arduino Uno
  • Arduino Pro Mini + FTDI basic breakout
  • 4 6V 1W solar panels
  • 4 18650 batteries
  • Booster 5v
  • 4 TP 4056 battery chargers
  • Adafruit DHT22 Temperature and Humidity Sensor
  • BMP180 Barometric Pressure sensor
  • 4 LDR
  • RF 433 receiver and transmitter
  • 2 Nema 17 Stepper motors
  • 2 DRV8825 Stepper motor drivers
  • lcd 128*64
  • Lots of wires

Tools and materials

  • Glue
  • Wood planks
  • Saw
  • Screws + screw driver
  • Duck Tape
  • 2 aluminium strips

Step 2: Mechanical Design

The body of the weather station is made out of plywood. You don't have to use wood, you can make it from any material that you prefer. For the motor mounts, I drilled a whole in a block of wood and then screw in a flat screw to the shaft of the motor, which works better then I expected. That way you don't need to 3d print a motor mount and it is easy to make. Then I bent 2 aluminium strips to hold the motors very tight. I then cut out a plank and drilled holes in it for the solar panels. Then glue the solar panels on it and solder wires on the solar panels. Then you will also need to make a cross out of black material. If you don't have anything black, you can use black tape. This cross will hold an LDR in each corner so the Arduino can compare the measurements from the LDR and calculate what direction it needs to turn. So drill tiny wholes in each corner so you can fit an LDR in there. All that's left to do now is make a base plate and something to put the electronics in. For the base plate, you will need to drill a whole in it to route all the wires trough. For the measurements, i will not give you any because it really is up to you how you want to design this. If you have other motors or other solar panels then you will have to figure out the measurements by yourself.

Step 3: Electrical Design

Power

The entire system runs on batteries(except the Raspberry Pi). I placed 3 batteries in series. 1 Battery is on average 3.7V, so 3 in series give you around 11V. This 3s battery pack is used for the motors and the RF transmitter. The other battery that is left is used to power the Arduino Pro Mini and the sensors. To charge the batteries, i used 4 TP4056 modules. Each battery has 1 TP4056 module, each module is connected to a solar panel. Because the module has B(in) and B(out), i can charge them separately and discharge them in series. Make sure you buy the right TP4056 modules because not all modules have B(in) and B(out).

Conrtol

The Arduino Pro Mini controls the sensors and the motors. The raw and ground pin of the Arduino is connected to the 5V booster. The 5V booster is connected to the single battery. The Arduino Pro Mini has very low power consumption.

Components

DHT22: I connected this sensor to the VCC and Ground, I then connected the data pin to digital pin 10.

BMP180: I connected this sensor to the VCC and Ground, I connected SCL to SCL on the Arduino and SDA to SDA on the Arduino. Be careful because the SCL and SDA pins on the Arduino Pro Mini are in the middle of the board, so if you have soldered pins to the board and put it in a breadboard, it wont work because you will have interference form other pins. I soldered those 2 pins on the top of the board and connected a wire directly to it.

RF Transmitter: I connected this to the 3s battery pack for better signal and longer range. I tried connecting it to the 5V from the Arduino but it then the RF signal is super weak. I then connected the data pin to digital pin 12.

LDR: I connected the 4 LDR's to analog pins A0, A1, A2, A3. I have put the LDR's together with a 1K resistor.

Motors: The motors are driven by 2 DRV8825 control modules. These are very handy because they only take 2 input lines(direction and step) and can produce up to 2A per phase to the motors. I have them connected to digital pins 2,3 and 8,9.

LCD: I connected the lcd to the Raspberry Pi to show its IP-address. I used a trimmer to regulate the back-light.

RF Receiver: I connected the receiver to the Arduino Uno on 5V and Ground. The receiver should not take more than 5V. I then connected the data pin to digital pin 11. If you can find a library for these RF modules that works on the Raspberry Pi, then you don't need to use the Arduino Uno.

Raspberry Pi: The Raspberry Pi is connected to the Arduino Uno trough a USB cable. The Arduino passes the RF signals to the Raspberry Pi via a serial connection.


Step 4: Let's Start Coding

To code the Arduino Pro Mini, you will need the FTDI programmer. Since the Pro Mini has no USB port(to save power), you will need that breakout board. I programmed the code in the Arduino IDE, I think this is the easiest way to do it. Upload the code from the file and it should be good to go.

To code the Arduino Uno, I connected it to my computer via a USB cable. After I uploaded the code, I connected it to the Raspberry Pi. I was also able to change the code on the Raspberry Pi because i installed the Arduino IDE and so I could program it from there. The code is very simple, it takes the input from the receiver and sends it trough the serial port to the Raspberry Pi.

To code the Raspberry Pi, i installed Raspbian. I then used Putty to connect to it via an SSH connection. I then configures the Raspberry so i could connect to it via VNC and thus have a GUI. I installed an Apache webserver and started to code the backend and frontend for this project. You can find the code on github: https://github.com/NMCT-S2-Project-1/nmct-s2-proje...

Step 5: Database

To store the data I use an SQL database. I made the database in MySQL Workbench. The database holds the sensor readings and sensor data. I have 3 tables, one for storing the sensor values with timestamps, the other one for storing info about the sensors and the last to store info about users. I don't use the Users table because i did not code that part of the project since it was not in my MVP. Download the SQL file and execute it and the database should be good to go.