Using the onboard LSM6DS3TR

Has anyone had success using the example code provided with the library linked on SeedStudio’s wiki page? I tried the code and it was not able to communicate with the LSM6DS3TR IMU, if needed I can port code that I have written for similar IMU’s I just thought I would check with the community of users to see if anyone has had luck.

Maybe my board is having problems, when I ordered the limit was 1 so I could not order any extra boards, if I had an extra board I would swap the boards to see if the problem is hard or software.

Thanks
wade

Hello, may I ask which product’s wiki code does not work, can you tell me the link?

in the wiki page at 6-Axis IMU Usage on XIAO BLE Sense - Seeed Wiki there are instructions to download the libraries at GitHub - arduino-libraries/Arduino_LSM6DS3: LSM6DS3 Library for Arduino all this is pretty standard done it many times. So I open SimpleAccelerometer.ino in the Arduino IDE and try to compile it and the first problem is:
Error downloading package_heltec_esp8266_index.json Itried to include the link but your systems limites me to two links.
Then apparently the constructor was not implemented or was in error because the next errors were undefined reference to `IMU’

I could write a package for the IMU have done it in the past but I was hoping to be able to use your library for operating the IMU at least in the most basic level.
I used you PDM library to sample sound with the onboard microphone and that worked as it should so I am happy about that. Please respond to me here if you get this fixed, I would like to use a bunch of these boards if we can get the IMU working.

I am programming the board on my Win 10 laptop which is standard and I have used Arduinos for about 10 years.

Thanks
wade

[/Begin Disclaimer]
I recently received an XIAO BLE Sense board but have not tried to access the LSM6DS3 device.
[/End Disclaimer]

First, I note that the text on that wiki page says this:
Step 1. Download Seeed_Arduino_LSM6DS3 Library

But the link sends you to the Arduino_LSM6DS3 library, not the Seeed _Arduino_LSM6DS3 library.

This is, apparently, the original source from which a Seeed-specific library was derived.

A Seeed library can be found here:

Further narrative on the wiki page refers to examples that are found in the Seeed_Arduino_LSM6DS3 library, and not in the Arduino_LSM6DS3 distribution to which the wiki directs us.

I have a couple of “issues” with the XIAO BLE, and with other Seeed boards I have tested recently (XIAO RP2040, Wio RP2040).

First of all:
Many of the examples on various Seeed pages for these recent boards simply do not work. Also schematics don’t agree with what’s on the actual boards, and there are discrepancies in software (arduino_pins.h in the board-specific variants directories) that create additional problems.

Maybe “someone” (we have no way of knowing who) decided there were problems with the Seeed_Arduino_LSM6DS3 library and changed the link, without taking into account that NOTHING on the wiki page described how to use this library. Or, maybe something else.

Bottom line:

Good Luck.

Regards,

Dave

Footnote:
[/Begin Editorial Opinion]
My second “issue,” specific to the XIAO BLE software, is that the Seeed-developed version of that library uses the same class name and same library .h file name as the original, which makes it essentially impossible to use if both are installed in the Arduino library tree. I mean, maybe some of us have non-Seeed boards that use this device and need the other library to be installed. Do any of the Seeed developers have any real-world experience outside their little sandbox?

This is a VERY BAD thing. It would have been so simple to just use different names to avoid confusion by the users and to avoid system errors/warnings when the Arduino system tries to guess which one you intend to use when you include LSM6DS3.h in your sketch and instantiate an LSM6DS3 object. Very amateurish and near-sighted on the part of whoever did the actual transmogrification. And to whoever tested this mess. (They do test this stuff, right?)
[/End Editorial Opinion]

I decided to try it instead of just guessing.

So here’s the deal;

If you have previously installed Arduino_LSM6DS3 library uninstall it.

That is, if your Sketchbook\libraries folder has a directory tree

Arduino_LSM6DS3

or, maybe, one named

Arduino_LSM6DS3-master

Delete that directory and all its sub-directories. Note that it is NOT enough to simply rename that directory in place. You must delete it (Or move it to some place not under your Arduino sketchbook directory.)

Now, download Seeed_Arduino_LSM6DS3-master.zip from

Unzip it to your sketchbook\libraries directory.

If you are in the Arduino IDE, exit and invoke Arduino again.

Now, use the Examples entry on the File menu to find and open this project:
File->Examples->Seeed Arduino LSM6DS3->HighLevelExample

You can run it as is, but I like to put in a little “Welcome” message with the date and time it was compiled.

In other words, I change the setup() to this:

void setup() {
    Serial.begin(115200);
    while (!Serial);
    Serial.println("\nLSM6D3 'High Level Example' compiled on "__DATE__ " at " __TIME__);
    //Call .begin() to configure the IMUs
    if (myIMU.begin() != 0) {
        Serial.println("Device error");
    } else {
        Serial.println("Device OK!");
    }
}

Save the project somewhere convenient in your sketchbook tree and run it.

I get the following output on the Serial Monitor, with a new set of readings every second.

Bottom Line: Taa-Daa!

Regards,

Dave

1 Like

As @davekw7x said, you should download Seeed’s Arduino_LSM6DS3 library to use it.

Thanks for digging this out.