This experiment is my first foray into the “internet of things” space using the Galileo Gen 1 board I got back in September. I decided to read the temperature in the room with a TMP36 thermometer sensor and then ultimately feed those readings into Azure. This is the first blog post outlining the steps to build a thermometer sensor out of your Galileo. There will be subsequent posts outlining the connection into Azure, so stay tuned!

If you’re interested in learning more about Windows for Devices, you can visit the portal here. From there, you can sign up for the preview program and learn more about it.

Parts list:

  • A Galileo Gen 1/Gen 2 board running the latest Windows for Devices image(as of this writing is 141114-1440)
  • TMP36 Thermometer component – link
  • Breadboard
  • 5 breadboard jumper wires
  • A LAN cable for connecting to the Galileo from your PC for debugging remotely from Visual Studio
  • Visual Studio 2013 Community Edition with the latest Windows for Devices SDK

First things first, if you have a Galileo board and haven’t set anything up yet, I recommend the setup tutorials on the portal before you get started here – http://ms-iot.github.io/content/. Make sure you install the latest Windows image!

Take a look at the diagrams below to learn how to wire up the temperature sensor.

010915_2105_WindowsforD1.png010915_2105_WindowsforD2.png010915_2129_WindowsforD3.jpg

 

Now that you have that all wired up, it’s time to write some code to read from the sensor.

There are three steps that are critical to getting an accurate temperature reading –

  1. Reading the analog signal from the TMP36 Vout pin, which in my case, is connected to A0, or analog pin zero, on my Galileo – the raw signal has a resolution of 10 mV / degree centigrade and a 500 mV offset for negative temperatures – source
  2. Converting the analog reading to a voltage value – it is critical to know the operating voltage of the sensor. For this example, I am using 5.0 V.
  3. Converting that voltage to Celsius

Code for these steps

[snippet id=”10032″]

[snippet id=”10033″]

[snippet id=”10034″]

We’ll use these methods in our sketch loop to read and convert the values.

[snippet id=”10035″]

The code for the project is part of an overall solution to hook into Azure Event Hubs – you can get the complete solution from GitHub – https://github.com/Foxman13/AzureEventHubsDemo

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s