Sep 22, 2018
16
0
4,510
Hi everyone!

I have a project in mind, i want to build a robotic arm using stepper motors and drivers for them (TB6600).
My idea is to control every motor with an Arduino nano, and using a RaspBerry Pi to control the Arduino boards, like master and slave.
I dont want to use CAN bus because it would increase the cost a lot.

So my question is if this control method could work fine or its innecesary. I could use just the RaspBerry board but I'm afraid of not being able to control simultaneously all the motors. Am I wrong? It is a better way to do it?

Thanks a lot, all your suggestions are welcome!
 
Solution
Wow, I thought it would be much easier, I'm starting to use raspberry pi and I would like to implement a simple communication protocol.

In total I will use 6 axis so 6 arduino nanos too, maybe there is a simple way of controlling the motors.
I don't know if a single Arduino could manage all the motors simultaneously, or the Raspberry Pi could too.

Any other ideas with other microcontroller or computers?

Thanks for your reply!
Since it is your, self contained system, you can make up any protocol you'd like. It could be as simple as:
[A] (for Arduino) Waiting for input
[R] sends command, eg rotate to 20 +/- (for direction) Or just a value between -360 and 360
[A] rotates, then waits for input
[R] sends status request eg...
Sep 22, 2018
16
0
4,510
Wow, I thought it would be much easier, I'm starting to use raspberry pi and I would like to implement a simple communication protocol.

In total I will use 6 axis so 6 arduino nanos too, maybe there is a simple way of controlling the motors.
I don't know if a single Arduino could manage all the motors simultaneously, or the Raspberry Pi could too.

Any other ideas with other microcontroller or computers?

Thanks for your reply!
 

OldSurferDude

Reputable
May 18, 2019
171
31
4,640
Wow, I thought it would be much easier, I'm starting to use raspberry pi and I would like to implement a simple communication protocol.

In total I will use 6 axis so 6 arduino nanos too, maybe there is a simple way of controlling the motors.
I don't know if a single Arduino could manage all the motors simultaneously, or the Raspberry Pi could too.

Any other ideas with other microcontroller or computers?

Thanks for your reply!
Since it is your, self contained system, you can make up any protocol you'd like. It could be as simple as:
[A] (for Arduino) Waiting for input
[R] sends command, eg rotate to 20 +/- (for direction) Or just a value between -360 and 360
[A] rotates, then waits for input
[R] sends status request eg. sends the letter 's'
[A] sends position then waits for input eg,

You communication can be synchronous, which is easier, but slower, or asynchronous, which means [R] has to accept data at anytime, too.

This is a very simple and incomplete description of "protocol" There will be a lot of people that are much more knowledgeable than I who will rip this explanation apart. As you progress and learn, that information will become more important. My point is, just try something, if it's not working to your satisfaction, figure out why, and then try something to fix it.

I validate your approach, as the RPi will be much much better at translating 3-D coordinates to spherical coordinates. Separating tasks makes it easier for debug.

ps (the plural of axis is axes, I had to look it up)
 
Solution
Sep 22, 2018
16
0
4,510
Since it is your, self contained system, you can make up any protocol you'd like. It could be as simple as:
[A] (for Arduino) Waiting for input
[R] sends command, eg rotate to 20 +/- (for direction) Or just a value between -360 and 360
[A] rotates, then waits for input
[R] sends status request eg. sends the letter 's'
[A] sends position then waits for input eg,

You communication can be synchronous, which is easier, but slower, or asynchronous, which means [R] has to accept data at anytime, too.

This is a very simple and incomplete description of "protocol" There will be a lot of people that are much more knowledgeable than I who will rip this explanation apart. As you progress and learn, that information will become more important. My point is, just try something, if it's not working to your satisfaction, figure out why, and then try something to fix it.

I validate your approach, as the RPi will be much much better at translating 3-D coordinates to spherical coordinates. Separating tasks makes it easier for debug.

ps (the plural of axis is axes, I had to look it up)

Thanks a lot! Now i see that its not as difficult as i imaginated

I Will try it, Just sending and recieving messages between both controller.
 
Sep 22, 2018
16
0
4,510
I have one question, I always wanted to know how to implement matlab to a real application, like motors in this case. Its interesting to design and try algorithms in the "ideal world" implemented with Matlab, but then what? how can I connect my motor to try all the code and see whats happening in real time.

So in this case, if I design my robot arm and I have a model that I can control with Matlab like Peter Corke toolbox, then how I move it to my real robot arm?
 
There are Stepper HATs as well.

You're jumping over too many squares at once. Last time I've used Mathlab was decade ago, and it was on a PC with proper hardware interface for the sensors. If you want to model a servo loop in Mathlab, you'll need a motors with feedback (encoders), and there are (I suppose) ready-made boards with supporting libraries. Once you invent your control loop, you implement it in code on RPi.
 
Sep 22, 2018
16
0
4,510
So i imagin if i create my control model on Matlab, using Simulink for example, then i could export the code to the Raspberry and would work fine

I will use encoder for each joint to have feedback so that shouldn't be a problem
 
It seems you want to close the servo loop thru RPi in software. This is very challenging task, for several reasons:
  • you need a cycle time of less than 1ms;
  • you need very precise timing, with very low jitter;
  • debugging this is not trivial.
I am not saying that cant be done with RPi. There are good real-rime kernels ported to RPi (Xenomai comes into play). But mastering them is not a trivial task, and I'd really recommend you to start with something simpler.
 

Azzyasi

Distinguished
Jan 24, 2011
141
14
18,715
*MatLab not Mathlab, Matrix Laboratory - MatLab

Regarding the project, there are numerous drivers that can be controlled by RPi directly. No need for aduino. If you run out of ports then go I2C or SPI which are natevly supported by RPi.
https://learn.adafruit.com/adafruit-dc-and-stepper-motor-hat-for-raspberry-pi

As for a ready made thing you can look at Ramps 1.4 board that can use real accurate drivers like TMC2300 or basic ones like A4988 but needs an arduino. It controlls 5 steppers Nema 17.
Then the only project remaning is translating the output from rpi to arduino as a whole. Or you can stay only with arduino if you need basic operations and the code is not big.

Investigate further into stepper drivers like A4988, TMC2300, TMC2208, TMC2100, or some of the LV series. You might get them running directly from RPi but keep in mind you also need some electronics to supply separate power and establish protocol, some diodes to prevent burning the gpio pins if you turn the steppers by hand, etc.
 

TRENDING THREADS