Project tutorial
My motorbike Telemetry

My motorbike Telemetry © MIT

Telemetry system of my Ducati Monster based on Arduino, UWP, Azure features and Machine Learning. Enterprise IoT Cloud Solution.

  • 99 respects

Components and supplies

Apps and online services

About this project

Each time I start a new project I try to create something exploiting the latest technologies related to my passions. For this Project I decide to combine my passion for the motorcycle with my favourite hobby (use the Arduino).

The Idea

I have always been fascinated by the telemetry images that I see on TV about motogp race. Seeing images like below, I imaged how I could build it using my favourite gadget (Arduino) and my programming knowledge.

So I decided to develop a telemetry system based on Arduino and Azure, that was easy to replicate in order that all motorcycle enthusiasts may have one in their motorbike.

As will be show below , this telemetry system will be able to get the following information about your driving style :

  • Speed [Km/h]
  • GPS Position (Latitude/Longitude)
  • Satellite informations (Sat number, Hdop)
  • Altitute [meters]
  • Lean Angle
  • Wheelie Angle
  • G Acceleration in the 3 axes [m/s^2]
  • External Temperature [°C]
  • Back Tyre Temperature [°C]
  • Front Shock Absorber [cm]
  • Back Shock Absorber [cm]

For do that I used an Arduino Uno R3, some sensors, an UWP deployed in a windows Phone and some Azure services.

The workflow is described in the following picture:

  • Phase 1 - All telemetries data are acquired from the control unit about twice at second (the control unit is positioned on the motorbike).
  • Phase 2 - Each time that the data are acquired, the data are sent by bluetooth from Arduino to Windows Phone.
  • Phase 3 - The data are displayed in the Phone (for more details please read "Software" section) and then sent by 3G/4G network to Azure IoT HUB.
  • Phase 4 - On azure there is a Stream Analytics Job that receives the data from the IoT HUB and saves the informations in a SQL Azure database.
  • Phase 5 - On azure has been deployed a WebApp that use the SQL database data in order to show the telemetry data in real time (please read section Web App)
  • Phase 6 - The WebApp, uses an authentication process and show all telemetry information in charts. (All data are retrieved from sql azure database using Entity Framework)
  • Phase 7 - All data saved on SQL azure database are processed by a Machine Learning in order to retrieve information about your "driving style". The scope will be understand how to modify your driving style in function of the telemetry parameters in order to improve your driving performance.

I Think IT'S PRETTY COOL!!! Let's start to describe the project

Hardware setup

My hardware configuration is shown below.

My hardware setup is made up of:

  • 1 x Arduino Uno R3
  • 2 x Ultrasonic ranging module HC-SR04, Used to determined the shock absorber extension (Front & Back)
  • 1 x Infrared Thermopile Contactless Temperature Sensor TMP006, used to determined the Tyre Temperature (can misure the External temperature also - Optional)
  • 1 x GPS-NEO7M, used to determined the GPS Position, speed, altitude
  • 1 x ADXL345, Used to evaluate the G acceleration in 3 axis and compute the Lean Angle and the Wheelie Angle
  • 1 x LM35DT in order to determined the external Temperature
  • 1 x HC-05, bluetooth module, to comunicate between arduino and the windows phone
  • 1 x Power supply (generic battery or mobile power bank)

STEP 1 - Bluetooth connectivity

I used the SofwareSerial library to connect the bluetooth module with the Arduino and enable the wireless communication with the Windows Phone.

A HC-05 Bluetooth Module was chosen for this scope, It is a class-2 bluetooth module with Serial Port Profile , which can be configured as either Master or slave.

Next Step has been to change the Default Name of my Bluetooth device, the Default name was HC-05 ... it was not "attractive"

in order to change the defailt name is necessary use the AT Commands, in this LINK you can find an usefull step by step guideline.

How to use this device:

In your Arduino code:

  • include the SoftwareSerial library
  • define the RX/TX port
  • inizialize the comunication:
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10,11); // RX-TX
void setup()

You are now ready to send via Bluetooth every string you want using the following command line:

BTSerial.print("Hello Hackster");

The communication between Windows Phone and Arduino is now ready and it was very easy!

STEP 2 - GPS comunication

The hardware used for this scope has been a GPS-NEO7M module, it's a low power GPS module that has 56 channels and outputs precise position updates at 10Hz.

