i2c Question...

Adamey

Senior Member
I've read up on using the i2c bus and I think I understand it pretty well. I want to use one master PICAXE to talk to several slaves which will gather data (and make it available to the master via scratchpad) and also control outputs (by using data sent from the master).

My main question is regarding the physical limits of i2c. The PICAXE's would be in separate enclosures with distances of perhaps 10 feet maximum (some are closer). Can I use the i2c bus over such a distance? Anything I should worry about or precautions to take?

Or do I need to consider a different method of communicating altogether?
 

inglewoodpete

Senior Member
i2c was intended for communication within an instrument or device (Eg a TV set or VCR etc). Bus length was in the order of 1 to 1.5 metres. In reality, it can be extended futher than that.

Due to the impedance that the standard bus works at, it is vulnerable to line capacitance causing phase shift which ultimately causes communication errors.

Having said that, I use i2c over 12 metre busses (actually 4 x 12 metre busses, so you might call that 50 metres).

There are 3 directions you can take to get longer-then-usual bus lengths.
1. Use i2c bus extender chips like the P82B715. Basically these are an impedance converter, dropping the line impedance from about 5k to 500ohms or less. The cable capacitance has less effect but still limits the length of bus. I've managed to get good communication up to about 16 metres using standard PICAXE configuration. I have had to implement some data checking and resending for reliability.
2. Reducing the data transmission speed. Not so easy with a PICAXE but you can slow the operation of the chips down and the i2c slows down too.
3. Use multiple busses. This is something I do, too. But I have to use 4 PICAXEs as bus masters, so the whole setup gets quite complicated.

There is a good discussion paper on extending i2c busses called AN444 published by Phillips. Google it up.

Edit: I should have said that there are other options like serial over RS485 etc. I like i2c because it is fully transparent protocol with the PICAXEs. It does practically everything for you.

Peter
 
Last edited:

westaust55

Moderator
I want to use one master PICAXE to talk to several slaves which will gather data (and make it available to the master via scratchpad) and also control outputs (by using data sent from the master).
Also, keep in mind that only X1 and X2 PICAXE parts can be used as slave devices
 

fernando_g

Senior Member
I-pete's comments are right on the money.
However, the semiconductor company is no longer Philips...it has become NXP.
 

Adamey

Senior Member
If I use an external chip like an i2c extender, then would it make sense to use a chip to add CAN instead? Or does that require far more work?
 

hippy

Ex-Staff (retired)
I would say that could require a lot of work as the PICAXE has no support for CAN.

You could set up an I2C prototype to test proof of concept over the distances you are thinking of. There are other options such as serial data which may fare better. I2C can also be slowed down which gives it longer range. Data can certainly be transferred over large distances and often at high speed
 
Top