MEteo- The weather is a funny thing. It affects everyone, but depends on exactly where you are located, and no two people are affected the same. One solution to this is to have your own personal weather station! Our goal with this project was to provide a platform for not only localized weather predictions based on your current location, but to also log and alalyzs data specific to you, and contribute to the quality of the data in the cloud with the measurements you are taking anyway.
We built this in the context of a hackathon, so we will walk you through the steps we took to get to a functional prototype, and I'll talk a bit about improvements we have planned as well for when we have a bit more time to devote to the implementation!
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Setting Up Intel Edison Hardware
So! if you've been lucky enough to get your hands on an Intel Edison developer kit, your next step should be to set it up and get it talking to your computer. there are some easy-to-follow instructions here:
but the general gist of it is: assemble the dev board, plug in the USB cables and power, load the drivers and software, and you're good to go! We'll be using Python to program on it directly, so you can do everything in your command line or python editor of choice.
Step 2: Setting Up Sensors Hardware
Even the brain of the Edison isn't much if it doesn't have eyes and ears (and a nose and a gas sensor and GPS and and and.......) The developer kit from Grove comes with a pretty wide vareity of sensors, and we settled on maximizing the functionality of our personal weather station by integrating UV and temperature measurements.
The Edison breakout board combined with the Grove shield makes it easy to add sensors and expand functionality past even what we managed, so let your imagination run here!
when your Edison and breakout board is set up, attach the Grove shield by pressing it onto the top of the board into the digital, analog, and power pins on the breakout board.This gives you an easy way to interface with the sensors and feed their information to the Edison.
Assemble the LED module by plugging the bulb into the board (take a look at the pins to see which side is the negative terminal!) and then plug that cable into the D4 socket on the Grove shield.
Add the temperature sensor to the A1 socket
and finally, add the UV sensor to the A0 socket.
If you have access to more sensors, feel free to add them here as well. We are hoping to implement air quality, GPS, and noise level sensors in the future to our project. You can add as many different streams of data as you have place for!
Step 3: Configure and Updating the Software
The edison runs on an embedded Linux- you should update the image on your chip to the most recent version.
Updating to the latest linux OS version
Get Yocto from here: http://www.intel.com/support/edison/sb/CS-035180.h...
Connect your intel edison as USB drive, make sure the contents of the "drive" are really empty, and then unpack the zipped file into the drive. At this point you can delete the zip.
Now in your terminal: you can connect to it via SSH using:
screen /dev/cu.usbserial-AJ035GIG 115200 -L
when you're connected, you can log in with root and no password, then:
reboot ota (this will take a minute or so)
cat /etc/version (this will check if you're up to date)
configure_edison --setup (then it will ask you to set up some credentials)
if it worked, you'll get a notification like:
Done. Please connect your laptop or PC to the same network as this device and go to http://10.1.221.188 orhttp://ansison.local in your browser.
Updating the development kit libraries as described here
echo "src intel-iotdk http://iotdk.intel.com/repos/1.1/intelgalactic" > /etc/opkg/intel-iotdk.conf opkg update
Step 4: Testing Python
We are using Python to code directly on the Edison, which makes the whole process pretty easy. But before we can get live data from our sensors, we should test out that we can communnicate with the LEDs and read in data at all...
A very good description of Python for the Edison is here:
Example code for the modules we used are here:
Test the LEDs:
import time led = mraa.Gpio(4) led.dir(mraa.DIR_OUT) for i in range(10): led.write(1) time.sleep(1) led.write(0) time.sleep(1)
uv = mraa.Aio(0) temp = mraa.Aio(1) while True: print uv.read() print temp.read()
Shows numbers switching between UV and temperature related
Step 5: Reading the Sensor Data
Here is some more detailed information on how to read in the specific sensors we used:
Description on all sensors here:
The Temperature sensor we use:
The UV sensor we used
How to read analog values via Python
Reading UV data the right way:
Reading the temperature part the right way:
Step 6: Getting Weather Prediction From Weather Underground
We wanted to not only measure what just happened around you, but also to be able to leverage local weather predictions and alert you if it's going to rain in your area soon. Pulling this from Weather Underground is a simple API call with Python, and will cause an LED to light up red if it will rain in the next hour.
Register on weather underground:
Use python code to check for rain conditions:
import urllib2 import json from datetime import datetime, timedelta led = mraa.Gpio(4) led.dir(mraa.DIR_OUT) next_hour = datetime.now() + timedelta(hours=1) f = urllib2.urlopen('http://api.wunderground.com/api/KEY/hourly/q/Germany/Berlin.json') json_string = f.read() parsed_json = json.loads(json_string) hours = parsed_json['hourly_forecast'] for h in hours: if next_hour.hour == int(h['FCTTIME']['hour_padded']): wx = h['wx'] if 'Rain' in wx or 'Thunderstorms' in wx or 'Showers' in wx: led.write(1) else: led.write(0) f.close()
Step 7: Uploading Temperature to Weather Underground
Register a personal weather station on weather underground
Use API upload as described here:
Step 8: Upload UV Data to the Intel Cloud and Track Current Consumption
And while it's nice to know what the weather will be or how hot it currently is outside, being able to track and monitor your exposure to UV radiation could even help lower your risk of developing skin cancer later in life. With the UV sensor connected to the Edison, you can calculate how much exposure you get in a day, and upload itto the cloud to store. With this logged data, you can make sure that your exposure stays in a safe range over the long term, and notice trends in your behaivor.