The comunication between Arduino and the GPS Module has been made by the SoftwareSerial Library and exploiting a very interesting library named TinyGPS++

For more details about the TinyGPS++ library I suggest to read the following page By Mikal Hart

How to comunicate with this sensor:

  • Define the RX/TX port
  • inizialize the TinyGPS object
  • inizialize the comunication

See the code below :

#include <SoftwareSerial.h>
#include <TinyGPS++.h>
// Define serial connection with the GPS
SoftwareSerial ss(12,13); // RX-TX
// Define a TinyGPS Object
TinyGPSPlus gps;
void setup()
// GPS Inizialize
void loop()
// While GPS in available read the informations
double lon=gps.location.lng();    

STEP 3 - Accelerometer

In order to determin the accelerations values in the 3 axes and for compute the roll and pitch angle (Lean and Wheelie angle), I used an ADXL345

The ADXL345 is a small, thin, ultralow power, 3-axis accelerometer with high resolution (13-bit) measurement at up to ±16 g. Digital output data is formatted as 16-bit twos complement and is accessible through either a SPI (3- or 4-wire) or I2C digital interface.

The communication between Arduino and the ADXL345 sensor happens using the ADXL345.h Library.

Is very important understand that when you connect this sensor you will be able to determined the gravity acceleration in the 3 axes but the values are not immediately calibrated. You need to create a code for setting the OFFSET.

I decided to determined the "zero point" in the first loop. To do that the G acceleration in the first loop will be the reference values that you have to subtract to the subsequent measurements.

// first loop to 
if (i == 0) 
refXg = Xg; refYg = Yg; refZg = Zg;
i = 1;
// subtract the zero point
Xg = Xg - refXg;
Yg = Yg - refYg;
Zg = Zg - refZg + 1;

Then You have to compute the Lean Angle and the Wheelie Angle based on the g acceleration components.

Below You can see the 2 simples Math equations to do that:

// Roll & Pitch Equations
roll  = -(atan2(-fYg, fZg) * 180.0) / M_PI; 
pitch = (atan2(fXg, sqrt(fYg * fYg + fZg * fZg)) * 180.0) / M_PI;
IMPORTANT: Roll and pitch are 2 terms used in aviation, for our purpose Roll equal to Lean Angle and Pitch is equal to Wheelie
For more details please see the Arduino code attached to this project.

In this project you have to consider:

  • Z axis is the Natural gravity axes
  • Y axis is the direction of the motion
  • X axis is the lateral motion

How to comunicate with this sensor:

  • inizialize the ADXL345 object
  • inizialize the comunication

Now you are ready to read the acceleration informations, see the below code:

#include <SoftwareSerial.h>
#include <ADXL345.h>
#include <Wire.h>
// Define serial connection with the GPS
SoftwareSerial ss(12,13); // RX-TX
// Define a ADXL345 Object
ADXL345 acc;
void setup()
// ADXL345 Inizialize
void loop()
// Read g acceleration components
double Xg,Yg,Zg;,&Yg,&Zg);

STEP 4 - Tyre Temperature

To determined the Tyre temperature I needed a sensor that for obvious reasons doesn't touch the tyre. the unique way has been to use an Infrared temperature sensor. For do that I decided to use a TMP006 sensor

The TMP006 are fully integrated MEMs thermopile sensors that measure the temperature of an object without having to be in direct contact. The thermopile absorbs passive infrared energy from an object at wavelengths between 4 um to 16 um within the end-user defined field of view.

The corresponding change in voltage across the thermopile is digitized and reported with the on-chip die thermal sensor measurement through an I2C

Now the question is, where i have to positioning my sensor? Looking the datasheet you can find important informations about the recommended distance between sensor and object.

You have to observe the rule that the distance need to be lower then half radius of solid angle of the object.

in other words, my tyre width is 160mm , the half width will be the radius (R) of the solid angle, so the final result of R will be 80mm. So the recommended distance will be 40mm (or less) , equals to R/2

The comunication between Arduino and the TMP006 is made using the SerialSoftware library and Adafruit_TMP006.h library

#include <SoftwareSerial.h>
#include "Adafruit_TMP006.h"
Variables for TMP006  Functions
Adafruit_TMP006 tmp006;
void setup()
void loop()
// Read object IR temperature  
float objt = tmp006.readObjTempC();
// Read sensor temperature (External Temperature)
float diet = tmp006.readDieTempC();

