ESP32 easy I2C sniffer for OLED display

TomasCZ
Posts: 39
Joined: Tue Apr 25, 2023 5:19 am

ESP32 easy I2C sniffer for OLED display

Postby TomasCZ » Fri Apr 28, 2023 7:59 pm

Hi guys, I am new in ESP32 and Arduino and I am working on a project of a remote controller for an automatic antenna tuner used in amateur radio. I already developed the parts which controls the tuner's buttons via bluetooth on Arduino which works well.

Now I am trying just to read the I2C data for the SSD1306 OLED display with this easy code and print on the SM:

Code: Select all

#include <Wire.h>

void setup()
{
  Wire.begin(0x3c);        // join i2c bus (address optional for master)
  Wire.onReceive(receiveEvent); // register event
  Serial.begin(115200);  // start serial for output
}

void loop()
{
  
}

// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany)
{
  while(Wire.available() > 0) // loop through all but the last
  {
    byte c = Wire.read(); // receive byte as a character
    Serial.print(c, 16);         // print the character
    Serial.print(" ");
  }
  Serial.println("");
}
When I turn on the tuner I receive always the same data sequence looks like this:

Code: Select all

21:35:43.239 -> 0 AE D5 80 A8 3F D3 1 40 8D 14 81 B4 D9 22 20 2 21 0 7F 2E A0 C0 DA 2 DB 40 A4 A6
And that's all even if I try to press the tuner's buttons which shoud change the information on the display.
I found by an accident that after I receive the above data and the tuner is ON and I RESET the ESP32 board and start to press the tuners buttons I am receiving much more data. There is a lot of data but one row is different:

Code: Select all

16:59:59.000 -> 40 0 B0 E 13 40 0 0 0 0 0 0 0 0 B1 E 13 40 30 30 30 30 30 0 0
17:00:50.564 -> 40 0 B0 E 13 40 0 0 0 0 0 0 0 0 B1 E 13 40 0 0 0 0 0 0 0 
The whole sequnce looks e.g. like this:

Code: Select all

21:46:01.891 -> 80 AF 
21:46:01.923 -> 40 0 B0 5 14 40 FF 0 0 0 0 0 0 30 30 30 30 30 0 0 0 B1 5 14 40 3F 30 30 30 30 0 0 3 3 3 3 3 0 0 
21:46:01.955 -> 40 0 B0 F 16 40 F0 0 0 0 F0 0 0 FF C0 C0 C0 FF 0 0 0 B1 F 16 40 F 30 30 C 3F 0 0 3F 0 0 0 3F 0 0 
21:46:01.955 -> 40 0 B0 3 15 40 FC 3 C3 33 FC 0 0 0 0 0 0 0 0 0 FC 3 C3 33 FC 0 0 FC 3 C3 33 FC 0 0 0 B1 3 15 40 F 33 30 30 F 0 0 0 F F 0 0 0 0 F 33 30 30 F 0 0 F 33 30 30 F 0 0 
21:46:01.955 -> 40 0 B2 5 14 40 F0 C C C 30 0 0 C0 C0 C0 C0 C0 0 0 0 B3 5 14 40 3F C0 C0 C0 30 0 0 C C C C C 0 0 
21:46:01.998 -> 40 0 B2 F 16 40 C0 C0 C0 C0 0 0 0 FC C C C C 0 0 0 B3 F 16 40 FF C C C 3 0 0 FF 3 3 0 0 0 0 
21:46:01.998 -> 40 0 B2 3 15 40 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 F0 C C CC F0 0 0 0 B3 3 15 40 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3F CC C3 C0 3F 0 0 
21:46:01.998 -> 40 0 B0 E 13 40 0 0 0 0 0 0 0 0 B1 E 13 40 30 30 30 30 30 0 0 
Please does anybody know why I must restart the board to be able to continue ? :?:

You can find a video what is displayed when the tuner is turned ON: https://www.youtube.com/watch?v=kUEXjMg1HuY
You can find more details from my testing here and here:
https://ok1tk.com/blog-feed/
https://ok1tk.com/atu-100-arduino-remote-control/

Who is online

Users browsing this forum: No registered users and 37 guests