I would like to develop a master/slave network that consists of:
1 Arduino master that reads sensors and generates velocity ramp profiles based on the sensor signals and then sends those ramps to slaves
3 (or more) Arduino slaves that control the velocity of 12V servo motors following the ramps sent by the master
What is a good communication protocol to achieve this? Serial (SPI)? I2C? Something else? If it is serial, is the new Arduino Leonardo a good choice? What issues should I be considering in selecting a protocol?
I'm imagining something like:
Master:
void loop() {
update_ramps()
for(int i=0; i< num_slaves; i++) {
send_to_all(i, ramps[i]);
}
}
Slave 1:
const int id = 1;
int recived_id, recived_value;
void loop() {
read_data();
if(recived_id == id) {
do_motor_step(recived_value);
}
}
And serial communication in which RX/TX from the master is sent to all slaves.
Does this seem like a reasonable solution?