DIY I2C Tester

[Dilshan] built a dedicated I2C tester which allows for I2C bus control over USB using simple commands such as init, read, write, etc. The Linux kernel has had I2C driver support for a couple of decades, but you’ll be hard pressed to find a computer or laptop with a I2C connector (excluding Bunnie Huang’s Novena hacker’s laptop, of course). This tester does require a Linux host, and his programs use libusb on the computer side and V-USB on the embedded side.

[Dilshan] put a lot of time into building this project, and it shows in the build quality and thorough documentation. With its single-sided PCB and all thru-hole construction, it makes a great beginner project for someone just getting into the hobby. At the heart of the tester is an ATmega16A in a 40-pin PDIP package (despite the Microchip overview page calling it a 44-pin chip), supported by a handful of resistors and transistors. Schematics are prepared in KiCad, code is compiled using gcc and avr-gcc, and he provides a label for the enclosure top. The only thing missing is information on the enclosure itself, but we suspect you can track that down with a little sleuthing (or asking [Dilshan] himself).

If you use I2C quite a lot, give this project a look. Easy to build, useful in the lab, and it looks nice as well. We have featured [Dilshan]’s work over the years, including this logic pattern generator and his two-transistor-on-a-breadboard superheterodyne receiver.

26 thoughts on “DIY I2C Tester

  1. “you’ll be hard pressed to find a computer or laptop with a I2C connector”
    If it’s gotten a standardized external display connector, then you technically have a i2c connector already, as long as the OS is Linux.
    But some buffering and protection circuitry would definitely be recommended.

        1. Well, it requires giving yourself extra permissions. And if you want to rely on any of the linux-builtin abstractions – e.g. EEPROM – you need to keep poking things in /sys with elevated permissions.

          e.g. I used the I2C in my VGA port to dump an EEPROM in a USB webcam, after discovering that just using i2cget only read the first 256B (and not the full 4KB)

          1. Alex Rossie: basically, this:

            The rest was “I had a cut-up Belkin VGA cable, one of those ones that were so cheap they didn’t use coax for the video signals, isolated the I²C wires, used logic analyzer clips to hook it up to the EEPROM in the webcam, and then copied the file from /sys to somewhere else”.

            I intended to use this to start fuzzing the EEPROM, to see if I could disable the reported 16:9 modes to keep programs from trying to use them… but couldn’t figure out a good way to coax the webcam into rebooting.

  2. A simple MCP2221A (a preprogrammed PIC16F1455) would have done the job as well. No need for a crappy VUSB job, and the lastest kernels already have i2c kernel drivers for it.

    1. Very very nice mate. Add in a couple of simple zeners to make a 5v and a 3v3 supply too. That’d cover 99% of the cases.

      That said the project above is very very nice.

  3. Well, why not.

    But it seems awfully complicated, given the fact that every Mircropython capable microcontroller board with USB can do the same.
    Via the USB based serial REPL, you can init the I2C (among other busses) , do a scan, read and write data.
    Very handy for testing I2C peripherals before writing the actual code.

    My favorite board ist the NRF52840-Dongle, which costs only $10, and has a shitload of features.

  4. Most of actual Mainboards or Laptops have an open I2C Connector inside.
    But there seems no official documentation for them until you take a closer look in the hardware and began to reserch the deep burried software implementations …

  5. I was wondering what it “brought to the party” that the Bus Pirate didn’t do. However the thing I’m really bothered about is that the project page shows the I2C connector being a 4-pin Molex/Dupont with Gnd and VCC at the two ends and nothing to stop it being flipped.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.