Giter Site home page Giter Site logo

adafruit_lsm9ds1's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_lsm9ds1's Issues

Unable to initialize the LSM9DS1 with nrf52

In this particular case, I am using nano 33 BLE, so wiring is not a problem for sure.
It is stuck with the message Oops ... unable to initialize the LSM9DS1. Check your wiring!

no return statement in function returning non-void

virtual bool getEvent(sensors_event_t* event) {

This results in the following warning when "More" warnings mode is on:

In file included from /home/ryan/Arduino/libraries/Adafruit_LSM9DS1_Library/Adafruit_LSM9DS1.cpp:15:0:
/home/ryan/Arduino/libraries/Adafruit_LSM9DS1_Library/Adafruit_LSM9DS1.h: In member function 'virtual bool Adafruit_LSM9DS1::Sensor::getEvent(sensors_event_t*)':
/home/ryan/Arduino/libraries/Adafruit_LSM9DS1_Library/Adafruit_LSM9DS1.h:230:7: warning: no return statement in function returning non-void [-Wreturn-type]
       }
       ^

Adafruit_LSM9DS1 doesn't pass it's Wire Instance to Magnetometer

  • Arduino board: Arduino Nano 33 BLE Sense
  • IDE: Plattform IO

While trying to use the internal LSM9DS1 of the Arduino Nano 33 BLE Sense, i noticed that it didn't found the sensor.
The Arduino Nano 33 BLE Sense has it's internal LSM9DS1 attached to the Wire1 instance.
After passing the correct Wire instance to the Adafruit_LSM9DS1 Constructor, the library still didn't found the LSM.

After looking in the source code, i noticed that in Adafruit_LSM9DS1.cpp, Line 133, that the wire instance is not passed to the magnetometer beginn function.

