XYZ Coconut shredder (I may need some help...)

Hello everyone,

I'm working on a programming project that serves as a thesis for my degree, which involved an XYZ positioning system, although I only need precise movement in XY, since I would need it to control the holder for the coconut.

Here are the problems I have at the moment:

  1. How would I be able to move the motors at the same time?

  2. How would I use the circle algorithm to correctly move the holder from one location to another?

  3. How do I send the float/long data from raspberry pi to Arduino?

I have already made a program for that purpose, but then there was a problem with the execution, for the motors didn't seem to work at all, and if it did, one motor would run before another runs when they're supposed to run at the same time to arrive at a certain destination.

Even when that's done, there's still the plotting problem, for I have smashed my head trying to find a way to solve this. I have thought to plot x and y by running a program that would count a value per pulse of a x or y motor. Hopefully it would yield some great results.

Here is the config:

  • All three stepper motors use 2 pins for both direction and speed.
  • There are stopper pins that determine the max and min limits for all motors.
  • The program will move after getting the radius from the raspberry pi.
  • I have made modules for positive and negative movement on all motors, as well as conditions that determine which motor to use based on the current and next position in the Cartesian plane.

Another thing that confuses the heck out of me is how do I interpret the values from the module to allow the program to properly move to that position. I don't know as to how would I meaningfully use data from the module since it's using long float numbers. Here's what I mean by that:

I have attached the code to the project in this forum.

Thanks in advance!

coconut_processing.ino (6.47 KB)

  1. How would I be able to move the motors at the same time?

The AccelStepper library has a class called MultiStepper that makes it easy to move multiple motors simultaneously. It, however, does not use accleration so motor speed is limited.

  1. Not sure what you mean by the circle algorithm.
  1. How do I send the float/long data from raspberry pi to Arduino?

One way is to send the data as ASCII and translate to numbers using the atof() or atoi() functions. See example #5 of the serial input basics tutorial for some good information.

May I ask why you use XY movement for this kind of thing? Wouldn't a halfpipe or 2 rails be better suited as guides for the nut?

groundFungus:
The AccelStepper library has a class called MultiStepper that makes it easy to move multiple motors simultaneously. It, however, does not use accleration so motor speed is limited.

I haven't used the stepper library in the program, so I'm not quite sure as to how the program would react. I'll look into it though.

groundFungus:
One way is to send the data as ASCII and translate to numbers using the atof() or atoi() functions. See example #5 of the serial input basics tutorial for some good information.

Thanks for that, I'll check it out and update if it works.

groundFungus:
2. Not sure what you mean by the circle algorithm.

Look at the circle module in the attached Arduino file.

zwieblum:
May I ask why you use XY movement for this kind of thing? Wouldn't a halfpipe or 2 rails be better suited as guides for the nut?

I'm using xy movement due to the fact that I'm using a particular program module where I have to detect the radius of the coconut meat using raspberry pi, which would determine how the coconut holder move.

UPDATE: I have managed to get both Stepper motors move so that they can move at the same time, though I am doubting if the circling function actually works, here is the plots from the program: