NetMF cloud connectivity options

I do most of my dev work with NetMF devices and Windows Azure so I though it would be useful\interesting to explore the different cloud connectivity options.

I’ll start with the simplest possible HTTP based approach, look at how to reduce the device memory footprint, reduce traffic on the wire, secure the data, and take the solution mobile.

Then, as time allows I’ll build clients which use

The initial scenario is a GPS equiped NetMF device reporting position information to an application running in Windows Azure. Rather than reinventing the wheel I have used the NetMF Toolbox NMEA GPS module but have added HDoP reporting.

The samples will run on a Netduino, Netduino Plus or Fez Spider.

For the netduino based examples the BoM is

NetMF HTTP Debugging with Fiddler

Debugging problems with HTTP based connectivity on NetMF clients can be a bit awkward, particularly if the server side application is Azure based. You can debug an Azure application locally and call if from a NetMF device attached to you local network with a couple of hacks….

First configure fiddler to accept connections from remote clients and note down the port number

Fiddler Options

Connections Tab

On the device change the request URL to be a machine local one (cut n paste from the browser) for debugging using the Azure emulator or cloud one

private const string CloudServerUrl = @"";
private const string CloudServerUrl = @"";

Then setup the NetMF HTTP request proxy endpoint to be Fiddler

request.Headers.Add("x-DeviceMacAddress", DeviceMacAddress());
request.Headers.Add("x-3DFix", Gps.Fix3D.ToString());
request.Headers.Add("x-GPSTime", Gps.GPSTime.ToString("yyyy MM dd hh:mm:ss"));
request.Headers.Add("x-Latitude", Gps.Latitude.ToString("F6"));
request.Headers.Add("x-Longitude", Gps.Longitude.ToString("F6"));
request.Headers.Add("x-HDoP", Gps.hDop.ToString("F2"));
request.Headers.Add("x-Altitude", Gps.Altitude.ToString("F1"));
request.ContentLength = 0;

request.Proxy = new WebProxy("", 8888 );

using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
Debug.Print(" HTTP Status:" + response.StatusDescription);
if (response.StatusCode != HttpStatusCode.OK)

Then you should be able to see the requests & responses in Fiddler

x-DeviceMacAddress: 5C-86-4A-00-3E-6B
x-3DFix: True
x-GPSTime: 2013 01 09 08:31:32
x-Latitude: -43.XXXX
x-Longitude: 172.XXXX
x-HDoP: 1.21
x-Altitude: 1.6
Content-Length: 0
Connection: Keep-Alive

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 09 Jan 2013 08:31:32 GMT
Content-Length: 17

FEZ Spider NetMF 4.2 Networking revisited

I was determined to get the J11D Ethernet module working in the graphical Designer so after a lot of reading + trial and error….

Making the J11D work after both reflashing the firmware & reboot was critical

Custom MMA8451Q SeeedStudio Twig

Lastnight wired up a SeeedStudio Grove system compatible twig based on one of the MMA8451Q breakout boards I bought. It has two connectors one for the I2C interface the other for the two interrupt lines which the device has.

MMA8451Q SeeedStudio Twig

I can read acceleration values from the device and once I have the 14bit 2s complement value conversion thouroughly tested I will add code to to configure the interrupt functionality.

Need to make connector leads a bit longer on V2…

FEZ Spider MF 4.1 and 4.2 Networking differences

I upgraded one of the two FEZ Spider boards I have to Version 4.2 of the .NETMF and this has caused some problems with the MF Deploy Network Configuration and also broke some networking code.

The MFDeploy Network configuration save fails with “Invalid configuration data from Plug-In” which others in the GHI Forums have also encountered e.g.

When I ran up my code the client IP address, gateway address etc. weren’t getting setup properly, My home network uses DHCP and this was fixed with .EnableDhcp(). I then noticed that the DNS address was not what I was expecting. It was pointing to one of the OpenDNS project servers. This was fixed by the .EnableDynamicDns();

This code works with V4.1

// This could be configured via MFDeploy

// error checking etc. removed

Debug.Print("Client IP address:" + networkInterface.IPAddress.ToString());
Debug.Print("MAC Address: " + BytesToHexString(networkInterface.PhysicalAddress));
Debug.Print("IP Address: " + networkInterface.IPAddress.ToString());
Debug.Print("Subnet Mask: " + networkInterface.SubnetMask.ToString());
Debug.Print("Gateway: " + networkInterface.GatewayAddress.ToString());
foreach (string dnsAddress in networkInterface.DnsAddresses)
Debug.Print("DNS Server: " + dnsAddress.ToString());

After some mucking around I found this code works for a Fez SPider running V4.2
static readonly EthernetBuiltIn Ethernet = new EthernetBuiltIn();

void ProgramStarted()

if (!Ethernet.IsActivated)

// This code could be removed once the MFDeploy issue is sorted

// error checking etc. removed

Debug.Print("Client IP address:" + Ethernet.NetworkInterface.IPAddress.ToString());
Debug.Print("MAC Address: " + BytesToHexString( Ethernet.NetworkInterface.PhysicalAddress));
Debug.Print("IP Address: " + Ethernet.NetworkInterface.IPAddress.ToString());
Debug.Print("Subnet Mask: " + Ethernet.NetworkInterface.SubnetMask.ToString());
Debug.Print("Gateway: " + Ethernet.NetworkInterface.GatewayAddress.ToString());
foreach( string dnsAddress in Ethernet.NetworkInterface.DnsAddresses )
Debug.Print("DNS Server: " + dnsAddress.ToString());