I changed the line 133 in Adafruit_LSM9DS1.cpp, from
if (!_magSensor.begin_I2C(LSM9DS1_ADDRESS_MAG)) {
to
if (!_magSensor.begin_I2C(LSM9DS1_ADDRESS_MAG, _wire)) {

After this change, the library found the internal LSM of the Arduino Nano 33 BLE Sense.

To reproduce the bug it should suffice to attach a LSM9DS1 to an I2C Connection, that doesn't map to the normal Wire instance.

I hope it helps.

No need to wait after Wire.requestFrom() and it should not be followed by a Wire.endTransmission()

In Adafruit_LSM9DS1.cpp in the function readBuffer() in I2C mode, there is a while-loop after the Wire.requestFrom(). However, there is no such thing to wait for data. The Wire.requestFrom() returns when the I2C transaction has completely finished and the received data is in a buffer in the Wire library. In case of a bus collision in a multi-master bus or a bad hardware I2C bus, the Wire.available() could return zero bytes, and that while-loop halts the sketch. Therefor, that while-loop has no function at all and in a (very rare) situation it can do harm.

The Wire.requestFrom() should not be followed by Wire.endTransmission(). The Wire.endTransmission() is only used when sending data. When it is used after Wire.requestFrom() in the Wire library for AVR chips, an extra I2C bus transaction takes place: the address is sent onto the bus and the sensor replies with acknowledge. This has no further consequences with the Wire library for AVR chips, but it is not needed, and it is wrong use of the Wire library, and it slows the code down with an extra I2C transaction. When used with other Arduino boards or software implementations of the Wire library, the result could be different.

As you may have noticed, I have written a lot of similar issues. I started to do this because I had to explain in Arduino forums too many times that the Wire library was used wrong. Since Adafruit is ahead of others, your code is often used as an example how to write code for Arduino. With this very long issue, I really hope you stop using the Wire library in the wrong way.

Typo in header file Adafruit_LSM9DS1.h

  • Arduino board: Not Applicable

  • Arduino IDE version (found in Arduino -> About Arduino menu): Not Applicable

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): Not Applicable

This is a library for the LSM9DS1 Accelerometer and magnentometer/compass

should be corrected to magnetometer/compass

Specify and include license

https://github.com/adafruit/Adafruit_LSM9DS1/blob/master/Adafruit_LSM9DS1.cpp#L13 states the following: "BSD license, all text above must be included in any redistribution".

However, this license is not included in any of your files, nor is the license header there. On top of that, there are 3 different BSD licenses according to the OSI: https://opensource.org/licenses/alphabetical.

I assume you meant to use the 3-Clause BSD license on https://opensource.org/licenses/BSD-3-Clause. Could you specify this as per https://wiki.opensource.org/bin/Main/Projects/OSI+Website+Page+Improvements/How+to+apply+an+open+source+license+to+your+project/?

Bitmask error in Adafruit_LSM9DS1::setupGyro()

I'm trying to create a Python implementation for LSM9DS1, so i don't have patches to submit (and in the interests of fairness and transparency, I don't have any validated code yet myself, which is why I'm reviewing yours).

But I noticed an error in setupGyro(). Specifically, line 304 of Adafruit_LSM9DS1.cpp https://github.com/adafruit/Adafruit_LSM9DS1/blob/master/Adafruit_LSM9DS1.cpp#L304, bitwise-ANDs the current value of CTRL_REG1_G, with the bit pattern 00110000, in preparation for bitwse-OR with a new shifted 2-bit scale value. I believe this pattern is wrong. It should be 00011000.

According to the DocID025715 Rev 3 (March 2015) of STMicroelectronics' datasheet at http://www.st.com/content/ccc/resource/technical/document/datasheet/1e/3f/2a/d6/25/eb/48/46/DM00103319.pdf/files/DM00103319.pdf/jcr:content/translations/en.DM00103319.pdf, the CTRL_REG1_G register is defined such that the first three bits control the Output Data Rate, the next two bits control the Full Scale selection, the next bit is always 0, and the last two bits control the Bandwidth selection. (See Section 7.12 pg 45 of 72) This copy of table 44 illustrates the register:

ODR_G2 | ODR_G1 | ODR_G0 | FS_G1 | FS_G0 | 0 | BW_G1 | BW_G0

The new scale value needs to be inserted into bit positions FS_G1 and FS_G0, so the 1's in the bitmask need to be adjusted.

Accordingly, in Adafruit_LSM9DS1.h line 171, the scaling values in enumeration lsm9ds1GyroScale_t https://github.com/adafruit/Adafruit_LSM9DS1/blob/master/Adafruit_LSM9DS1.h#L171 should be left-shifted 3 positions, not 4, to line up as well, so the bitwise-OR successfully sets the new scale into the FS_G1 and FS_G0 positions.

Thank you!

How to get Roll Raw and Pitch from that ?

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: INSERT ARDUINO BOARD NAME/TYPE HERE

  • Arduino IDE version (found in Arduino -> About Arduino menu): INSERT ARDUINO
    VERSION HERE

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

Temperature doesn't seem to report correctly..?

Hi,

I am in the process of testing several IMUs [MPU9250*, Ada FXOS/FXAS breakout, Ada LSM9DS1 breakout, a BNO55 and a BNO80.

(* I believe the 9250 is EOL so, only testing because I have on hand but likely won't make it into the product)

I've got it running with the MPU9250 and the LSM9DS1 right now. The LSM9DS1 is reporting a weird temperature value. The value does increase if I warm the chip up with my finger, but it's not deg C. It was originally sitting at 21, now it's at 53 after going up to 149 after a few seconds with my finger on it, 117, 85.. it's jumping by 32 every time..?

Dividing by 32 maybe gives the delta temperature in C, but I'm not 100% sure if that's the case or that's just garbage.. After holding both chips for the same amount of time, the delta on the MPU was about 4.2 degrees, 181/32 is 5.65 degrees, it started at 53 = 3.99 deg C?

PS: Unified library is great, wish it supported more! Also wish I could use libraries like this on my radio modules but the python they have is so stripped down (snappy)

Working with PJRC MotionCal?

I'm trying to use this library to implement a Mahony filter; I'd like to use MotionCal to determine calibration constants for the magnetometer.

I added methods to expose the raw int16 values from the sensors - however, I get garbage data (or at least it renders nothing close to a sphere) when running MotionCal.

Has anyone else had luck with this? I found one other thread about it on the PJRC forums, but it had no responses and it looked like that person was trying to send floats instead of ints anyways.
thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.