Adafruit GPS Hat in Windows IoT Core

Similar documents
Adafruit VL53L0X Time of Flight Micro-LIDAR Distance Sensor Breakout

Adafruit AM2320 Sensor

Adafruit 8x16 LED Matrix FeatherWing

Adafruit MCP9808 Precision I2C Temperature Sensor Guide

Adafruit Capacitive Touch Sensor Breakouts

0.96" mini Color OLED

Adafruit DRV2605 Haptic Controller Breakout

Adafruit AMG8833 8x8 Thermal Camera Sensor

Adafruit Prototyping Pi Plate. Created by Ladyada

i2c/spi LCD Backpack Created by lady ada Last updated on :11:04 PM UTC

Adafruit Pi Cobbler Kit

Adafruit APDS9960 breakout

Flora Wearable GPS. Created by Becky Stern. Last updated on :32:36 PM UTC

Adafruit I2C FRAM Breakout

Adafruit GPIO Expander Bonnet for Raspberry Pi Created by Kattni Rembor. Last updated on :12:47 PM UTC

Adafruit MPRLS Ported Pressure Sensor Breakout

Adafruit Si7021 Temperature + Humidity Sensor

Feather Weather Lamp. Created by Ruiz Brothers. Last updated on :54:26 PM UTC

Trellis 3D Printed Enclosure

Adafruit Si5351 Clock Generator Breakout

Adafruit 1.27" and 1.5" Color OLED Breakout Board

Adafruit DRV2605 Haptic Controller Breakout

Adafruit CCS811 Air Quality Sensor

Adafruit Mini TFT " 160x80

Monochrome OLED Breakouts

Joy Featherwing. Created by Dean Miller. Last updated on :03:07 PM UTC

Android GBoard Morse Code Control with Circuit Playground Express

Adafruit Color Sensors

FLORA TV-B-Gone. Created by Becky Stern. Last updated on :32:57 PM UTC

Introducing Adafruit Trellis

Adafruit Mini TFT with Joystick Featherwing

Adafruit SGP30 TVOC/eCO2 Gas Sensor

Adafruit MMA8451 Accelerometer Breakout

Adafruit ATWINC1500 WiFi Breakout

1.8" TFT Display Breakout and Shield

Adafruit ATWINC1500 WiFi Breakout

Adafruit WINC1500 WiFi Shield for Arduino

Adafruit 8x16 LED Matrix FeatherWing

Sino:bit with Arduino

7 Portable Multitouch Raspberry Pi Tablet

Adafruit HUZZAH32 - ESP32 Feather

BLE Light Switch with Feather nrf52840 and Crickit

Naughty or Nice Machine

Adafruit ATWINC1500 WiFi Breakout

Desktop MQTT Client for Adafruit.io

Adafruit eink Display Breakouts

PyPortal NeoPixel Color Picker Created by Kattni Rembor. Last updated on :42:41 PM UTC

Adafruit PCF8523 Real Time Clock

Adafruit MMA8451 Accelerometer Breakout

Adafruit MMA8451 Accelerometer Breakout

FeatherWing Proto, Doubler and Tripler

Getting Started with FLORA

GPS Logging Dog Harness

Adafruit TPL5110 Power Timer Breakout

MiniPOV4 - DIY Full-Color Persistence of Vision & Light-Painting Kit

Introducing Circuit Playground

Adafruit 9-DOF IMU Breakout

Using Zapier with Adafruit IO

Adafruit IO Basics: ESP Arduino

NeoMatrix 8x8 Word Clock

Adafruit 3.5" 480x320 TFT FeatherWing

ISS Pin. Created by Leslie Birch. Last updated on :27:30 PM UTC

FeatherWing Proto and Doubler

MCP Bit DAC Tutorial

Adafruit 3.5" 480x320 TFT FeatherWing

BeagleBone. Created by lady ada. Last updated on :46:10 PM UTC

3D Printed Case for Adafruit Feather

Sewable NeoPixels. Created by Becky Stern. Last updated on :50:14 PM EDT

Introducing Circuit Playground

Adafruit AS channel Visible Light Sensor

Adafruit PowerBoost 500 Shield

MCP Bit DAC Tutorial

Rx Snapchat Spectacles for DIY and STEM

Clockwork Goggles. Created by John Park. Last updated on :03:10 PM UTC

Adafruit LED Backpacks

Portable Apple Watch Charger

Adafruit 2.4" TFT FeatherWing

Adafruit 7-Segment LED FeatherWings

Adafruit 10-DOF IMU Breakout

Adafruit TPL5111 Reset Enable Timer Breakout

