Hi there
I am new to adruino , can you help me write an arduino program that generates a spiral motion on the table using x ,y servo motors.
Thanks!
Hi there
I am new to adruino , can you help me write an arduino program that generates a spiral motion on the table using x ,y servo motors.
Thanks!
After reading the How to use this forum post, please post your current code properly, describe the mechanical setup and explain the difficulties you are having.
A simple algorithm without trigonometric functions, pure integer arithmetic:
Start with a small (hidden) square. Choose two adjacent corners for center and starting point of a circle. Draw a quarter circle. Choose the square corner for the next center that preserves the direction but increments the radius, draw the next quarter circle, and so on.
The quarter circles can be drawn using Bresenham algorithms.
This construction is very old, but I could not find its name.
This link describes making an XY table using hobby servos.
It is a good link because it describes the issues of using servos.
It can be done using servos but you might want to think about steppers etc.
A critical decision is the size of the spiral which you have not specified.
You also need to decide what type or types of spiral you want to draw;
Lealem_y:
Hi thereI am new to adruino , can you help me write an arduino program that generates a spiral motion on the table using x ,y servo motors.
Thanks!
Look up "Polar to rectangular conversion". Choose a center point and a radius. This will describe a circle. Then, every "N" degrees you want around the circle, get the rectangular X and Y coordinates for the endpoint of the radius line and drive your stepper motors there. To make a spiral instead of a circle, just change the radius. Easy-peasy.
DrDiettrich:
A simple algorithm without trigonometric functions, pure integer arithmetic:Start with a small (hidden) square. Choose two adjacent corners for center and starting point of a circle. Draw a quarter circle. Choose the square corner for the next center that preserves the direction but increments the radius, draw the next quarter circle, and so on.
The quarter circles can be drawn using Bresenham algorithms.
This construction is very old, but I could not find its name.
A single lookup table covering 0 to 90 degrees ( in PROGMEM) is all that is needed.
All sine and cosine values can be obtained from this table (with offsets or inversion as needed) and it's a LOT faster than repeated calls to Bresenham's line algorithm.
For more accuracy, the lookup table can be 16 or even 32 bit then scaled appropriately.
I think to be able to provide useful suggestions we need to see the mechanical arrangement of the table.
On a traditional X-Y table controlled by, say, stepper motors with a servo lifting or applying a stylus, the problem seems, on the surface, fairly easy.
If your X-Y coordinates are being determined by servos (and I don't even know how that would work, TBH) it seems like the math would be quite a bit more complex.
Blackfin:
I think to be able to provide useful suggestions we need to see the mechanical arrangement of the table.On a traditional X-Y table controlled by, say, stepper motors with a servo lifting or applying a stylus, the problem seems, on the surface, fairly easy.
If your X-Y coordinates are being determined by servos (and I don't even know how that would work, TBH) it seems like the math would be quite a bit more complex.
I personally would consider a "servo" as a black box that I didn't need to worry about. I tell it "go there" and it goes there. The servo should not need to figure into the math of generating a spiral (aside from the magnitude of the control signals).
krupski:
I personally would consider a "servo" as a black box that I didn't need to worry about. I tell it "go there" and it goes there. The servo should not need to figure into the math of generating a spiral (aside from the magnitude of the control signals).
I think that's an apt general description of a "servo" but in the Arduino context I take it to mean:

We need more info from the OP.