help with vector to stepper motor

Hello guys, wonder if someone can give me some help with the principles of codding for my project?

I have two stepper motors being controlled though L293D Stepper Motor Driver to plot an axis on my vertical plotter.

I see there are many vector fonts and images i could send to the motors though C or arduinon sketches but am a little lost how to go about this?

could someone do me a huge favour and just point me in the right direction as the only example code fr something similar is in PHP in this stunning project Sprites mods - Online whiteboard - Hardware: motors ?

The article says that (s)he's using an entire PC to convert the font characters to the X/Y motions needed to actually draw them on the whiteboard; you aren't going to be able to do that on an Arduino, which doesn't have anywhere NEAR the computing power.

If you're just looking to use an Arduino as the basis for their plotter-innards hardware hack, that's do-able; just have a look at the source code they made available via a link in the article to get some idea of what you need to do/change.

The article says that (s)he's using an entire PC to convert the font characters to the X/Y motions needed to actually draw them on the whiteboard; you aren't going to be able to do that on an Arduino, which doesn't have anywhere NEAR the computing power.

I appreciate what your saying, but the plant was to have a computer do all the calculation, then simply load the x/y or algorithm onto the Arduino so the the Arduino can print the reliant information in multiple places unattached to the pc.

Much in the same way i would assume this Arduino Etch-A-Sketch clock is programmed.

It is a simple matter of Pythagoras. Let your pen be at point P and motors at A & B separated by a length L. Draw this upside down with A on the left B on the right and P some point above the two.
You need to find two quantities the length AP and the length BP, given a value of X and Y (the Cartesian coordinates of the pen P).

So from the diagram you will see that AL is given by the square root of X squared plus Y squared. And the length BL is given by the root of (L-X) squared plus Y squared.

So to move to any point with a straight line make sure your motor produces the right number of steps to adjust both strings in the same unit of time.

Thanks Grumpy_Mike :slight_smile:

but how about curves? and can you think of a way to covert a vector images into steps?

Curves are simply lots of straight lines. Look up "Parametric curves" for information on splines but they all boil down to straight lines.

I am not sure what you mean by "vector image" but if it is the output from a vector drawing package then you have to either interpret the vector format directly or get the application to output it in a format you can interpret.

A simple and popular one is HPGL2, although you probably will not have enough room to do that in an Arduino.

Thank you Mike, I will read up on that information you have been kind enough to pass on and I will post back to this thread a little more informed.

in the mean time, regards fitting everything onto the Arduino, is storing the algorithm on a SD card an option?

storing the algorithm on a SD card

You can't store an Arduino program on an SD card. You can store Arduino data on an SD card.

so im going to have to look at a larger AVR or multiple Atmega168s or a form of serial communication?

Hi Mikmo,

thanks for the link, but unfortunately Hector is not open source and i have contacted Jürg Lehni, the creator of "Scriptographer" the java app that translates the image from illustrator in motor commands, but have not received a response in several weeks.

this is unfortunate as the Scriptographer Hector program is exactly what im after. Adobe Illustrator to wall :frowning:

Having some trouble finding a tutorial on HPGL2, or how to interface C and HPGL2 into a single code.

any resource or experience would be sincerely appreciated!

Google around I found this list:-

You just have to parse the input and convert it into X & Y moves and draws. As I said it is probably best to do it in the PC and just transfer the basic X & Y to the arduino and let it draw it. There are lots of commands but in practice only a few are used.

Thank you so much mike!

That looks like the exact information I was looking for.

you should change your name to Helpful Mike, this grumpy acts is not fooling me :wink:

Sincerely, Thank you!

This is also something that I am interested in making.
I am using the adafruit motor shield with the arduino.

Please update on your progress when you can.

Hi, n00b
Your machine goes well? Could you share more detail about how you did it? This is what i'm trying to do now. Arduino version Hektor! Thanks! :wink: