I2C on ESP32-C6-LCD-1.47

Hello,

Trying to figure out how to connect an I2C device to ESP32-C6-LCD-1.47
Pinout charts I see online does not have sda/scl showing on the devboard pinout. (updated diagram below)

I'm trying to connect an AS5600 (angle encoder) - but all libraries I can find use the default SDA/SCL, seems to be GPIO 21/22 for ESP32-C6 in general - but which are those on the dev board?

anyone been successful with connecting AS5600 with this board specifically. through i2c?

Thanks!

I don't know if this is exactly the same board, but I found this picture:

Hope this helps

Thank you
the board looks like this
There are multipurpose pins that can be used as I2C but those libraries that I could find seem to look for the default one which I don't know if attached to the board IO

this is the board https://www.waveshare.com/wiki/ESP32-C6-LCD-1.47

AFAIK default I2C pins for ESP32 are the ones you said, GPIO 22 (SCL) and GPIO 21 (SDA) but that version seems to miss them.
But I think you can configure I2C to use any other pins, for example, ever tried to configure the pins you need on GPIO 4 and 5, using the "begin()"?
I mean something like this:

#include <Wire.h>

#define SDA_PIN 4
#define SCL_PIN 5

void setup() {
  Wire.begin(SDA_PIN, SCL_PIN);
  // ...
}

void loop() {
  // ...
}

Yes I tried that, with the same pins actually, the libraries still don't recognize the part, so I'm not sure if it's some difference between the library and this change in config, or even a hw problem with the AS5600.
It is currently connected to 5vdc and sdc/sck directly to pins 5 and 4
I tried using the adafruit and another library, but both say the device is not connected.
There is also adafruit testbed i2c scanning program, that also doesn't recognize the AS5600, but examples show it's connected to the default esp32pins, so hard to tell where the problem is

can you give a link to the specific AS5600 module ?
how did you connect it to the ESP32C6 module? e.g. which pins?
upload the I2C scanner code you used?

check the supply voltage of your module - many of these modules are 3.3V

My sample code was for SDA and SCL pins (equivalent to your "sdc/sck") to pins 4 and 5 respectively: are you sure you haven't swapped the pins? And check the I2C address of the encoder.

Show us the connections you made (and/or a clear diagram), and the latest code you're running at.

tested a AS5600 sensor with a ESP32C6_Dev_Board using SDA GPIO23 and SCL GPIO20 setting I2C pins with Wire.begin(23, 20);

// ESP32C6_Dev_Board AS5600 Magnetic Encoder Magnetic Induction Angle Measurement Sensor

// File>Examples>AS5600>AS5600_demo_ESP32
//
//    FILE: AS5600_demo.ino
//  AUTHOR: Rob Tillaart
// PURPOSE: demo
//     URL: https://github.com/RobTillaart/AS5600
//
//  Examples may use AS5600 or AS5600L devices.
//  Check if your sensor matches the one used in the example.
//  Optionally adjust the code.


#include "AS5600.h"


//  Uncomment the line according to your sensor type
//AS5600L as5600;  //  use default Wire
AS5600 as5600;  //  use default Wire


void setup() {
  // while(!Serial);
  Serial.begin(115200);
  delay(2000);
  Serial.println(__FILE__);
  Serial.print("AS5600_LIB_VERSION: ");
  Serial.println(AS5600_LIB_VERSION);
  Serial.println();
  delay(2000);
  Wire.begin(23, 20);  // SDA and SCL

  as5600.begin(4);                         //  set direction pin.
  as5600.setDirection(AS5600_CLOCK_WISE);  //  default, just be explicit.
  int b = as5600.isConnected();
  Serial.print("Connect: ");
  Serial.println(b);
  delay(1000);
}


void loop() {
  //  Serial.print(millis());
  //  Serial.print("\t");
  Serial.print(as5600.readAngle());
  Serial.print("\t");
  Serial.println(as5600.rawAngle());
  //  Serial.println(as5600.rawAngle() * AS5600_RAW_TO_DEGREES);

  delay(1000);
}


//  -- END OF FILE --

test serial output

AS5600_demo_ESP32C6\AS5600_demo_ESP32C6.ino
AS5600_LIB_VERSION: 0.6.5

Connect: 1
4095	0
4095	0
4095	0
3861	3976
0	3968
4095	0
3070	3070
1967	2048
3407	3400
1063	1555
65	0
3490	3492
3387	3389
33	111
96	484
1951	1956
786	786
2523	2999
3492	3291
2563	2570
3239	3235
2028	1791
3185	3186
584	6
52	4023

the pinout in post 3 shows that SDA GPIO23 and SCL GPIO20 are available

Thank you! I will try it, that's also the same as5600 board I'm using so looks like a very similar setup.

Do you have the As5600 vcc connected to 5v?

And the i2c pins looks like connected directly to the esp32 board

no - it is to 3.3V

AS5600 SDA and SCL connected directly to ESP32C6 GPIO23 and GPIO20

Thank you very much, I'll update

@horace that was very helpful and worked for me, thank you!

if the problem is solved click the Solution button at the bottom of the reply that answered the question - this helps others with a similar question