Go Down

Topic: AS5600 with Adafruit Multiplexer (Read 212 times) previous topic - next topic


 I am trying to get 5x  AS5600 encoders to work on an Adafruit TCA9548A Multiplexer that is attached to an Arduino Mega.   So far, I have been able to use the examples to read one sensor connected directly to the Mega.  Using the multiplexer, I can use the code on Adafruit's website to read the sensor type, but beyond that, I am having zero luck.

I think my issue is setting up the multiplexer code. *Standard disclaimer -  I am no coder, so I am trying to piece things together, which usually doesn't work.*     I can't seem to get a simple reading from the encoder through the multiplexer.  Is there a sample using the multiplexer just to read an AS5600 sensor?

If anyone wants to see what example sketch's I am working with I can post them.  My modified code is garbage, so I want to start from scratch.


Post code, circuit and datasheet links please...
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Ok, here are the datasheet links


AS5600 chip datasheet

I will post a pic of my wiring, soon. But it is almost identical to this pic on the Adafruit multiplexer page.

This is Adafruit's code to scan the multiplexer to see what is connected. This will show the AS5600's as address  0x36 if I connect them.

Code: [Select]
 * TCA9548 I2CScanner.pde -- I2C bus scanner for Arduino
 * Based on code c. 2009, Tod E. Kurt, http://todbot.com/blog/

#include "Wire.h"
extern "C" {
#include "utility/twi.h"  // from Wire library, so we can do bus scanning

#define TCAADDR 0x70

void tcaselect(uint8_t i) {
  if (i > 7) return;
  Wire.write(1 << i);

// standard Arduino setup()
void setup()
    while (!Serial);

    Serial.println("nTCAScanner ready!");
    for (uint8_t t=0; t<8; t++) {
      Serial.print("TCA Port #"); Serial.println(t);

      for (uint8_t addr = 0; addr<=127; addr++) {
        if (addr == TCAADDR) continue;
        uint8_t data;
        if (! twi_writeTo(addr, &data, 0, 1, 1)) {
           Serial.print("Found I2C 0x");  Serial.println(addr,HEX);

void loop()


Ok, I've been working on a sketch to read 2 AS5600 encoders through the TCA9548A Multiplexer.  I'm getting some errors with the sensor2.begin section.  If someone could let me know how to fix this I would greatly appreciate it.  This is a continuation of the OP.

Code: [Select]
#include <TI_TCA9548A.h>

#include <AS5600.h>

#include <Wire.h>

AS5600 sensor1;
AS5600 sensor2;
void TCA9548A(uint8_t bus)
  Wire.beginTransmission(0x70);  // TCA9548A address is 0x70
  Wire.write(1 << bus);          // send byte to select bus
void displayPosition(float position){
void setup() {
  // Start Wire library for I2C
  // Set multiplexer to channel 1 and initialize sensor with I2C addr 0x36
  sensor1.begin(AS5600, 0x36);
  // initialize sensor with I2C addr 0x36
  sensor2.begin(AS5600, 0x36);
void loop() {
  // Delay to allow sensor to stabilize
  // Read position
  float p = AS5600.position();

  // Set multiplexer to channel 1 and display temperature

Go Up