Step 2 of your I.O.T. Project – Setting up the Raspberry Pi 3 for the Weather Station
Welcome back. In the last post we were half way through putting together an I.O.T. system. Let’s recap on things first. The idea behind the Internet Of Things (I.O.T.) is to allow small electronic devices to connect to the internet. It is supposed to be a quick and easy way to take any electronic device networked. The power behind this is obvious, allow anybody with a small cheap device to create data, post it to some kind of web service, then use this data from either the device that created the data itself, or allow any other web connected device to utilize the data, including simple web pages via web browsers.
Some quick examples are a :
- A device to capture the speed of vehicles along a road
- A device to monitor the temperature and wind speed outside our home
- A system that collects the acidity of rainfall and the amount of rainfall
In this blog post, for this I.O.T. example, we are going to setup a device that takes weather information from our back garden and posts this info on the cloud, we will use a Raspberry Pi 3 with some external sensors. Later, this data can be used or consumed, for example the data could be formed into graphs and reports. Maybe, in the future we could create a social media group on Facebook for example, this group of people could be posting weather data too from similar set-ups. we could all then monitor global weather trends really simply. So this post is really to set you up with a Pi 3, and for you to get the basics on how to set one up. There is a lot of installation and configuring, but once setup, the Pi 3 becomes an amazing piece of kit for both the Software and Hardware electrical engineer !
Let’s start off with a raspberry Pi 3. These are mini computers, and can run a full version of Linux. when you buy one, you need to also buy an SD card that will contain the operating system. The OS for a Raspberry Pi 3 is a version of Linux called Raspbian. Download the Raspbian Full version from here with your PC/Mac :
Currently Raspbian is at version 4.4. Once you have the image downloaded you need to copy it to your micro SD card. Most PCs can not operate on a micro SD card, so make sure you have a slot, and an adapter. Then go to this web site and download the win 32 Disk Imager application.
If you have a Mac you already have an SD card imager in your OS.
Alternatively you can purchase a ready to go, out of the box Raspberry Pi 3 with a micro SD card with Raspbian already installed. If this is you first time setting up a Pi 3 then maybe consider this.
Now, start-up you Raspberry Pi 3 and make sure it boots.
For collecting data from the GPIO pins we are going to be using Python. Use the following instructions to download and install Python 3.4.
sudo apt-get install python3
Make sure you can run python 3 from the command line by typing :
When the python command line is running you are in a python shell, this means everything you type in this mode gets sent to the Python interpreter. So to get out of this mode, and back into the parent Linux shell use
Spend some time getting used to your Raspberry Pi 3, in terms of the OS, or Raspbian, and the set-up. Try and get it running headerless i.e. with no keyboard and mouse, connected to your internal network via wifi. make sure you can connect to it using the same program as we used last week, Putty. You will need to discover the IP address the Raspberry Pi is running on, use the
Command for this, and once you have the IP address use putty to connect to the Pi from your PC or Mac.
Also try and experiment with Python on the Pi, there are some great internet sites for learning Python :
Try and get to know the GPIO pins on the Pi. The GPIO pins are general purpose Input and Output pins. They allow you to connect various sensors and other devices to the Raspberry Pi, try this web site :
So, you now have a Raspberry Pi 3, running Python.
In the next blog we will be setting up our electronic weather device. So you will need a temperature sensor of some kind.