#Myo – Working with the Orientation and Gyroscope in c#

Hi !

I’m moving on the series of Myo posts

  1. Getting started, #Windows10 configuration
  2. Starting as a developer with some C++ basic code
  3. MyoSharp a C# SDK implementation for the Myo armband

Today I’m going to talk about one of the coolest features in the armband: the gyroscope sensor. Maybe the best way to do this, is to show how easy is to control a 3D Cube using our arm in a natural way.

gif 4

Note: I need to add some noise removal to the sample so the cube rotation is more natural.

Myo SDK provides a couple of elements which defines the orientation and location of our arm, this is know as Spatial Data. Spatial data informs the application about the orientation and movement of the user’s arm. The Myo SDK provides two kinds of spatial data:

  • An orientation represents which way the Myo armband is pointed. In the SDK this orientation is provided as a quaternion that can be converted to other representations, like a rotation matrix or Euler angles.
  • An acceleration vector represents the acceleration the Myo armband is undergoing at any given time. The SDK provides this as a three-dimensional vector.

For this sample, I’ll use the X, Y and Z values from the gyroscope and I’ll apply this value to a camera focused on a 3D Cube.

When the Main WPF Window is Loaded is time to

  • create a Transform3DGroup to support the rotation in the 3 axis
  • initialize the code to interact with the Myo armband and subscribe for the Gyroscope value changes


And then we get to the interactive section. Get the Gyroscope data and apply some camera rotation to the cube. In the Camera Rotation we need to manage some cross thread calling, because all the information we receive from the Myo is on a different thread.


Greetings @ Toronto

El Bruno



Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: