I'm really new to both Raspberry and the whole electronics world: I'm experimenting with the board, using Windows IoT (since I'm quite familiar with C# as a development platform). I'm not, however, bound to this OS: I can switch to Raspian and see if I can play with Mono to use C# or change the language.

Anyway, for my project - after blinking LEDs for a while - I'd like to connect a sensor to detect positioning and later on a camera. As for the sensor, I noticed on Adafruit that they have a nice piece which includes accel/mag/gyro: they sell it as "for Arduino" and I'm not yet at the point where I can tell the difference what goes well with what.

Can I use this with Raspberry/Win? Do I have to revert to Raspian? Do I have to look for a completely different sensor?

Thank you!


2 Answers 2


The linked sensor appears to require special Arduino software to work as a useful device.

To get it to work you would either need to use an Arduino or port some pretty specialized code to the Raspberry Pi.

Unless you really need the claimed additional accuracy I would choose another sensor. Google 9DOF Raspberry Pi.

  • Thank you for pointing me in the right direction, I can find more info and tutorials now that I know that 9DOF or 9 degrees of freedom sensor is what I'm looking for. Something like this sparkfun.com/products/13944 looks promising. I don't have requirements in terms of accuracy, I need to start something, experimenting and see what happens.
    – ccalboni
    Commented Nov 7, 2017 at 11:30
  • That should be fine, You just need to check it can be powered from 3V3 (rather than 5V).
    – joan
    Commented Nov 7, 2017 at 12:01
  • Specs say "Operating Voltage: 3.3V", should be fine with the Raspi pin 1
    – ccalboni
    Commented Nov 7, 2017 at 12:42


[OP] new to Rpi and electronics, but quite familiar with Win C#

Now experimenting, but not bound to Win IoT

Can switch to Raspian Mono C# or even change language

Want to use sensor to detect position

Want to know if Adafruit accel/mag/gyro sensor for Arduino also for Rpi/Win?

Or should look for a different sensor?

Short Answer

Update: 2019aug03hkt1345

The following two references to 9DOF are good for newbies:

Using Inertial Sensors for Position and Orientation Estimation - M Kok etal, 2017

Rpi4B Buster AdaFruit Circuit Python Blinka using BNO055 9DOF MEMS Sensor and PCA9865 PWM Servo/DC Motor Driver

For newbies, I won't recommend to start with 9-DOF, MPU9250 (gyro + accelero + magneto) or similar, or even 10-DOF. I would suggest to start humbly, either 6-DOF MPU6050 (gyro + accelero), or the simplest 3-DOF ADXL345 (accelero), both are very cheap, popular, and recommended by SparkFuan and AdaFruit.

Long Answer


The OP introduces his background, his objective, and asks a couple of questions.

His objective is clear: detect position using a sensor.

He is considering a couple of alternatives, but he is very flexible on OS, language, and sensor

I am more or less on the mirror side of the OP. I am quite familiar with electronics and have 10 years hobbyist experience in Arduino and Rpi. I am familiar with Python, but know very little Win C#.

I have decided to do some research, and see if I can give an answer, or part of an answer.

Since I have almost zero experience in gyro/accelero/magnetic sensors, I need to do quite a bit of research first. So I am starting to write random, unstructured research notes which would finally be deleted, and hopefully replaced by my answer.

Research Notes

What is 9DOF?

As titled, the OP wants to use 9DOF sensors. I don't really know what the hell exactly is 9DOF. :) So I googled and started reading the following article.

9dof - The highest quality sensors - xsens.com‎

I skimmed xsens but could not find what is 9DOF. I only made a summary.

Xsens PCB fuses the following:

  1. Attitude and Heading Reference System (AHRS),
  2. Vertical Reference Unit (VRU), and
  3. Inertial Measurement Unit (IMU) on PCB,

And produces the following output:

  1. Inertial data,
  2. Magneticic field,
  3. Free acceleration,
  4. Roll/pitch,
  5. Heading tracking,
  6. Referenced yaw

Almost all the above terms are new to me, though I guess output 5 "Heading tracking" should be important to avoid airplane crashing. :)

