I know that i2c interface require pull-up resistors. But I don't understand why. Googling gave me some hints regarding something about open-drain/open-collector but I am still not smart enough to understand. Can someone elaborate or post useful links I can read? Thank you very much.
I know that i2c interface require pull-up resistors. But I don't understand why. Googling gave me some hints regarding something about open-drain/open-collector but I am still not smart enough to understand. Can someone elaborate or post useful links I can read? Thank you very much.
I2C devices cannout output 'high', they can only pull the line down to ground.
It is a mechanism that allows multiple devices on the bus without worry of dueling I/O pins causing a burn out of some kind. Since no device actively drives the bus, no device is able to supply any additional current to the bus other than what can flow thru a pull-up resistor. This way, if two devices accidentally tried to drive the data bus line in opposite directions, nothing bad happens. The bus simply goes low.
It has the clever property that you can often get away with having different voltage devices on
the same bus - so long as the pull-up resistor isn't too strong it won't damage the inputs on the
lower voltage (3.3V) device. You can also pull-up to 3.3V if the 5V devices recognise 3.3V as
logic HIGH, which an Arduino will.
Another property of having open-drain outputs is that the actual level on the bus is the logic-AND
of all the outputs driving it - only if all are high (which is open-circuit) does the line go HIGH
via the pull-up resistor - can be a useful property for some things.
Yet another property is that if the cable gets crushed and the signal gets shorted to ground
then nothing bad happens to the outputs.
Another reason is because there can be any number of devices on the bus, if every device had an integrated pull-up resistor, the driving device would have to be able to handle the current from every device, this way, you are guaranteed that the current is limited by one pull-up resistor. For example, if there were 10 devices, each with their own pull-up, then the current required to pull-down the line would be 10 times the current if there was only one device.
long story short, i2c is an active low system. that means that the arduino doesnt look at the line waiting for a 5 volt. it is waiting for a ground. in i2c gnd is a digital 1 and 5 volts is a logic 0. the pull ups are needed or else the arduino might sence gnd on the line even though there is nothing on it. i kniw the system is kinda backwards but as the others say, it is for safety and compattability purposes. if you still dont get what pull ups are for then watch jeremy blum's techbits (episode 13 i think) on analog and digital signals