STEP 5 - External Temperature

The value of the external temperature has been determined using and LM35 sensor (DT package).

The LM35 series are precision integrated-circuit 1 temperature devices with an output voltage linearly-proportional to the Centigrade temperature.

Each Centigrade degree produce an Increase/Decrease voltage of 10 mV

The sensor value has been determined reading the Arduino analog input (AI)

int TempExtPin = A1;                // select the input pin 
float celsius = 0, farhenheit = 0;  // temperature variables
float millivolts;                  
int sensor;
sensor = analogRead(TempExtPin);          //Read LM35 value
millivolts = ( sensor / 1023.0) * 5000;   //millivolts output Voltage
celsius = millivolts / 10;  

STEP 6 - Ultrasonic Position

The purpose to use this sensor is to determined the escursion of the motorbike's suspensions.

The HC-SR04 measuring the time taken by the sound waves to turn back after encountering an obstacle. The sound waves emitted beam has a conical shape and the same applies to the reflected waves from an obstacle.

The sound waves speed in the air at 20°C is about 343,4 m/s, in this example for simplicity we will consider the approximate value of 340 m/s.

Considering the kinematics law S=V x t (where S: space or displacement of the object, V:velocity, t:time) we can announce that in our case the distance is S=0.034 x T.

We have to divide the time per 2 because the time that we converted is that used to go and come back by the waves, the final formula where t is the time returned from the sensor in cm/microsecond is:

S=0.034 x t/2

Below you can see an example that you can try to use to determined the distance of the object.

digitalWrite( triggerPort, LOW );
// Send 10microsec pulse to trigger
digitalWrite( triggerPort, HIGH );
digitalWrite(triggerPort, LOW);
long duration = pulseIn( echoPort, HIGH );
long r = 0.034 * duration / 2;

The above code well describe how the sensor works but You'll discover that this code is very slow and poorly performed.

For this project i decided to try the new library named NewPing.h for more details please visit this link and see the complete Arduino code of the project.

Use the NewPing.h library is very easy.

  • Include the library
  • define the trigger and echo port of the HC-SR04
  • initializes the object
  • call the ReadPositionPing function.
#include <NewPing.h>
Define Variables for HC RS04 Functions
// HC-RS04 ports
int triggerPort = 2;
int echoPort = 3;
// NewPing setup of pins and maximun distance
NewPing sonar(triggerPort, echoPort, 200);
void setup()
void loop()
int Pos=ReadPositionPing();
int ReadPositionPing()
unsigned int uS =;
return sonar.convert_cm(uS);
IMPORTANT: Remember that each libraries used are required to build Arduino Sketch and you need copy them in the following folder \Documents\Arduino\libraries\…

The UWP Software

The software consists of an user interface connected to the control unit via bluetooth. The UI show all data sent from the Arduino and send to IoTHub the sensor values.

The serial communication between Arduino and the UWP is interpreted by reading from the input string.

Each String received is validated by checking that contains the START and END markers. If the input string is correctly formatted, the application will spit the information and show them on the application User Interface.

Below you can see an example of a string sent from Arduino that contains the START/END markers, this string will be split by the "pipe" character in order to determined each sensor values:


below the Array definition after the split of the string sent:

  • Position 0 - START Marker
  • Position 1 - Latitude
  • Position 2 - N (Nord)
  • Position 3 - Longitude
  • Position 4 - E (East)
  • Position 5 - month
  • Position 6 - day
  • Position 7 - year
  • Position 8 -
  • Position 9 - speed (Km/h)
  • Position 10 - altitude (m)
  • Position 11 - satellites (number of satellites)
  • Position 12 - hdop (number of satellites in use)
  • Position 13 - roll
  • Position 14 - pitch
  • Position 15 - Xg
  • Position 16 - Yg
  • Position 17 - Zg
  • Position 18 - Audio (Optional-currently disable)
  • Position 19 - Distance (m)
  • Position 20 - Temperature (External temperature by LM35)
  • Position 21 - Temperature Tyre (Tyre temperature from TMP006)
  • Position 22 - Front shock Absorber (cm)
  • Position 23 - Back shock Absorber (cm)
  • Position 24 - END Marker

by "Serial Monitor" of the Arduino IDE you can see how the Arduino Code works:

All Arduino code and Library are at the following url on GITHUB

