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?
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
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:
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 --