I2C protocol for 5 MicroControllers...

HI,

I am planning to build a project consisting of 5 Microcontrollers (UC) . Each Uc is a ATMega 328P.

Each UC is controlling 4 step-motors with ULN 2007's and additional TTL-logic. Each motor is eqipped with a potentiometer controlling the position (and feed to the ANALOGINPUT 1-4), so I have digital position for the each motor.

But UC1 motor 1-4 position is dependent on UC2 motor 1-4 position. And UC3 motor 1-4 position is dependend on UC4 motor 1-4 position. I have to work within very narrow ranges. So I need a continuous feed-back from uc1 motor 1-4 to uc2 and vice versa.

It is obvious I can't use RXD/TXD - pins. SO I plan to use I2C.

And in top of that : UC5 is "outside" world comminicator, receiving commands from the user, and should modify UC-1 / Uc2 setting according to user commands (and actual settings of the motors).

But my knowledge og I2C is very limited. Does anyone know a project similar to this (link) or where I can read more about the I2C protocol (especially related to this project)... ?

Speed is not critical - inter-UC-communication is.

Thanks in advance.

Kristian - Norway

Using I2C is the easiest with a single Master that requests data from the Slaves, making decisions and sending commands to the Slaves. The Slaves only being sensor data collectors or motor drivers.
Is that possible for your project ?

Speed is not critical ? What kind of data at what speed do you want ? For example 100 packets of data per second from each Slave is too much.

Why not add a RS485 buffer to each uC Rx/Tx port, then connect them all up in parallel?
Use a simple protocol: Anyone who sends adds an address to their message, everyone listens for their address and acts on that data.
Will also work better electrically if the devices are going to spread out vs I2C.
You could also read more on I2C between 2 arduinos here
http://www.gammon.com.au/i2c

MAXIM AN763 Guidelines for RS485 wiring.pdf (247 KB)