I2C The Hard Way

[Igor] has an AS5600 magnetic rotary encoder chip on a breakout board. Normally, you’d think that was an easy device to work with since it has an I2C interface. But [Igor] wanted to do it the hard way. What’s the hard way? By hand. He directly manipulates the clock and data lines using some push buttons. You can see how it goes in the video below.

This is possible because the controlling device — in this case [Igor] — gets to set the clock rate, and there’s no reason it has to be regular. We have to admit that it never occurred to us to do this, but we have written “bit banged” I2C-like code before.

The practical value of this isn’t clear, but we were still impressed. Certainly, if you had to write code or build hardware to operate the protocol, this would tell you quickly if you understood the fundamentals. We wonder if his next trick will be RS232 via Morse code key.

If you want a deep dive into the world of I2C, we can help with that. This reminded us of the old “paperclip computer book” that showed how to make your own computer with oatmeal boxes and paperclips. You just had to do the work of the CPU yourself.

5 thoughts on “I2C The Hard Way

  1. This would tell you quickly if you understood the fundamentals

    I think this was why I’d wondered about (but never actually tried) creating something like this. Add in a microcontroller acting like a logic analyser and a small OLED to show you the data, and it becomes a neat little learning tool.

    Also, do we really need a reason? It’s fun!

  2. It was a great way to troubleshoot bad I2C docs back in the 90s when neither myself or my employer could afford a good enough logic analyzer or digital scope.

    Won’t work for TIA-232 because that needs a better than 10% steady clock.

  3. This is mostly idle curiosity; but it would be interesting to know if (and if so what, whether more or less randomly scattered, certain vendors, or certain sorts of peripherals) some I2C devices misbehave when the clock is sufficiently slow or irregular. In theory it isn’t forbidden; but it wouldn’t be the biggest surprise if some devices are really SMBus at heart and just claim I2C because somebody gave going under 10KHz a quick go and it seemed OK.

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.