Multiplexing

Hello,

I want to use three identical adxl345 accelerometers on the same i2c bus.
How is the procedure to give each device its own unique address to separate them?

If this example is incorrect please let me know:

If I connect SDO of the first adxl345 to GND I will get address (0×52) and the SDO of the second adxl345 to the vcc I will get address (0×53). How is it possible to make an address to the third adxl345?

You won't be able to have more addresses than what the manufacturer gives you pins to configure, in this case you can only have 2/bus.

What you need to do is get an i2c gateway/bridge to change addresses OR use SPI for your 3rd accelerometer

You can use an analogue switch to switch devices of the same address on the same bus. Something like this:-

Careful using relays as the bounce might be interpreted as commands, they're really noisy:


Yes, it's unlikely to be taken as a command but if it was I couldn't imagine trying to debug it :slight_smile:

UPDATE: @Mike
I thought your schematic was showing a relay to switch between data lines :-/ , you can certainly multiplex otherwise

Careful using relays

No one suggested relays :-?

Anyway as you would only switch the data and not the clock any bounce would not be clocked into the device.

In fact if you put the pull up resistor on the device side no amount of bounce between being pulled high from the driver and being open circuit and thus pulled high by the other side, would have any effect at all.

So a relay is not going to give you any trouble, but why use one when a solid state multiplexer is cheaper.

You can use an analogue switch to switch devices of the same address on the same bus.

Do you recommend any device I can use? Can I use the 4051, 8x1 multiplexer?