Where is Adafruit trying to go with this approach, you ask? The real goal is just to make things easier for customers, but also easier for use to support. It takes a lot of time and energy to constantly create example code, drivers, etc., and something like the Adafruit unified sensor driver seems like a win-win solution for everyone.
  • Customers get much better data since they're working with pre-defined, standard SI units of measure and have a good idea of how get data out of a sensor, as well as a backup plan if one sensor type isn't avaialable.
  • Adafruit benefits since it's so easy to reuse sample code from one accelerometer once you've created the first driver for the sensor type.
And hey ... it's just a nice, elegant solution to a complex problem in my opinion!

The current unified sensor system is far from perfect -- I'm not a big fan of floats, and is bigger than a barebones fixed-point sensor driver -- but I really think this is a huge step forward, and the right approach in the long term. I wish I had done this years ago, to be honest, and hope other people find it useful as well!

In any case ... if you have any thoughts or suggestions, either post them up in the forums, or suggest some concrete code changes on github in the Adafruit_Sensor repository!

Related Links

Existing Drivers

The easiest way to see how this all works, though, is to simply look at some of the existing drivers that support the unified sensor sytem. Some good examples can be found below:

Accelerometers

Light

Magnetometers

Barometric Pressure

This guide was first published on Feb 28, 2013. It was last updated on Feb 28, 2013.

This page (Where To From Here?) was last updated on Feb 28, 2013.

Text editor powered by tinymce.