Skip to content

strongloop-community/LSM9DS0

 
 

Repository files navigation

Hacking on Sparkfun 9dof block for Edison (LSM9DS0)

This fork of the original LSM9DS0 code -- thanks to the original author at https://github.com/jku/LSM9DS0 -- adds a few things.

  1. The output can now be directed to the onboard mosquitto MQTT server* (with --output mqtt)

  2. An instance of MongoDB ** (with --output mongo)

  3. Adjust the frequency of readings with --sleepTime

There are hooks for couchbase, but I haven't completed those yet, named pipes (they work, but currently buffer, and I haven't fixed that yet), and json to stdout

Some initial code to get data out of the Sparkfun 9 Degrees of Freedom Block for Intel Edison. The block contains a LSM9DS0 9DOF IMU with a 3-axis accelerometer, a 3-axis gyroscope, and a 3-axis magnetometer.

The code is currently just hacks, might grow into a library. Lots of inspiration has been taken from the LSM9DS0_Breakout project. All the magic byte values are from the LSM9DS0 datasheet.

Feel free to use this code in any way you want: let's say "New BSD license".

Programs

test: prints out either sensor values or flight dynamic parameters (yaw, roll & pitch). Can also dump all configuration register contents. test will use bias files generated by the calibration utilities, if they exist.

calibrate-acc-gyro: produces calibration data for accelerometer and gyroscope. Device should stand motionless on level and stable surface during the calibration.

calibrate-mag: produces calibration data for magnetometer. Device should be turned to every direction during the calibration.

Dependencies

A note about the dependencies: Right now, there are no flags for the Makefile to include one, or a few, of these libraries, so in order to build the project, you must install them all. I'll fix that.

MongoDB (--output mongo) In order to use --output mongo you will need to install and build the 32-bit MongoDB instance at https://fastdl.mongodb.org/linux/mongodb-linux-i686-3.2.0.tgz This is a 'legacy' version of MongoDB and won't be updated.

You will also need to build and install the MongoDB C Library from https://github.com/mongodb/mongo-c-driver

Both of these build and run without modification on Linux edison 3.10.17-poky-edison+ which is what I built this on.

MQTT (--output mqtt) In order to use --output mqtt you will need to build and install the Paho MQTT libraries from https://eclipse.org/paho/clients/c/ Again this builds and installs without issues.

Couchbase (--output couch) Build and install the Couchbase C Library from https://github.com/couchbase/libcouchbase.git This is not as straighforward as you might think. There are a couple of modifications required:

cd libcouchbase
sed -i '/RealBin/s/^/#/' configure.pl
sed -i '/RealBin/s/^/#/' cmake/configure
sed -i "166i my \$srcdir =\"/home/root/libcouchbase/\";" configure.pl
sed -i "166i my \$srcdir =\"/home/root/libcouchbase/\";" cmake/configure

Will fix it up for you so that you can then

mkdir build
cd build 
../cmake/configure --disable-plugins
make
make install

About

Hacking on Sparkfun 9dof block for Edison (LSM9DS0)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 97.9%
  • Makefile 2.1%