"Sandtrails" - a polar sand table

Welcome. Be sure to also check out the progress from Klaus. He is still working on the build and we can all work together at the same time:

Let me point out a few things you should consider:

  1. The two AccelStepper objects you have don’t know about each other. If you ask one to go from zero to 1 and the other to go from zero to 10, the first will finish right away. The movements need to be more coordinated to slow down the one that is traveling a shorter distance. If you are using the AccelStepper library I think you are, then there is a multistepper. But when I tried it, it did the same thing.
  2. A straight line in sandify is going to end up being just the next end point. If you just travel from your current position to the next x,y, your corners will be in the right place, but none of the lines will be correct. They will all be arcs.
  3. Imagine a path of a square spiral. When you go from a theta of -3/4pi to +3/4pi, your current code is going to go most of the way around, instead of doing the shortcut across -pi. This is why the thr format allows rotation values much larger than 2pi or smaller than -2pi.

About your code running question though:
A. You can start reading information on the serial port (but go faster than 9600 baud, 115.2k, at least). You will also need a smart serial port sender on the computer. Something that won’t just spew the whole file all at once.
B. You can also start by just plopping the file in the code. At least a simple pattern won’t be so difficult, and you can solve one problem at a time.
C. There are also SPI micro sd card readers that are very cheap. There are arduino libraries to interface with them.
D. Consider using the thr format from sandify. I know you have this great xy to theta, theta math. But the thr format is excellent for a few reasons.

  1. It breaks lines down into small segments. This fixes problem 2 and maybe problem 1.
  2. It outputs continuous theta values. This fixes problem 3.
  3. The math will be a lot simpler. Not just because you aren’t going to convert from x and y to theta, but also because you can use normalized coordinates. The code won’t even care how long the arms are.
    This is why I went to the trouble above to use the thr files. They really are a great format for polar machines.

I would be happy to help you out to get this across the finish line.

2 Likes