Advice re. communication speeds between two Megas

Hell all,

I'm currently using an Arduino Mega running 8 servos at 200Hz PWM (I played around with 'servo.h' as mentioned in another thread).

The servo positions are updated over serial/USB from a PC, the PC sends out position updates at around 50~75Hz (it can vary).

I need more servos for the application and I'm wondering what the Arduino Mega to Arduino Mega communication options are?

I think the obvious solution would be to plug them both in directly and address each Arduino separately in the PC and away they go.

However I'm interested hear if I could use one USB/serial connection to one Mega:

Each servo then uses 2 Bytes of information.

Every 13ms or so the PC sends 32bytes to arduino1 - it then passes the relevant data (i.e. half of it) to arduino2 - so the first would get 32bytes, send 16 of them to the second then each would update it's servos with the 16bytes they now had.

Rinse, repeat. :slight_smile:

Also latency is a concern - what could I expect in terms of propagation delays between the 2 units?

Thanks in advance for any forthcoming advice 8)

Megas have four hardware serial ports, so they should be able to talk to eachother, but yiou have not explained why you need two Megas anyway.

Reason why: see post #7 at: Help modifying servo.h to give a 400hz signal - Motors, Mechanics, Power and CNC - Arduino Forum

I need to run more than 8 (and likely less than 16) servos at or above 200Hz PWM carrier. :money_mouth_face:

I think 'hardware serial ports' plural is what I needed to hear - googling 'arduino mega hardware serial ports' now :slight_smile:

I thought it was just the one FTDI port - thanks!

I wonder what the latency will be...

Speaking of latency, if I used a USB hub for both arduinos and went direct (with no inter-mega comms) - as in they plugged into the hub and then the hub plugged straight into the PC motherboard - are there any potential issues there with timing or otherwise?

1 Like