Introduction: Raspberry Pi Weather Station
Let's get started..
Step 1: Creating a Channel
First off, we'll need to create a channel on ThingSpeak. If you don't already have an account, you'll need to do that first, obviously!
We created a channel with 4 fields (2 through 5).
The attached image will give you an idea on how to create the fields.
Note: We had reserved field 1 for the future implementation of another parameter such as humidity, although more fields can always added at the end.
Step 2: Components
• Raspberry Pi
• BMP 180 sensor
• 16x2 LCD display
Step 3: Installing Libraries
For the sensor we are using (BMP 180) you'll need to install an additional library. This can be done by executing the following commands in terminal -
sudo apt-get update
sudo apt-get install git build-essential python-dev python-smbus
git clone https://github.com/adafruit/Adafruit_Python_BMP.git
cd Adafruit_Python_BMP
sudo python setup.py install
The BMP 180 sensor requires I2C to be enabled. This can be done by executing -
sudo raspi-config
then selecting advanced options finally and enable I2C option.
Step 4: The Circuit
Make the connections as shown in the diagram.
We're listing out the Pi to LCD connections for easy reference :
LCD_RS => 18
LCD_E => 23
LCD_D4 => 24
LCD_D5 = >16
LCD_D6 => 20
LCD_D7 => 21
The potentiometer is used for adjusting the contrast.
Step 5: The Program
Once the connections are made, you'll need to enter the Write API Key of the channel you created into the 'key' string in the program.
Now the program is ready to be run on your Raspberry Pi.
If you decide to add/ remove and fields you'll just have to change the finalURL string in the program.
Congratulations! You just built yourself a portable weather station.
Step 6: Viewing the Result
On the LCD display, the current temperature and pressure is readily available.
Your channel can be viewed using the following URL:
https://thingspeak.com/channels/yourchannelid/
Your channel ID is available on the channel settings tab.
If you want to view your channel without having to log in, you'll need to make it public under channel settings.
Step 7: Feedback
Please feel free to comment below in case of any doubts.
And if you have any ideas and/or suggestions for us, don't hesitate to let us know! It will be greatly appreciated.