6/9 DOF, MEMS, IMU, Gyro/Accelero/Magneto sensor reading notes

I still don't know what is 9-DOF. So I wikied the following to read. Finally I now know that 6-DOF is for mechanical (3 translation, 3 rotating), 3-DOF is for magnetic, adding together is 3 + 3 + 3 = 9 DOF. I found Wikipedia good. So I am reading more wiki articles.

And the summary of 6 degrees of freedom:

  1. Moving up and down (elevating/heaving)
  2. Moving left and right (strafing/swaying)
  3. Moving forward and backward (walking/surging)
  4. Swivels left and right (yawing)
  5. Tilts forward and backward (pitching)
  6. Pivots side to side (rolling)

Degrees of freedom (mechanics) (DOF) - Wikipedia

Microelectromechanical systems (MEMS) - Wikipedia

Inertial measurement unit (IMU) - Wikipedia

Gyroscope (Gyro) - Wikipedia

Accelerometer (Accelero) - Wikipedia

Magnetometer (Magneto) - Wikipedia

AdaFruit or SparkFun, That is the Question

The OP mentions AdaFruit but not SparkFun. I think one reason is that Adafruit is more friendly to everybody, but SparkFun more friendly to technical people. Anyway, I googled both and summarized below.

After considering many factors, my first choice is MPU9250.

AdaFruit Motion Sensors Catalog

Accelero - AXDL335, AXDL345, AXDL326, AXDL337, AXDL 343, LIS3DH, MMA8451

Gyro - L3GD20H,

9-DOF - BNO055, FXOS8700 + FXAS21002, L3GD20H + LSM303

10-DOF IMU - L3GD20H + LSM303 + BMP180

SparkFun Gyro/Accelero/Magneto

Triple Axis Accelerometer and Gyro Breakout - MPU-6050 $29.95

VR IMU Breakout - BNO080 (Qwiic) $34.95

SparkFun IMU Breakout - MPU-9250 $14.95

6-DOF IMU - ITG3200/ADXL345

6-DOF IMU - - ITG3200/ADXL345

Accelerometer - MMA8452Q $10.49 Accelerometer - ADXL335 $14.95

Accelerometer Breakout - LIS331 VR IMU (Qwiic) - BNO080 High Precision

SPX-14618 Qwiic IMU - MPU-9250 SPX-14896 - $148.00

Accelerometer, Gyro and IMU Buying Guide

Gyroscope Tutorial - SparkFun

Gyro Tutorial - AdaFruit

SparkFun Accelerometer and Gyro - MPU-6050 $29.95

SparkFun IMU Breakout - MPU-9250

MPU-9250 Hookup Guide - SparkFun

The OP's AdaFruit 9DOF Consideration

The OP mentioned FXOS8700 which is not popular than MPU9250. I usually thing that more people googling means more popular. I know 6-DOF MPU6050 is more popular, but the vendor says MPU6050 is discontinued, and replaced by MPU9250.

FXOS8700 16,200 search results

MPU9250 409,000 search results

MPU6050 2,210,000 search results

After read SparkFun's buying guide, MPU9250 is my final choice.

Now I am starting to read the SparkFun tutorials, then the datasheet.


The OP's preferred language - C#

It is very likely that I will use Rpi Python 3.5.3 to test out MPU6250. I remember the OP is familiar with C#, but flexible to change language.

I am thinking of skimming through C#'s features and see if I can use its features in my python program.

As usual I wikied.

C#- Wikipedia

C# is a general-purpose, multi-paradigm programming language encompassing

strong typing,

lexically scoped,





object-oriented, and


programming disciplines.

It was developed around 2000 by Microsoft (.NET) and later approved as a standard by Ecma and ISO.

I once thought of trying C# in Rpi, using things like Mono, WinIoT etc. Just now I googled and found too many cons than pros. I also read the following article and very much agree with all the thing the author said. My quick and dirty conclusion is that for a lazy hobbyist like me, python is the only choice.

