Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 04:01 30 Aug 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Pico as I2C sniffer ?

Author Message
58kk90
Regular Member

Joined: 14/06/2023
Location: United Kingdom
Posts: 79
Posted: 07:55am 29 Aug 2026
Copy link to clipboard 
Print this post

I urgently need to capture some data between a piece of old test equipment and it's battery.
Looking on the scope I believe it to be either SMbus or I2C which are essentially very similar as far as I can tell for just two devices on the bus.
I am not at home currently so I don't have access here to logic analyser or bus pirate, but I do have a couple of Pi Pico's in my laptop bag, does anyone have any quick and dirty code to sniff I2C data and output it to raw bytes to the terminal?

Tony
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 429
Posted: 08:11am 29 Aug 2026
Copy link to clipboard 
Print this post

G'day Tony,
Can you ascertain the clock frequency from the scope, if so you could try:

Assuming the battery is the slave:
Hook up a PicoMite to CLK/DAT
Set system I2C
Use LIST SYSTEM I2C to find address of battery

If that works then:
Hook up PicoMite to CLK/DAT via 22K series resistors
Connect battery to device
Set PicoMite as slave at battery address
Use Interrupts to see what is sent

I have done something similar to get touch info from a touchscreen controller but it took a fair bit of stuffing around.

Someone will likely chime in with a better solution using PIO etc  

Regards, Lyle.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3368
Posted: 08:40am 29 Aug 2026
Copy link to clipboard 
Print this post

Mozzie is on to something with the PIO idea. In the manual Appendix F, The PIO Programming Package, EXAMPLE PROGRAM 3 is a basic logic analyser that could probably be adapted to do what you want.

For a more comprehensive logic analyser search Volhout's posts.

Here it is
Edited 2026-08-29 18:54 by phil99
 
58kk90
Regular Member

Joined: 14/06/2023
Location: United Kingdom
Posts: 79
Posted: 10:02am 29 Aug 2026
Copy link to clipboard 
Print this post

@Mozzie, the clock frequency seems to be just about 20KHz, I'll try and find the battery I2C address using the List System I2C as you suggest, that would be a starting point I guess, then I could do as you suggest  capturing the data, but I'm not sure how the Pico I2C slave code would deal with the acknowledges  as the Pico would be on the same I2C address as the battery.
I'll do a bit of poking around and update later.
@phill99, the PIO is waay above my level  of programming, but i'll take a look and see if I can make sense of it.

If only i'd have my Buspirate in the laptop bag, it would be quick and easy!

Tony
 
Volhout

Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 6068
Posted: 02:54pm 29 Aug 2026
Copy link to clipboard 
Print this post

Hi,

Use the PicoLA (picomite logic analyzer for PicoMiteVGA.
You can trigger on start condition, and it has a built in I2C decoder.
In the help menu it shows where to connect SDA and SCL.

PicoLA



Alternatively you can use SCOPPY (the free version). It has a built in logic analyzer, and 2 channel scope.

Volhout

Volhout
Edited 2026-08-30 00:56 by Volhout
PicomiteVGA PETSCII ROBOTS
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 429
Posted: 03:23pm 29 Aug 2026
Copy link to clipboard 
Print this post

G'day,
With a 20khz clock frequency I would guess its SMBus, pretty sure a lot of the power tool batteries use this.

SMBus_made_Simple_slua475.pdf

Volhouts Pico_LA logic analyzer looks like the answer here   am going to load it up and take it for a spin myself, Thanks Volhout  

Regards, Lyle.
 
Volhout

Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 6068
Posted: 03:29pm 29 Aug 2026
Copy link to clipboard 
Print this post

LA26.zip

The latest. Runs on V60302.

Maybe I finally will start looking at integrating other decoders (SPI/UART) (**). It has been 3 years, and since I only kept it compatible with evolving MMBasic.
Should also work on HDMI.

If you have no sound attached to GP6/7 you can change the define at line 55 of the program to enable channels 7 and 8. You will also have to disable the built in test pattern generator in the program (comment line 61).

Volhout
(**) LA uses quite a lot of heap, and only recently improvement has been on heap for the 2040 VGA. Maybe there is enough room now to add features.
Edited 2026-08-30 01:37 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Volhout

Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 6068
Posted: 03:46pm 29 Aug 2026
Copy link to clipboard 
Print this post

If you only have a pico (the module), and no VGA/HDMI, use SCOPPY.
You can install scoppy in a pico, connect it through a USB cable to your (android) phone, install the scoppy app on the phone.
If you have a pico-W, you can also connect the phone through WIFI.

Not sure how far the "free" version goes (decoding I2C). But you can for sure see the waveforms on scope , and use the logic analyzer built in.

Volhout
Edited 2026-08-30 01:48 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026