I2c output format

Hi all.

I’m trying to decode the I2c output of the jupyter notebook for the jetbot.

I’ve connected an arduino to the I2c and am reading the output string using the wire.h library.

The output I get is around 60 characters long for just setting the left motor to %30.
It looks nothing like what I expected eg. pwm.setPWM(15, 1024, 3072).

I’ve tried BIN, HEX etc.

The other thing I noticed was that the string of numbers (in hex) didn’t change when the motor was set to a different speed?

Can anyone shed some light on this?

Thanks

hello mpsilcock,

could you please share the hardware connections you had.
thanks

Hi @JerryChang

I’ve connected the SDA SCL from the Nano (3,5) to the Arduino SDA and SCL and a GND from one to the other also.

I change the output to one of the motors to get a data string from the i2c.

In jupyter Lab:

Interestingly depending on where I paste the output it changes.
This is the same as whats in the serial monitor output:

As an interger:
001441.0/000116*0+16,0-00014410e0000014410e0016016 0!000 0!0"0#0$144%1

and

In Hexadecimal:
00901.0/000110*0+10,0-0009010e000009010e0010010 0!000 0!0"0#0$90%1

and:

In Binary it outputs :

00100100001001001000010e0000010010000100 0!0"0#0$10010000%1

And in a text editor :

Arduino Slave sketch:
``void setup() {
Wire.begin(0x27); // join i2c bus with address, also changed in Jupyterlab
Wire.onReceive(receiveEvent); // register event
Serial.begin(9600); // start serial for output
}

void loop() {
delay(100);
}

// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany) {
while (1 < Wire.available()) { // loop through all but the last
char c = Wire.read(); // receive byte as a character
Serial.print(c); // print the character
}
int x = Wire.read(); // receive byte as an integer
Serial.print(x,BIN); // print
}

hello mpsilcock,

I2C, it’s 8-bit, bi-directional data transfers. it also includes the acknowledge bits.
please refer to I2C specification for more details. thanks

@JerryChang I’ve taken a look at the I2c protocol and can’t figure out which register the nano writes to or how to mute the other information sent.

Can you suggest something?

hello mpsilcock,

you should refer to Technical Reference Manual, see [CHAPTER 35: I2C CONTROLLER] for descriptions and offsets of all registers.
instead of using configured serial rate, why don’t you simply check the register values.
please eliminating character encoding related issue, you should just check the values in hex.
thanks

Wow, there’s a manual! Thanks… actually @JerryChang , no there’s not for the Nano

I’ve found something that may be similar NVIDIA Tegra X1 Mobile Processor TECHNICAL REFERENCE MANUAL.

2977 pages!! The I2C section, chapter 35 is written far to technically for me to understand.

I’m a little disappointed