I2C data reading using arduino

Hello, I wanted to see the data coming from the SDI1608 led driver and SDI5209t microcontroller, made by solidic from China, on the serial port through the arduino uno. When connecting the device, I connected the SDA SCL pins of the microcontroller to the SDA and SCL pins of the arduino, but I can't get the data.

#include <Wire.h>

void setup() {
Wire.begin(); // Initialize I2C communication
Serial.begin(9600); // Initialize serial communication for output
}

void loop() {
Wire.beginTransmission(0x07); // Specify device address
Wire.requestFrom(0x07, 5); // Request data

while (Wire.available()) { // Read data
byte data = Wire.read();
Serial.print(data); // Print the received data
Serial.println(" Data");
}

Wire.endTransmission(); // End I2C communication

delay(10); // Wait for a second before reading again
}

I'm going to get data from AOTE's weight scale on arduino serial port but I can't it anyone know it ?


Hi, @zafardinov_m
Welcome to the forum.

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

Link will show you how to post your code in a scrolling window.

Have you got both of the controllers gnds connected?
Have you got pullup resistors installed on each SDA and SDL wire?

Thanks... Tom... :grinning: :+1: :coffee: :australia:

1 Like

Is your peripheral detected if you run the I2C scanner example sketch?

What is this MCU? Please, give a link to its data sheets.

hi

yeah I was scanned but I found few devices adrress

@zafardinov_m , please read the sticky topics in Uncategorized - Arduino Forum.

Topic moved.

The Serial/UART bus is not the same as a I2C bus.

The Wire.beginTransmission() does not put a START condition on the I2C bus, the Wire.requestfFrom() should not be used together with Wire.beginTransmission() or Wire.endTransmission() and the Wire.endTransmission() does not stop or end something.

What do you want to read ?
Is that a Serial/UART output ? Then a Arduino board can capture it.
Is that a I2C bus that communicates with I2C devices ? Then you need a Logic Analyzer. I highly prefer a USB Logic Analyzer, so the data can be analyzed on the computer.

Can provide a link to English Version?

I have a google translate version this file
SDI5209-SOLIDIC (3).pdf (459.2 KB)

From what you have indicated, it sounds like you are tapping into an active I2C bus that already has a master and several slave devices on it.

Introducing your Arduino as a second master device would likely upset the comms within the product.

Another approach may be to listen in to the I2C bus and detect the packets you are interested in. You can use a software I2C sniffer on an UNO as long as the bus runs at 100KHz or less. From my experimenting some time back I managed to log an I2C bus using software up to around 120KHz.

I would also check to see if there is there a serial port on the microcontroller board that you could look at. There's a good chance that the information may be there but just not available on a serial port on the back of the product.

You will have to change the code in the unit so it will talk to your Arduino. If you cannot do that the next best thing is a sniffer as recommended earlier by markd833. You can also use one of the inexpensive logic analyzers and get an idea of what the format of the code is.

Even if you know the data that is transferred over the I2C bus, then a Arduino Uno can not read that reliable. The sniffers work only a little: I2C Sniffers · Testato/SoftwareWire Wiki · GitHub

The I2C bus is not like the Serial/UART bus. The Arduino Uno can not just read the data, it is not that kind of bus.

That chip contains a Microcontroller which you need to program first to establish communication with host UNO over I2C bus. If you have written any program, please post it.

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