Soft I2C library compatability

Hello,

I was hoping to use some sort of soft I2C library to achieve I2C interface. The thing is the application has limited space, so I can't use a 32U4 or a 328P. I've been looking around and the 16U2 seems suitable except the fact that it doesn't have I2C embedded. Do the soft I2C libraries work on the 16U2? I was looking at this one. http://extremeelectronics.co.in/avr-tutorials/software-i2c-library-for-avr-mcus/

Do the soft I2C libraries work on the 16U2?

It will probably work but if it works for you depends on what you want to use it for. It's only master capable, it cannot be a slave on the bus. I used a similar software I2C for one of my projects and it worked flawlessly. However if a device depends on some I2C features not implemented in the software version (clock stretching) you won't get happy.

The thing is the application has limited space, so I can't use a 32U4 or a 328P.

An ATtiny85 is smaller than the 16U2 and has built-in TWI (I2C). Isn't that an option?

pylon: An ATtiny85 is smaller than the 16U2 and has built-in TWI (I2C). Isn't that an option?

I would although I also need USB functionality. I think I'm going to use a 16U2 and test out the soft I2C workings. If that doesn't work then I'll switch the driver that i'm currently using from its ssop package to its CSP package and use a 32U4 whilst finding a new fabricator that can make a board that has the capability of making boards with trace widths small enough to use a CSP package.

Go get yourself a Digispark:

http://digistump.com/#digispark

It employs a Attint85 and plugs into a USB cable.

I feel like we've detracted from the question.

Can that soft I2C library work on a 16U2?

Can that soft I2C library work on a 16U2?

Yes, it can, there’s nothing in the code obviously speaking against it. I never tried it but you have a very good chance that it will run perfectly, so I would give it a try.

Awesome! I'll give it a go and let you know if it works

So does it?