Raspberry Pi Solar Weather Station

spurred on by the completion of my two previous projects, the Compact Camera and Portable Games Console, I wanted to find a new challenge. The natural progression was an outdoor remote system…

Raspberry Pi Solar Weather Station

I wanted to build a Raspberry Pi weather station that was able to sustain itself off grid and send me the results through a wireless connection, from anywhere! This project really has had its challenges, but luckily powering the Raspberry Pi is one of the main challenges that has been made easy by using the PiJuice as a power supply with it’s added solar support.

My Initial thought was to use the fantastic AirPi module to take readings. This however, had two main drawbacks; it requires a direct internet connection to upload the results and it needs to be connected directly to the GPIO on the Pi which means it can’t be exposed to the air without also exposing the Raspberry Pi (not ideal if we want this weather station to last any length of time).

The solution… build my own sensing module! Using much of the AirPi for inspiration I was able to put together a very simple prototype using a few sensor I already had; temperature, humidity, light levels and general gases. And the great thing about this is that it’s really easy to add more sensors at anytime.

I decided to use a Raspberry Pi a+ mainly due to its low power consumption. To send me the results I used the EFCom Pro GPRS/GSM module, which can send a text straight to my mobile phone with the results! Pretty neat right?

I’m glad to here of any ideas you have for other great solar or portable projects. Let me know in the comments and I’ll do my best to create a tutoria

Step 1: Parts

1 x PiJuice + Solar Panel

1 x Raspberry Pi a+

1 x EFCom Pro GPRS/GSM Module

1 x Sim Card

1 x Bread Board


1 x MCP3008 ADC

1 x LDR

1 x LM35 (Temperature Sensor)

1 x DHT22 (Humidity Sensor)

1 x TGS2600 General Air Quality sensor

1 x 2.2 KΩ Resistor

1 x 22 KΩ Resistor

1 x 10 KΩ Resistor

10 x Female – Female Jumper wires

Assortment of single gauge wire

1 x Single Outdoor Junction Box

1 x Double Outdoor Junction Box

1 x Waterproof Cable Connector

2 x 20mm Semi Blind Cable Grommets

Step 2: Sensing circuit

There’s quite a few different elements to this project, so it’s best to do everything in steps. First off I’m going to go through how to put together the sensing circuit.

It’s a good idea to build this on a bread board first, just in case you make any mistakes, I have included a circuit diagram and step by step pictures, to be referred to.

  1. The first component to get wired up is this MCP3008 analogue to digital converter. This can take up to 8 analogue inputs and communicates with the Raspberry Pi via SPI. With the chip facing up, and the semi-circle cut away on the end furthest from you, the pins on the right all connect to the Raspberry Pi. Connect them up as shown. If you’d like to learn a little more about how the chip works here’s a great guide to the MCP3008 and the SPI protocol.
  2. The pins on the left are the 8 Analogue inputs, numbered 0-7 from top down. We will only use the first 3 (CH0,CH1,CH2), for the LDR, the general gas sensor (TGS2600) and the temperature sensor (LM35). First connect the the LDR as shown in the diagram. One side to ground and the other to 3.3V via a 2.2KΩ resistor and CH0.
  3. Next, connect the “general gas sensor”. This gas sensor is used for detection of air contaminants such as hydrogen and carbon monoxide. I haven’t yet worked out how to get specific concentrations, so for now the result from this sensor is a basic percentage level, where 100% is fully saturated. With the sensor facing up (pins on the underside), the pin directly to the right of the small outcrop is pin 1 and then the numbers increase clockwise around the pin. So pins 1 and 2 connect to 5V, pin 3 connects to CH1 and ground via a 22KΩ resistor and pin4 connects straight to ground.
  4. The final analogue sensor to connect is the LM35 temperature sensor. This has 3 pins. Take the sensor so the flat side is closest to you, the left most pin connects straight to 5V (not marked on diagram, my bad!), the centre pin connects to CH2 and the right most pin connects straight to ground. Easy!
  5. The last component to connect is DHT22 humidity sensor. This is a digital sensor so can be connected straight to the Raspberry Pi. Take the sensor with the grid facing you and the four pins on the underside. Pins are ordered from 1 on the left. Connect 1 to 3.3V. Pin 2 goes to GPIO4 and 3.3V via a 10KΩ resistor. Leave pin 3 disconnected and pin 4 goes straight to ground.

That’s it! The test circuit’s been built. I’m hoping to add more components when I have the time. I’d really like to add a pressure sensor, a wind speed sensor and I’d like to get more intelligent data on gas concentrations.

Step 3: GSM module

Now that the sensing circuits been built, there needs to be a way of receiving the results. That’s where the GSM module comes in. We’re going to use it to send the results over the cellular network in an SMS, once a day.

The GSM module communicates with the Raspberry Pi via serial using UART. Here’s some great info on serial communication with the Raspberry Pi. In order to take control of the Pi’s serial port we need to do some configuration first.

Boot up your Raspberry Pi with a a standard Raspbian Image. Now change the file “/boot/cmdline.txt” from:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait


dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

by removing the underlined section of text.

Secondly, you need to edit the file “/etc/inittab”, by commenting out the second line in the following section:

#Spawn a getty on Raspberry Pi serial line
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100″

So that it reads:

“#Spawn a getty on Raspberry Pi serial line
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100”

and reboot the Pi. Now the serial port should be free to communicate with as you wish. It’s time to wire up the GSM module. Take a look at the circuit diagram in the previous step and the pictures above to see how this is done. Basically, TX is connected to RX and RX is connected to TX. On the Raspberry Pi TX and RX are GPIO 14 and 15 respectively.

Now, you probably want to check that module is working, so lets try to send a text! For this you need to download Minicom. It’s a program that allows you to write to the serial port. Use:

“sudo apt-get install minicom”

Once it’s been installed minicom can be opened with the following command:

“minicom -b 9600 -o -D /dev/ttyAMA0”

9600 is the baud-rate and /dev/ttyAMA0 is the name of the Pi’s serial port. This will open a terminal emulator in which whatever you write will appear on the serial port, i.e. be sent to the GSM module.

Insert your topped up sim card into the GSM module and press the power button. After which a blue led should come on. The GSM module uses the AT command set, here’s the documentation if you’re really interested. Now we check that Raspberry Pi has detected the module with the following command:


the module should then respond with:


Great! Then we need to configure the module to send an SMS as text rather than binary:

“AT+CMGF = 1”

again the response should be “OK”. Now we write the command to send an SMS:

“AT+CMGS= “44************* “”, replace the stars with your number.

The modem with respond with “>” after which you can write you message. To send the message press <CTRL-Z> . That’s it, and with any luck you’ve just received a text straight from the your Raspberry Pi.

Well now that we know the GSM module is working you can close minicom; we wont need it for the rest of the project.


For More Detail : Raspberry Pi Solar 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