In order to manage all data sent from central unit via Bluetooth, I have developed an Universal Windows Applications that is a fine example of the power of the UWP. As you know an UWP is a platform that allow you to run the application in all device family with Windows 10 on board.

The user interface is very simple and intuitive, on the left side you can see the Bluetooth connection feature, in the middle 3 gauges used for show the speed, lean angle and Wheelie Angle. All G components are shown and on the right there information about the GPS position, temperatures and shock absorber excursions.

NOTE: the APP developed for this project can be installed in all IoT device family like Raspberry Pi2/3 , Dragonboard 410c and Minnowboard Max. For more details Please visit the following LINK, In add, if you would like to deploy the app in a IoT device, remember to add the reference Windows IoT Extensions in your Visual Studio project.

How to Deploy the App into the Windows 10 Mobile?

With Windows 10 SDK Preview Build 10166, Microsoft was introduce the Windows 10 Application Deployment (WinAppDeployCmd.exe) tool.

The Windows 10 Application Deployment (WinAppDeployCmd) is a command line utility that can be utilized to deploy a Universal Windows app from a Windows 10 PC to any Windows 10 mobile device. It allows users to deploy an .AppX file to a device connected through USB or available on the same subnet without requiring access to the complete Visual Studio solution.


First of all move your mobile device in "Developer Mode" (go to UPDATE & SECURITY => FOR DEVELEVOPER).

after that, connect your device via USB and make it visible USB connection (a PIN code will be returned)


Right click on your Project=>Store=>Create App Packages


In the Create App Packages wizard, select NO If you want to create a local package and click NEXT. After that choose processor platforms to target. For our purpose choose ARM platform and click CREATE.

At the end of creation process the wizard gives us a local URL where the package was created.

opening the url you'll find the Appx file available to be deployed on the the device.


Open a Command prompt and move your focus to C:\Program Files (x86)\Windows Kits\10\bin\x86\

and type in the following command line

WinAppDeployCmd install -file "C:\work\uwp\Gps\MotorbikeArduino\MotorbikeArduino\AppPackages\V1.35\MotorbikeArduino_1.0.35.0_Debug_Test\MotorbikeArduino_1.0.35.0_arm_Debug.appxbundle" -ip -pin AAA123

(where AAA123 is the pin code returned from your phone connected to the USB in Association mode)

For a compleate user guide about the syntax of WinAppDeployCmd.exe please visit the follow link

At the end of the process the application will be installed in your device and you will be able to "pin to start":

For this project I used my Windows 10 Mobile phone (Lumia 650)


Now we are ready to describe how to configured the Azure services. For this project will be necessary to create:

  • WebApp + SQL Azure
  • IoTHUB
  • Stream Analytics JOB
  • A DeviceId that will be used to send data to IoTHUB.

OK GO! Do you have an AZURE account?

STEP 1 - Create and configure IoT Hub:

The IoTHUB is the access point of the telemetry values to the Cloud.

Create your IoTHub, Click on New => Internet of Think => IoT Hub and compile the Hub fields and click Create

Subsequently, in your Azure dashboard, you may see the IoT HUB deploying and after some seconds your IoT HUB will be ready.

Click on the new tile in your dashboard and go to All settings blade.

See your IotHub Hostname and make a note:

In the Shared access policies blade, click the iothubowner policy, and then copy and make note of the connection string in the iothubowner blade

Ok...your Iot hub has been created successfully, you are almost ready to use it!

STEP 2 - Create and configure Stream Analytic

The stream Analytics has the purpose of read and write all data sent to the IoTHUB and save them into a database table.

Create a new Stream Analytics job:

Click on New => Internet of Think => Stream Analytics job

Compile all fields and click on Create button.

Now we are ready to configure Input/Output and the query of the streamAnalityncs JOB.

Set up Input - Select the Source. In our case the source will be the IoTHub

