Some i2c notes

Now that SPIDriver has shipped, I'm working on the followup: I2CDriver. Here are some notes on i2c.

Start with a scan. Having wasted many hours troubleshooting i2c devices over the years, these days I have a little utility on the microcontroller to scan the i2c address range for ACKs. (I didn't invent this. I saw someone else do it and immediately copied it.) It tells you if the device is actually alive and at the address you expected. It's such a useful first step, it's top of the feature list for I2CDriver.This image was deleted by MailChimp when they shut down TinyLetter.
i2c uses pullup resistors. How strong should they be? Believe it or not, the official answer is "strong enough, but not too strong". If they're too weak, then the rise time will be too slow. If too strong then a node might not be able to reliably transmit a zero. This quite dry paper from TI sums it up nicely. They recommend somewhere between 1 and 7 Kohms - depending on your circuit.

This image was deleted by MailChimp when they shut down TinyLetter.

There's no obvious standard for i2c modules. Yes, i2c modules are everywhere, but they all have different sizes and pinouts. Surely a 4-pin i2c standard (GND, 3.3V, SDA, SCL) would be popular? The closest I can see is Seeed's Grove system, but it's very connector-heavy, and is really a mixture of protocols, one of which is i2c.

The following i2c peripherals do not exist. Nobody makes these as products:

Wouldn't it be nice to have an easy, well-thought-out i2c interface for them, like this RGB LED or this rotary encoder? In fact all most every sensor in this ridiculously cheap 37 sensor package could be i2c - making hookup and use so much simpler.
  There are just 112 valid i2c addresses. The address is 7-bit, hence 128 addresses. But 16 of them are reserved. This list from Adafruit shows some popular devices with their addresses. There are some clashes, but a surprising number of devices have programmable addresses.

Many i2c peripherals are more expensive than an i2c microcontroller. A cheap microcontroller that has hardware i2c is around $0.29. One without hardware i2c (you have to implement it in software) is just $0.03. There are many i2c peripherals that cost more than this yet do things that a microcontroller can do easily. This is very puzzling. Perhaps people don't trust microcontroller software?

Next week I'll post some screenshots of the I2CDriver prototype.