Adafruit DS3231 Precision RTC Breakout

Circuit Playground Express Head-Tilt Ears

Mini Mac Pi. Created by Ruiz Brothers. Last updated on :43:27 PM UTC

Adafruit Kegomatic. Created by Becky Stern. Last updated on :00:52 AM UTC

Neon LED Signs. Created by John Park. Last updated on :11:09 PM UTC

7" Portable HDMI Monitor

Adafruit LED Sequins. Created by Becky Stern. Last updated on :02:00 AM UTC

MLX90393 Wide-Range 3-Axis Magnetometer

'Sup Brows. Created by Kate Hartman. Last updated on :52:04 PM UTC

Adabot Operation Game

Getting Started with FLORA

Guardian Shield+ Zelda Breath of the Wild

Boomy The Boombox. Created by Ruiz Brothers. Last updated on :52:13 PM UTC

Sword & Wand Prop Effects with Circuit Playground

Fiddy - the FTDI Clip

Using IFTTT with Adafruit IO to Make an IoT Door Detector

Getting Started with FLORA

Bike Wheel POV Display

3D Printed Camera LED Ring

Adafruit Feather 32u4 Basic Proto

Transcription:

Adafruit GPS Hat in Windows IoT Core Created by Rick Lesniak Last updated on 2017-01-01 08:17:19 PM UTC

Guide Contents Guide Contents Overview Assembly GPSDemoApp Adafruit Class Library 2 3 4 6 13 Adafruit Industries https://learn.adafruit.com/adafruit-gps-hat-in-windows-iot-core Page 2 of 16

Overview Location, location, location... What could be more important? And now your Raspberry Pi can help keep you centered with the Adafruit Ultimate GPS Hat and Windows IoT Core! In this guide, we'll take you through setting up and running our GPS Demo IoT application. Works on Pi Model A+ or B+, Pi 2, and Pi 3. (New to Windows IoT Core? Check out our Getting started with Windows IoT Core (http://adafru.it/scv) series of tutorials!) Adafruit Industries https://learn.adafruit.com/adafruit-gps-hat-in-windows-iot-core Page 3 of 16