Setup the Output - Select the destination. In our case the output will be a table of the SQL Azure database (I'll show you how to create a sql db in the next step)

Before create the query, we have to create a SQL Azure DB. Please follow the next step and at the end we will back to create the streamAnalitycs query

STEP 3 - Create WebApp + SQL Azure

Go to dashboard and select WebApp+SQL (New => Networking => Web + Mobile => Web App + Sql)

Now configure your webapp compiling the following fields:

  • App Name
  • Choose a subcription
  • Choose a Resources Group ( if you don't have one create your first Resources Group)
  • Choose an App Service Plan and a pricing tier (for this example you can considerer to choose a F1 free plan)

Configure your SQL, create a new one and choose the name, pricing tier, server name and add Admin Login credentials:

Remember that if you don't have a STATIC IP in your network, and if you would like to work with your SQL Azure database in SQL Server Management Studio or in Visual Studio, you have to modify your Firewall adding a new rule for your IP.

Now back to the STEP 2, we are now ready to create the StreamAnalitycs Query. Click on StreamAnalyticJob tile and select "Query". Insert your query in the right panel.

As you can see, the query describes the process workflow. Catch the data from "MyTelemetryInputHub" and save them into "SqlAzureMyTelemetry" ... easy&wonderful!!

At the end, we have only to start the JOB clicking the START button.

Azure DashBoard: moving your attention on the dashboard you can see your control panel that it's look like this.

Create a DeviceId for HUB

This step is necessary in order to create a connection between my device and the IoTHUB. We need to create a new device identity and add into the ID registry of the IoT HUB.

For more information please visit the follow link

To generate a new one deviceId, you have to create a Console Application in Visual Studio.

In the NuGet Package Manager window, search and install the Microsoft.Azure.Devices package.

Add the below code In your Console application, replace your IoTHub Connection String and chose a deviceId alias (in my case the deviced is MyDucatiMonsterDevice).

class Program
//Install-Package Microsoft.Azure.Devices
static RegistryManager registryManager;
// Connection String HUB
static string connectionString = "xxxxxxxxxxxxxx";
static void Main(string[] args)
registryManager = RegistryManager.CreateFromConnectionString(connectionString);
// creates a new device identity with ID myFirstDevice
private async static Task AddDeviceAsync()
string deviceId = "myDucatiMonsterDevice";
Device device;
device = await registryManager.AddDeviceAsync(new Device(deviceId));
catch (DeviceAlreadyExistsException)
device = await registryManager.GetDeviceAsync(deviceId);
Console.WriteLine("Generated device key: {0}", device.Authentication.SymmetricKey.PrimaryKey);

Run the console application (press F5) and generate your device key!

WEB application

At this point of the project i thinked about how can i see my telemetry data and how can i show them to my friends and share the results on the social media. to do that I decided to create a responsive web site in ASP .NET

A responsive web site allow me to see the telemetry data in all device type (mobile phone, tablet, pc, surface) and platform (Windows phone, Android, iOS).

The website consist in a dashboard contains all my telemetries. The data has been read using the Entity framework from SQL Azure.

You can discover the web site by the following url:

Has been created an account for all Hackster Users, SignIn using the following user/psw credentials:

User ID: demo
Password: demo

The web site is look like this:

And look like this in mobile version:

When you create a web app in azure using the Free tier, the domain name will be something like this:


To change the domain name you have to buy one and on azure this is very simple! Follow this steps:

  • Go to your Azure dashboard and click on you web app Tile.
  • Select "Custom domains and SSL" and click on "Buy domains".
  • Fill all fields (about your domain name and your contact informations)

Ducati Monster Wiring

Now is time to Introduce my motorbike, this is my Ducati Monster 695 that for this project has been the cavy.

Below some pictures about my Hardware (control unit) mounted onboard.

to measure the tyre temperature I created a bracket clamped behind the wheel.

One Ultrasonic ranging module HC-SR04 has been fixed under the front headlight. It misures the distance between headlight and front mudguard.

The other one Ultrasonic ranging module has been fixed under the bike seat in order to determined the back shock absorber measuring the distance between seat and rear tyre.

The central unit containing the Arduino, the GPS, the Accelerometer and the external temperature sensor has been fixed behind the seat.

And at the end, after the wiring, my motorbike is look like this

Machine Learning

The last idea of this project has been try to understand if exist a correlation between telemetries data in order to try to understand how to improve my driving style.

My data samples are not relatable because I make different routes every time and the traffic conditions are never the same. I think that a good condition should be use the system in a speedway. I Imagine that in a real race could be usefull to understand by telemetry if you can increase the speed or if you have to decrease the speed according to the output values.

The Machine Learning (ML) embodies the magic of software insights about the data, solves problems by giving information that represents a certain evolution. The ML understands how a given phenomenon will evolve according to the data in its knowledge.

The first approach using the ML is to do Experiments. Using the data, you can play and be able to do the analysis with the aim of investigating the phenomenon that interests us.

Ok let's go to discover the Azure Machine Learning

Go to and sign in using your Azure account.

On the left of the page click on "Studio"

You will be redirect to your personal Dashboard and now you will be ready to create experiments

  • In the experiments blade, Click NEW (on the left button of the page).
  • The first step is to Import data that you would like to use in your ML. In my case I imported the data from SQL Azure.
  • Into my Table all data are varchar so i needed to convert it in float and excluding some bad data in order to have only best quality records. Below you can see the query used to import data
	CAST(speed as float) _speed,
	CAST(roll as float) _roll,
	CAST(pitch as float) _pitch,
	CAST(Xg as float) _Xg,
	CAST(Yg as float) _Yg,
	CAST(Zg as float) _Zg,
	CAST(TempExt as float) _TempExt,
	CAST(TempTyre as float) _TempTyre,
	CAST(FrontAbsorber as float) _FrontAbsorber,
	CAST(BackAbsorber as float) _BackAbsorber
from mytelemetry
	CAST(speed as float) >3 and 
	CAST(FrontAbsorber as float)>0 and
	CAST(BackAbsorber as float)>0 and 
	CAST(roll as float)<60 and CAST(roll as float)>-60
  • Then add a SPLIT DATA element in order to use some data to Train your ML and decide the data percentage to use for the configuration.
  • A data portion will be used to configure the template and the other portion to see if your model works fine. This will allow me to assess the goodness.
  • Add a Train Model and decide what is the field that would you like the model guess and decide which algorithm use for your train.
NOTE: The above step was not easy for me, because I don't have experience with the algorithms available in ML studio. For my scenario I decided to make many experiments in order to try to find the best one algorithm to use. As you can see below my first ML experiment looks like this:
  • Now we verify how he behaved the algorithm giving us a feeling of goodness, to do that we need to use "Score Model". the SM accept in input 2 sources, the first one is from Train Model and the second one from the SPLIT DATA.
  • At the end we ready to estimate the model according to the test data, comparing them with those that have not yet used (Evaluate Model).

Official Documentation about " Evaluate Model" can be found here

This is a business inteligense approach used to determine a magnitude and want to try to recover the information and classify them

Below there is a sample experiment useful for comparing 2 algorithms using the Evaluation Model, the 2 algorithms are Two-class decision jungle and Two-class decision forest .

When you pass on a scored model for a "two classes" classification algorithm, the evaluation model generates metrics shown below:

Classification Models

The above metrics are reported for evaluating classification models.

(All metrics are reported but the models are ranked by the metric you select for evaluation)

  • Accuracy measures the goodness of a classification model as the proportion of true results to total cases. Accuracy = (TP + TN) / (TP + TN + FP + FN)
  • Precision is the proportion of true results over all positive results. Precision = TP / (TP + FP)
  • Recall is the fraction of all correct results returned by the model. Recall = TP / (TP + TN)
  • F-score is computed as the weighted average of precision and recall between 0 and 1, where the ideal F-score value is 1. F1 = 2TP / (2TP + FP + FN)
  • AUC measures the area under the curve plotted with true positives on the y axis and false positives on the x axis. This metric is useful because it provides a single number that lets you compare models of different types.
TP is True Positive, FP is False Positive, TN is True Negative and FN False Negative

As you can see, the Two-class decision forest Algorithm have an Accuracy, Precision ,Recall and F1 Score near the value equal to 1, so i suppose that my model is good described, GREAT!!!

For more details about Evaluate Model please visit the following LINK

Predictive Experiment:

It's time to move our attention on the predictive functionality of the machine learning.

The Training experiment will be convert to a predictive experiment, this feature allows to integrate in others applications the opportunity to use your model and based on your model have a Prediction.

As you will see at the end of this section, We'll create a Web Service. This is very important if you would like to understand if your telemetries data follows your model and in order to understand if your driving style is correct or not.

For do that, has been created a new one Experiment, the data source has been the SQL Azure but this time the table used has been a new one. I tried to classify data based on telemetry values.

Now my data look like this and as you can see there is a new column named Scored that represents my classification:

Create the experiment like below, select the Train Model and add a Multiclass algorithm:

  • RUN the experiment and see the results:
  • Select the Train Model and click on SET UP WEB SERVICE => Predictive Web Service
  • Wait some seconds and your predictive service will be ready. Below you can see my Predictive Experiment layout:
  • Run this model and then deploy the web service by clicking on the DEPLOY WEB SERVICE button
  • Your service will be immediately ready to be used and a dashboard will appear, contain a "TEST" button where you can manually enter data and test your service
  • Click TEST button and compile all fields, use some fake values and see the Predictive result:

As you can see the result is equal to "SAFE DRIVING", this mean that my Predictive service has predicted that my driving style is Safe and no action is needed.

If the Result has been for example "HIGH STRESS HIGH SPEED" that means that I have to reduce speed!

IMPORTANT! For more details about Predictive service I suggest to read the following article:
NOTE: The more astute people will understand that it will be possible to convert a python script (or a R script) as a web service, simply enter our custom script into Machine Learning experiment and generate the web service

Conclusions about ML:

in this section we understand some things.

  • How configure an experiment in ML azure environment
  • we found that Two-class decision forest Algorithm well describe my motor bike telemetry and we train the ML for the predictive experiment using the Multiclass decision forest Algorithm
  • How to convert our Model in a Web Service creating a predictive experiment
  • we found some usefull information about my style of guide. Infact as you can see from the below graphs:

I prefer lean on the right and my lean angle doesn't depend for tyre temperature and from the speed. That mean that my tyres are high quality and in add I undestood that my motorbike prefers Wheelie when the tyre temperature is more than 35°C

CURIOSITY: Are you enthusiast about Azure Machine Learning? exists a good website contains many dataset about many case study. Please visit the following url and try to develop an algoritmic for your first ML.

Final Conclusions

In this project we covered many technological areas.

We discovered How is possible to create a funny Hardware using an Arduino and some sensor spending less then 60$ and using many services provided by microsoft.

We learned how is easy use Azure and how is interesting use Machine Learning Studio suite.

Has been realized a prototype that certainly needs improvements but i think is a good starting point for future developments from each people enthusiast about C#, Azure, Arduino and MotorBike.

Possible future Developments

To Improve this prototype i think will be usefull implements some things:

  • About the mobile app (UWP), in case that no 3G/4G network is available, the data are lost because i'm not able to send the data to azure. Would be usefull develop a buffering logic that in case of "no networking" available, stored the data and send them at a later time.
  • Create an APP for mobile platform using Xamarin, would be cool have an app who can run in Android OS and iOS also.
  • Use more precise sensors and increase performance/accuracy.
  • Make the central unit smaller, maybe using an Arduino MKR1000.
  • Create a social media Webapp to share your motorbike travel and telemetries in order to suggest to biker users what is the dangerous curves and increase the safety.
  • Modify the source of the Machine Learning using the Steam Analytics. In my case i prefered use a sql AZURE datasource because it was not possible ride the bike and develop the ML in the same time :)
The Last Future Development that I thought is shown below. Consist to add a new branch analysis in the azure environment (phase 8):

New branch work flow:

  • The new branch consists to sending back to device, through IoTHub, the information about the ML predictive service.
  • When the speed value is greater than 100 km/h a new one stream analyticsJob will send the telemetry data to Event Hub.
  • A cloud service reads this data from EventHub and send a request to the ML predictive service in order to have a score about the Driving Style.
  • The Cloud Service will send back the score to IoTHub, and IoTHub will send it to the device back (Windows Phone in this case)
Unfortunately my "Azure Credit" was finished. The above step will be described in my new project on Hackster as soon as possible ... STAY TUNED! ;-)

... and now ENJOY !! :-) feel free to contact me for any questions and tips.



Telemetry circuit diagrams
circuit diagrams of the Telemetry system. On board scheda
Motorbikeproject bb
Fritzing project


Similar projects you might like

GPS Datalogger, Spatial Analysis, and Azure IoT Hub.

Project tutorial by Shawn Cruise

  • 73 respects

Azure Stream Analytics saving lives!

Project tutorial by Asad Zia

  • 26 respects

Chromotherapy with Raspberry and Arduino

Project tutorial by Davide Longo

  • 40 respects

Home Automation Using Raspberry Pi 2 And Windows 10 IoT

Project tutorial by Anurag S. Vasanwala

  • 706 respects

Windows IOT - Automate your power outlets

Project tutorial by Syed Sanoor

  • 48 respects

The Arduino Gatekeeper

Project tutorial by Timothy Le

  • 50 respects
Add projectSign up / Login