Reading out the Xbox One controller in a Universal App

One of the reasons I bought an Xbox instead of a PS4 is that Microsoft made a promise that every console could be unlocked for developers. Since I’m fairly familiar with C#, Visual Studio and the Windows ecosystem in general, the choice made sense.

Let’s see what you can get out of the Xbox One controller using the standard Universal App API’s. Seems it’s fairly simple and uses a minimum amount of code.

Note: unfortunately you cannot use the Xbox one controller directly on a Raspberry PI 2/ 3 with Windows 10 IOT since there is, at the moment of writing, no driver for it…

Create a background task that polls the controller and translates everything into an Event:

Registering events to consume them later:

Consume the event and show something in the GUI:

All of this is sort of like a proof of concept. It’s up to you to extend this now.

If you want to, you can check out the GitHub repository here.

Using WiFi RSSI to estimate distance to an Access Point

As I was discussing the problem of having a reliable WiFi indoor positioning systems with a colleague of mine, I decided to have a go at it myself.

RSSI is short for ‘Received Signal Strength Indication’. In a nutshell: the further away you move from an access point, the weaker the signal.

If you measure the strength of the signal, you have an indication of your distance relative to the source.

This has been done over and over and over again using WiFi, Bluetooth, insert some wireless standard here… So all in all not much of a challenge.

However: it hasn’t been done that many times using C# in a Universal App project. The advantage is that you can run your code on anything that boots Windows 10. Even mobile phones or Raspberry PI.

It turns out that you can have the RSSI measurement amazingly fast and with just a few lines of code.

Listing the adapters:

Iterating over the adapters and reading RSSI of every Access point, order by SSID:

Getting distance from RSSI value using a formula:

Consult the full GitHub repository here.

The formula to calculate the distance is pretty straightforward.

d = 10 ^ ((TxPower – RSSI) / (10 * n))

  • TxPower is the RSSI measured at 1m from a known AP. For example: -84 dB.
  • n is the propagation constant or path-loss exponent. For example: 2.7 to 4.3 (Free space has n = 2 for reference).
  • RSSI is the measured RSSI
  • d is the distance in meter

Be aware that this is a very basic attempt and should perhaps be considered more of a ‘proof of concept’ as to see how well you can estimate distance.

You could extend this by using triangulation so you can have an X, Y and Z coordinate instead of just a radius.