Assembly The Hat comes with the GPS assembled onto the HAT circuit board. There's also a 2x20 GPIO header. Some light soldering is required to attach the 2x20 GPIO header to the HAT, but it's fast and easy for anyone with a soldering iron and solder. You can also swap the plain female header we provide with a 'stacky' type that lets you plug in a hat or GPIO cable on top (http://adafru.it/2223), or you can use a slim ultra-low-profile header. (http://adafru.it/eja) You'll also want to add a 12mm CR1220 coin cell as a backup for the GPS. This will allow the GPS to acquire satellites faster on startup, and it will preserve your settings if the Hat is disconnected from power. It will also let you use the real-time-clock capability of the GPS HAT. To make air-shipping eaiser, the HAT does not come with a coin battery! Y (http://adafru.it/em8)ou can pick one up locally or order one from us. (http://adafru.it/em8) Adafruit Industries https://learn.adafruit.com/adafruit-gps-hat-in-windows-iot-core Page 4 of 16

Solder the 2x20 header into the matching 2x20 rows of holes on the Hat, then plug the Hat into your Pi. That's it! You're ready to go - no preliminary software or hardware setup necessary! Adafruit Industries https://learn.adafruit.com/adafruit-gps-hat-in-windows-iot-core Page 5 of 16

GPSDemoApp To get started, download the GPSDemo solution from github and save it in your favorite Windows IoT project folder. Download GPSDemo Solution http://adafru.it/scw On the github page, you'll see a green button labeled 'Clone or Download'. Click that and select 'Download Zip'. Extract the downloaded zip file to your projects folder. Now, open the GPSDemoApp solution file in Visual Studio (you'll need to use VS 2015 or later). Adafruit Industries https://learn.adafruit.com/adafruit-gps-hat-in-windows-iot-core Page 6 of 16

GPSDemoApp is a Headed application. That means it has a user interface (Headless applications run in the background and don't have a user interface). Our user interface is very simple, but it shows important updates from the GPS in real-time: Adafruit Industries https://learn.adafruit.com/adafruit-gps-hat-in-windows-iot-core Page 7 of 16

When Visual Studio comes up with the GPSDemoApp solution, you'll see MainPage.xaml in Solution Explorer. This is the user interface designer file. If you click on the line that says MainPage.xaml, MainPage.xaml.cs will drop down. This is the C# code that goes with the user interface, and this is where the GPSDemoApp code lives. Adafruit Industries https://learn.adafruit.com/adafruit-gps-hat-in-windows-iot-core Page 8 of 16

In MainPage.xaml, we've requested a Page_Loaded event to occur when the GUI has been fully initialized. We'll use the Page_Loaded event to create a new GPS object. We'll also set up a couple of events that will notify us when a new GPS NMEA sentence has been received. Finally, we'll call StartGPS to begin reading NMEA sentences from the GPS HAT. StartGPS is an asynchronous task in MainPage.xaml.cs. We don't want to block the main Adafruit Industries https://learn.adafruit.com/adafruit-gps-hat-in-windows-iot-core Page 9 of 16

UI thread (where Page_Loaded was called from), so we'll do our GPS inisialization from a separate task. First thing is to call the GPS library function ConnectToUart. The GPS Hat communicates with the Pi over the Pi's serial port. So, we need to attach and open that port to talk to the GPS. Once the serial port is connected, we tell the GOS which NMEA sentences we're interested in receiving, and how often we'd like those sentences to be updated. For these operations, we call the librry functions SetSentencesReporting and SetUpdateFrequency. Finally, we start yet another asynchronous task. This is the task that reads the GPS and parses the NMEA sentences for us. the startreading function takes care of that for us. At this point, the GPS Library is reading and parsing sentences from the Hat. But we want to be notified when a new sentence comes in. That's what the events are for. Each event is given a data structure that contains all the data parsed from the sentence. The GPS library will fire an event with each sentence received, complete with the latest data. We set up event functions to capture those events and display the parsed GPS data on our GUI. Adafruit Industries https://learn.adafruit.com/adafruit-gps-hat-in-windows-iot-core Page 10 of 16

Adafruit Industries https://learn.adafruit.com/adafruit-gps-hat-in-windows-iot-core Page 11 of 16

There's one other thing we need to do, and that's to add a reference to the AdafruitClassLibrary. This is a special library package containing Windows IoT Core driver software for a variety of Adafruit products. The Adafruit Class Library contains the GPS class that we've been using here in the demo app. The GPS class takes care of reading and parsing sentence data from the GPS, and is responsible for firing the events that provide the app with sentence information. Details on installing the Adafruit Class Library are on the next page. For details on the GPS class itself, see the Adafruit Class Library documentation (http://adafru.it/scx). But wait.. there's still one other thing. The GPS Hat uses Serial communications. We have to configure the app for serial capability. This is done in the Package.appxmanifest file. You can open the package manifest editor by double-clicking on the file in Solution Explorer. You can set all sorts of capabilities for the app in the editor. One thing you can't set in the editor is the serial capability. For that, we have to use a regular text editor. Right-click on Package.appxmanifest in Solution Explorer and select 'Open With...'. In the popup list, select 'Source Code (Text) Editor'. The editor will open with the raw XML contents of the package manifest. Look for this section near the bottom: <Capabilities> <Capability Name="internetClient" /> </Capabilities> We need to add our serial capability to this <Capabilities> block. Edit the block so that it looks like this: <Capabilities> <Capability Name="internetClient" /> <DeviceCapability Name="serialcommunication"> <Device Id="any"> <Function Type="name:serialPort" /> </Device> </DeviceCapability> </Capabilities> Adafruit Industries https://learn.adafruit.com/adafruit-gps-hat-in-windows-iot-core Page 12 of 16

Adafruit Class Library The Adafruit Class Library is a special library package containing Windows IoT Core driver software for a variety of Adafruit products. To use the library, you must add a reference to it in your project. To add the reference to the Adafruit Class Library, you'll need to use the NuGet Package Manager, which is a standard part of Visual Studio. To get to the Package Manager, open the Project Menu and select "Manage NuGet Packages..." In the Package Manager window, select "Browse", and enter "AdafruitClassLibrary" in the search box. Select the library in the list, and click the Install box on the right-hand side of the window Adafruit Industries https://learn.adafruit.com/adafruit-gps-hat-in-windows-iot-core Page 13 of 16

You should now see AdafruitClassLibrary under References in Solution Explorer. That's all there is to it! Adafruit Industries https://learn.adafruit.com/adafruit-gps-hat-in-windows-iot-core Page 14 of 16

Sources for the Class Library are available here! Adafruit Industries https://learn.adafruit.com/adafruit-gps-hat-in-windows-iot-core Page 15 of 16

Sources for the Class Library are available here! AdafruitClassLibrary sources http://adafru.it/sqd Adafruit Industries Last Updated: 2017-01-01 08:17:18 PM UTC Page 16 of 16