Python vs C#: Comparison of the Programming Languages - Jakub Protasiewicz 2018jul19

Guido van Rossum talked about useful type-annotation features in TypeScript, which have inspired similar features in Python

Arduino 9-DOF sensor for Arduino also good for Rpi

The OP asks if AdaFruit's sensor ofr Rpi is also good for Rpi. My answer is YES. But the trouble is that AdaFruit almost always provide library, tutorial, and demo code for Arduino, but nothing for Rpi. What is worse is that Ada is switching from Arduino to CircuitPython which is not 100% compatible with Rpi.

So I would suggest the OP to consider SparkFun. SparkFun does not has any good support for Rpi either. So SparkFun in the OP's case is the lesser evil, because SparkFun's 9-DOF sensor seems better than AdaFruit.

So I am leaving AdaFruit altogether and start exploring SparkFun.

SparkFun MPU9250 Tutorials Also for Arduino Only, Nothing for Rpi

I skimmed SparkFun's MPU9250 tutorials and software library and found them all for Arduino, so unhelpful for Rpi newbies. So I am leaving SparkFun as well. My plan is to first study the following references, then goggle for more help.

MPU-9250 Datasheet - Rev 1.0 2014 InvenSense

MPU-9250 Datasheet - Rev 1.1 2016 InvenSense 2016

MPU-9250 Register Map - Rev 1.4 2013 InvenSense

MPU-9250 Register Map - Rev 1.6 2015 InvenSense

MPU-9250 Breakout Schematic - Rev 10 2016 SparkFun

MPU9250 Datasheet Reading Notes

Now I am reading the datasheet, and making summaries. I usually read the block diagram to get a rough picture of the things inside the chip. (I found SparkFun's datasheet is 2 years out of date)

mpu9250 block diagram

I found SparkFun's MPU9250 Register Map is also 2 years out of date. So I have updated the above links.

Anyway, I googled and found a schematic.

MPU-9250 9-DOF IMU Module - Thaou Electronics

mpu9250 schematic

Update 2019may13hkt1133

Recommendation to MEMS newbies

It is true that MPU9250 will very soon replaced by new version, or DOF10 modules. But for newbies who have never played with gyros or acceleros, it is no hurry to start with DOF 9 with magnetos. I think DOF 6 MPU6050 (gyro and accelero) is OK to start. Or to start as easy as possible, I would recommend ADXL345, a very popular accelero, recommended by both SparkFuna and AdaFruit.

Update 2019jun21hkt1154

To OP @ccalboni: Actually there are too many things to consider when selecting a 9DOF sensor. The MPU6060, MPU9250 modules are not that newbie friendly, and more suitable for hackers.

In case you don't wish to spend too much time doing hardware DIY and troubleshooting, I would recommend the

Raspberry Pi Sense Hat,

which uses Bosch's BNO055 9 DOF sensor.

/ to continue, ...

  • Is this a bot or what? Never seen an answer so in-depth
    – ccalboni
    Commented Apr 18, 2019 at 12:30
  • 1
    Well, it is an answer. A blog is usually a dated diary, with personal opinions My answer is rather objective, with comprehensive research notes (that is why long and deep), and why I suggest this not that. When comparing two sensors eg, I list google search counts to convince which is more popular. And I am digging deep, because I am looking far. I am aware I am writing too long, otherwise I would tell you that the sensor MPU9050 I am recommending is already obsolete! :) invensense.com/wp-content/uploads/2018/10/…
    – tlfong01
    Commented Apr 19, 2019 at 7:16
  • 1
    @ccalboni, Actually there are too many things to consider when selecting a 9DOF sensor. The MPU6060, MPU9250 modules are not that newbie friendly, and more suitable for hackers. In case you don't wish to spend too much time doing hardware DIY and troubleshooting, I would recommend the Rpi Foundation's SENSE HAT, which uses Bosch's 9 DOF sensor.
    – tlfong01
    Commented Jun 21, 2019 at 3:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.