Can a Grove LSM6DS3 be set up to use SPI?

I'm trying to measure acceleration at multiple points simultaneously, and as best as I can tell, I2C is not capable of doing that without resorting to multiplexers or differing models of accelerometer, which I'd prefer to avoid for the sake of simplicity. I've been reading up on SPI to try to determine how to set up arduino to use that protocol instead, but I'm kind of worried that I'm going down a dead end.

I purchased several Grove 6 axis accelerometer's and a Base Shield in the hope that it would save me from needing to breadboard, but while the documentation for the LSM6DS3 does suggest there's a SPI mode for the chip, looking at the set up of the Grove board kind of suggests that it won't work; the accelerometer only has a connection for four wires, two of which are power and ground, which presumably means it can't support either 3 or 4 wire SPI, and none of the non-I2C ports on the Shield actually connect to the 10/11/12/13 pins, which seems to be the standard set up for SPI communications.

I know it's a bit of a long shot, but is there any way around this? I can purchase new accelerometers or multiplexers if necessary, but if there's a way to make this work with the current accelerometers, that would be preferable.

Huh? Explain?

How do you think SPI will help you with that?

How far apart, and how many "multiple points" do you have?

My understanding - and feel free to correct me if I'm wrong - is that you can't use multiple I2C sensors with the same address at the same time. Apparently sensors have jumpers that change that address, but the LSM6DS3 I'm using does not, which means that apparently the only way to get multiple copies of the same accelerometer to play nice with each other is to use a multiplexer to change the address, or to use SPI instead. If there's another more graceful way around that, I'd love to hear it.

As for number of sensors, I'm currently looking at measuring at 4 to 6 points that are 10 to 20 inches apart.

"The SDO/SA0
pin can be used to modify the less significant bit of the device address. If the SDO/SA0 pin
is connected to the supply voltage, LSb is ‘1’ (address 1101011b); else if the SDO/SA0 pin is
connected to ground, the LSb value is ‘0’ (address 1101010b). This solution permits to
connect and address two different inertial modules to the same I 2C bus."
-data sheet

Some processors have two I2C ports. So that would get you four sensors.

Huh. That would be considerably easier than what I was trying to do, though I'm not sure if an Arduino Uno has two places you can connect an I2C. I thought it was just D19/SCL and D18/SDA?

Correct, UNO has one. There is such a thing as software I2C on I/O pins...

1 Like

I did not know Software I2C was an option. Looking it up, it looks like SoftI2CMaster, SoftWire and Software_I2C all might do what I need. Going to need to experiment a bit to see if I can make them work.

Thank you very much for your help.

1 Like

I'm working on a similar problem but the spacing is larger. Gave up on searching for an easy solution and decided on a mux and a pair of bus extenders to carry I2C from the processor to the mux. My cable from the mux to each sensor is less than 10 inches.

The sensor has an address select solder bridge.
If you can solder a wire to the relevant field, then you can change the I2C address on_the_fly.
Set one sensor to the address you want to talk to, and the remaining sensors to the other.
That requires one chip select pin from the Arduino per sensor.
One problem though. The chip uses 3.3volt logic.
So you must also must use a 1k:2k voltage divider per module to drop logic from 5volt to 3.3volt.
Leo..

Not possible with only one processor, unless your definition of "simultaneous" is pretty loose.

You can use a single I2C bus to sequentially address as many examples of the sensor as is practical, but you have to dedicate an I/O pin to control the SDO/SA0 pin state of each sensor. Set SA0 low for the sensor to be addressed, and SA0 high for all the others, or vice versa.

That way you can make sure that one one sensor has the correct I2C address at any one time.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.