Hi all!
I'd like to build something that controls three stepper motors and 2 DC motors, but the steppers have encoders too. I really don't want them to miss steps, that's why I'm using encoders.
I've got an Arduino mega 2560, which is good, but I'd like to rotate the three steppers independently.
That's why I've decided to use uno's to control the motors, reading the encoder, giving signals to the motor driver.
The main program will be on the Mega. That needs to communicate with the unos. I just like to give a commands like:
"First motor takes 5 rotations and 165º at speed of 120 rpm"
"2nd motor takes 3 rotations at speed of 180 rpm"
"3rd motor take 6 rotations at speed of 60 rpm"
The quuestion is how to wire them (arduino mega with 3 unos), which protocol to use, and maybe some sample about communication between two arduinos.
A lot of thanks in advance!
You can easily connect each Uno to one of the Serial1, Serial2 and Serial3 ports on the Mega and use simple Serial.print() commands to communicate.
The 3rd example in Serial Input Basics will provide a reliable way to communicate. You can use it on each of the Unos and 3 versions of it on the Mega if it needs to receive data from the Unos.
Do you need close coordination between the movements of the motors? That may be difficult to achieve with 3 separate Unos. Maybe you could have a separate I/O pin connection from the Mega to the Unos that would signal when a move should start.