Problem connecting a gyroscope/accelerometer sensor with an Arduino MKR WiFi 1010

Hello everyone,

I'm having trouble getting a gyroscope/accelerometer (the LSM6DS3, I think) to work with an Arduino MKR WiFi 1010. To connect it, I stripped the wires and connected them directly to SDA, SCL, GND, and VCC. I've checked the connections between the sensor and the Arduino, but I can't get any data from the sensor. The serial monitor only returns zero values or nothing at all. I've tried several libraries (Arduino_LSM6DS3, Adafruit_LSM6DS3) and various code examples, but nothing works. The sensor doesn't seem to be detected by the Arduino. Has anyone encountered a similar problem with this sensor and could share their experience? Do you have any solutions?


Bonjour à tous,

Je rencontre des difficultés pour faire fonctionner un gyroscope/accéléromètre le LSM6DS3 il me semble avec une Arduino MKR WiFi 1010. Afin de le connecté j'ai dénudé les fils et les ai branchés directement à SDA, SCL, GND et VCC. J'ai bien vérifié les connexions entre le capteur et l'Arduino, mais je ne parviens pas à obtenir de données du capteur. Le moniteur série ne renvoie que des valeurs nulles ou rien du tout. J'ai testé plusieurs bibliothèques (Arduino_LSM6DS3, Adafruit_LSM6DS3) et différents exemples de code, mais rien ne fonctionne. Le capteur ne semble pas être détecté par l'Arduino. Est-ce que quelqu'un aurait rencontré un problème similaire avec ce capteur et pourrait partager son expérience ? Avez vous des solutions ?

SDA and SCL need pull up resistors to function reliable. Could be the cause

perfect explained by Nick Gammon

- Gammon Forum : Electronics : Microprocessors : I2C - Two-Wire Peripheral Interface - for Arduino

Is there a manipulation I could do to make it work?

add a resistor of 2k2 Ohm between the SDA pin and the +5V / 3.3V

add a resistor of 2k2 Ohm between the SCL pin and the +5V / 3.3V

You must solder the connections (bare wire won't make reliable connections), or better, solder header pins to each module and connect them using DuPont connector jumpers. Adafruit has great tutorials on soldering, including header pins.

Let's rule out hardware incompatibility first; which LSM6DS3 board (post a link).
There are several varieties, with/without voltage regulator and/or level shifter.
The MKR WiFi 1010 uses 3.3volt-logic.
Post a wiring diagram.
Leo..

I already tried but unfortunately it didn't work...

Currently, the gyroscope/accelerometer is directly connected to the board's inputs, as shown in the diagram below. Here is the link to the board used: https://docs.arduino.cc/hardware/mkr-wifi-1010/

The question was of course: Which LSM6DS3 board. There are many different ones.
There is only one MKR WiFi 1010.
Leo..

It's this one : Module 6 DOF Grove 105020012 - Gotronic

That board has a 3.3volt regulator and level converters.
It can be powered with 3.3volt or 5volt.
I would prefer 5volt, since that would give a cleaner VCC for the sensor chip, which is the voltage used on the I2C connector.
Question is if you use the QUIIC/Stemma I2C connector and Grove cables.
Leo..

I use the i2c connector on the gyroscope accelerometer and bare wires on the arduino board

Your pencil drawing (post#8) shows the sensor connected to Vin.
Vin is a power INPUT for the MKR 1010, not a power output.
There is no power coming from the Vin pin.

You should connect VCC of the module to the 5volt pin of the MKR.
Or use the proper QUIIC/Stemma cable.
Leo..

After connecting, I now get this error: "Error: LSM6DS3 not detected!"

Here's my code:

#include <Wire.h>
#include <Arduino_LSM6DS3.h> // Include your modified version of the library

//LSM6DS3Class IMU(Wire, LSM6DS3_ADDR); // Use the custom address

void setup() {
Serial.begin(115200);
while (!Serial);

if (!IMU.begin()) {
Serial.println("Error: LSM6DS3 not detected!");
while (1);
}

Serial.println("LSM6DS3 detected.");
}

void loop() {
float ax, ay, az;
float gx, gy, gz;

if (IMU.accelerationAvailable()) { 
IMU.readAcceleration(ax, ay, az); 
} 

if (IMU.gyroscopeAvailable()) { 
IMU.readGyroscope(gx, gy, gz); 
} 

Serial.print("Accel (m/s²): X="); 
Serial.print(ax); 
Serial.print("Y="); 
Serial.print(ay); 
Serial.print(" Z="); 
Serial.print(az); 

Serial.print(" | Gyro (dps): X="); 
Serial.print(gx); 
Serial.print("Y="); 
Serial.print(gy); 
Serial.print(" Z="); 
Serial.println(gz); 

delay(200);
}

I scanned to see if the sensor was detected, and got this result: I2C scan in progress...
22:46:15.008 -> I2C found at address 0x60
22:46:15.008 -> I2C found at address 0x6A
22:46:15.008 -> I2C found at address 0x6B
22:46:15.008 -> Scan completed.

I'm not sure what to do...