Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

UltraDynamo (Part 1) - It All Starts Here!

0.00/5 (No votes)
14 Jan 2013 1  
In this section, we look at the basics to get going.
Fork me on GitHub

Note 1: The source code is marked V1.1+ as it contains the code used in the V1.1 release as well as some of the stuff still in development that is hidden in the background.

Note 2: The Build Event code for code signing has been removed as this contained paths and passwords relevant to my build only. There is a description later in the article of the build event code.

Note 3: Intel closed its AppUp store on March 11th 2014, associated downoad link removed from article.

Table Of Contents

Introduction

This article series will be the new home of UltraDynamo. UltraDynamo was my entry to the Intel AppUp Ultrabook™ competition (October 2012) hosted by CodeProject. The original article for the competition can be found here.

In this article, I will hopefully take you through the various aspects of developing the application, as well as looking at some of the finer detail within the code. As I continue to develop the application (when time allows!), I will hopefully roll the changes/updates and any new interesting aspects back into this article.

Originally, this started life as one long article, but I decided to split this up into functional aspects, as it became quite unmanageable. As the application develops over time, it will be easier to add in updates to the relevant part and make life slightly easier.

What is UltraDynamo

UltraDynamo is a Windows desktop application that makes use of the various sensors available in the next generation of Ultrabooks. These sensors include:

  • Accelerometer
  • Gyrometer
  • Inclinometer
  • Compass
  • GPS
  • Ambient Light

The intent of the application is to provide a Rolling Road environment for motor sport enthusiasts that can use the sensors to determine the performance of their vehicles. Technically, it should be possible to perform functions such as:

  • Reaction timers
  • Acceleration / Braking timers e.g., 0 to 60, 0 to 60 to 0
  • Distance timers e.g., quarter mile
  • Power Calculations e.g., Brake Horsepower
  • Mapping data to GPS locations and overlay onto maps (e.g., Google Maps)

The data can then be presented to the user in various formats, e.g., numerical, charts, pictures.

Is the Application Finished?

Far from it, this is very much a work in progress as time allows. As new features are added or existing features improved, I hope to keep this article series up to date and share the source and compiled applications with the community here on CodeProject.

Can I Contribute, Make Suggestions, Report Problems?

Of course you can, use the messaging features of Codeproject to leave a forum message at the bottom of the article sections.

Don't expect miracles though, time is limited and I have plenty of other things to be doing as well.

My Development Environment

In order to develop this application, I am using the following:

  • Primary development machine: Windows 8 Pro desktop computer, no sensors, Visual Studio 2012 Pro
  • Secondary development machine: Windows 8 Pro laptop computer, no sensors, Visual Studio 2012 Pro
  • Test machine: Windows 8 Pro, Ultrabook with Sensor platform, Visual Studio 2012 Pro
  • Source Code Repository: Windows 2008 R2 Server running VisualSVN Server

I received the Ultrabook as part of the competition, so did not have that for initial development or testing of the sensors. This made for an interesting work around which I will cover later on. In order to keep all the machines in check, I use VisualSVN Server as a source code repository hosted on my Windows 2008 R2 virtual machine at 1&1. In order to allow the Visual Studio 2012 IDEs to integrate and communicate with the source code repository, I use ankhsvn plugin for Visual Studio. It is a simple case of checking in any code changes on one machine following any edits, then updating source to latest version on the others. This works very well as a method of managing the source from a multi-machine single developer point of view.

The application UltraDynamo is a Windows8 Desktop application using Windows Forms written in C#.

For the code signing tools and access to the sensor diagnostic tools, etc., you need to install the Windows 8 Software Development Kit (SDK). It is available from here[^].

Preparing Visual Studio 2012

The first thing that must be done when developing for Windows 8 and the Windows Runtime (WinRT) was to make a couple of modifications to the project files created by Visual Studio.

The very first thing to do is create a new Windows Forms C# application and target the relevant .NET Framework, in my case, .NET 4.5.

After this, you must unload the project. To do this, from the solution explorer, right click the project and select unload:

Next, in Visual Studio, right click the project and select Edit insertyourprojectname.csproj.

Insert the new PropertyGroup just under the main Project element as shown below:

Save the changes, and close the editor window. Next in Solution explorer, reload the project again:

The next thing we need to do is add the suitable references to the Windows Runtime and the sensor libraries. First, in solution explorer, under the project, right click on References and select Add Reference.

Finally, we need to add the Sensor library (Windows.Devices.Sensors.dll) and the Introp library (System.Runtime.InteropServices.WindowsRuntime.dll). Repeat the Add Reference process again, but this time, select Browse and navigate to where the libraries are stored. See the image below for paths:

External Controls

In the dashboard image above, you will see form makes use of dials. I didn't have a lot of time to go and start writing my own controls or finding different controls to try. Fortunately, I found a dial control here on CodeProject. Ambalavanar Thirugnanam had already written and made available for use a control called Aqua Gauge, this was very easy to implement and was a great control to use as an initial implementation.

The source code for the control was dropped into my application and as required, the header was left in place:

/// Aqua Gauge Control - A Windows User Control.
/// Author  : Ambalavanar Thirugnanam
/// Date    : 24th August 2007
/// email   : [email removed from article to protect from address sniffers]
/// This is control is for free. You can use for any commercial or non-commercial purposes.
/// [Please do no remove this header when using this control in your application.]

Release History

  • V1.1 - This used the improved sensor manager code, added the double buffering to the drawing aspects and re-instated the simulator code. The first test code of the reaction timers is present in the source, but not available to the user.
  • V1.0 - This was the first rushed out the door code. It had flickering displays, the simulator code was disabled and hidden from view.

On to the Next Part

In the next section, we will take a look at the sensors.

Part 2 - It is all about the sensors

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here