Welcome to Windows On Devices
Hands-On Lab: the Weather Station
We'll start out at windowsondevices.com
On the landing page there's a hands on lab
section where you'll find the Weather Station lab.
Let's explore it!
In this lab you'll learn how to integrate and control a number of sensors using a Sparkfun Weather shield.
Scroll through the photos.
Let's take a look at the full bill of materials.
This is all the hardware you'll need to complete
the lab.
We'll commit to building it!
The code is available on Github, so let's go get it.
For the full lesson, chose the I2C branch.
This will leave out some of the code, which
you can write on your own to fully learn how
the sensors work with I2C.
Use your prefered method of cloning the code.
Clone in desktop with the GitHub Client, or
SourceTree, or just download and expand the
zip file.
It's time to build the hardware.
The weather shield with headers,
Raspberry Pi 2 and SD card,
Male to Female Ribbon cable
Power supply and an ethernet cable
I've loaded windows onto this SD card.
I only need 7 cables, starting with black.
On the Raspberry Pi, orange connects to the
I2C Clock, yellow to Data, and brown to 3.3V.
Then black to ground and red to 5V power.
Green and blue connect to GPIO pins 5 and 6.
On the weather shield, blue to pin 7 and green
to pin 8.
These will drive the status lights.
Yellow to data, orange to clock.
Connect Red to VIN, Black to Ground, and Brown
to 5V power.
Connect to Ethernet, and power it up.
You're ready to dig into the code.
In visual studio 2015, go to File, Open, Project/Solution... and navigate to the Weather Station project
in the repository that you cloned.
Navigate to "WeatherShield.cs" in the "Solution
Explorer" pane.
Open Quick Find to search for the //TODO comments
in the code.
These are the areas you can complete on your
own.
If you wish to skip to the full solution,
go back to GitHub and clone the master branch.
When you're ready to deploy the code, go to the Debug menu, and select "WeatherStation Properties"
In the Target Device dropdown, select remote
device
Enter the IP address of your Raspberry Pi
You're ready to deploy.
But first set a breakpoint, as shown here.
Then just press F5 to deploy.
When the breakpoint is hit, you can view your
local variables in the debugging window to
see the values.
Navigate to "This" and then "Shield" to see
the WeatherShield values.
When deployed, the weather shield status light
will briefly blink each time it's collecting data.
Feel free to make this project your own and
modify the code, add hardware, enclosures,
or anything that you're inspired to make.
Be sure to let us know what you make by tweeting
about your project with #MakeInventDo.
We're excited to see what you come up with!
