2013-07-22

Millathe: Initial State Pictures

The Millathe with tool post and homemade tool post holder, the spindel speed is adjusted through the pair of little leve : For some reason the door does not like to shut, it pushes against the lid of the gear box despite not looking bent, seems to close fine without the gear box lid though.

All the gears on this side are for the autofeed. Notice the small cracked plastic gear on the upper right. There is also a gear hidng be hind the 76 tooth gear which appears to be detached from its  shaft. On the left is the main drive belt, it goes down to the motor which is single phase 500W asynchronous:

The gear box/ shifter. While there is no back gear on this device it can go pretty slow (speeds are printed on the front of the lather below here it says Maximat7). Theres a little bit of rust on the steel gears and some wear from shifting visible on the phenolic gears but over all it doesn't seem to be in bad shape:

One day perhaps the traction system in the millathe will be redone or incorporated into the control system, but that is a project for the future.

2013-07-19

The Millathe: A CNC story

So a long while back I managed to acquire an Emco maximat 7 machining center. It has been my goal to make it a CNC machine, however it has been sadly sitting in my living room waiting for me to finish busscooter, but now that that is done (besides a few safety features which need to be added). I've turned my sites to making this CNC dream a reality and things are finally starting to happen.

So hear's the deal: this machining center, or the millathe as it is has been nicknamed, is like 75% lathe 25% mill and 100% heavy, seriously the millathe isn't that big but weighs well over 100lbs.  Unfortunately I don't have pictures right now and am other wise not at home so those will get posted later. It also happens to be Austrian and metric which is wonderful because if you know me I tend to shun 'standard' units (really? Who calls 'units standard' when only a small fraction of the planet uses them?). The lathe portion of the millathe seems fully operable except for the lead screw; which is linked through a mess of gearing to what appears to be a cracked plastic press fit gear, so  cant be turned automatically by the spindle motor. The lead screw does have a knob so you can turn it by hand, but this project is about avoiding that. Unfortunately most of the gears in the lathe system seem to be of phenolic materials but they're functional for now, perhaps some time in the future I will rebuild the power part of the spindle drive but that's another project and another thing to add to the list of fixes.

Currently the plan is to make lathe portion CNC before turning to what ever may be wrong with the mill section of the machine. The list of key action items for modifying the millathe in no particular order  looks like this:

•  Replace lead screws (I might not replace them but they look a bit wonky).
• Add Backlash compensation, because no one loves backlash in automated systems.
• Acquire steppers for driving the Z and R axis screws giving control of the lathe port.
• Create method of supplying power to said steppers in order to control the system.
• Create control system for the steppers.
At the moment I've started looking at the control side of things.  The plan is to stream through USB to an arduino nano which can act as a buffer and send the signal out separately to each stepper driver synchronously. I plan on using the Allegro A4989 stepper motor driver to control all of these shenanigans. It will require that each motor needs 2 outputs from the arduino, one for step and, one for direction.
The outputs from the A4989 generally go straight to the gates of transistors but, it's tempting to instead direct them to some gate drives to allow them to drive larger fets for larger stepper motors. I haven't really done any calculations to justify this but it seems like it would be nice thing to have a one size fits all solution to driving steppers even if it is over kill. A pair of LM5109A gate drivers per stepper driver seem perfect for this task since they have inputs that can be driven separately allowing for whatever sort of control method the stepper controller feels like.

However last night I began to experiment with methods of sending arduino data over usb and had moderate success in getting LED's to count synchronously according to their appropriate digital out ports rather than by using the normal digitalWrite commands. This was kind of  interesting since apparently pyserial only sends data as strings and chars. Which to me this seems weird and inefficient but I'm not that experienced with data streaming techniques. Hopefully it will be able to send data at a pace appreciable enough to make it work other wise. I'll talk more about messing around with this in the next post.

I don't have any pictures of the millathe to post at the moment but I always feel bad not posting a picture so here have a repost of the  tool post holder I made for the millathe a while back. It is currently mounted on the millathe and works just dandily. yaaay reposts.

2013-07-15

Math n Stuff (Specifically Geometric Algebra)

So one thing, I've been doing lately instead of building things is studying geometric algebra.

Now you might as why on earth would someone devote them self to some obscure type of math when vector calculus, differential equations and linear algebra satisfy most engineers. Geometric Algebra while not that widely known as far as I can tell (at least I know no mechanical engineers that know of it, but that really isn't saying much), has some pretty snazzy properties. I will babble about it for for a variety of reasons:
1. Its pretty cool (for debatable definitions of cool).
2. It has applications to a robotics engineering problem I have encountered and would like to solve.
3. Geometric algebra is like a general enough form of math that it encompasses several other forms of math used in various areas of engineering in a single construct and could be useful in a wide variety of engineering applications.
4. Writing down the important bits will help me remember it.

Honestly as a mechanical engineer it's been a bit of a 'mindfuck' learning mathematics from papers on maths. After reading several papers, maths from a mathematician's perspective seems very different from how I've thought about math up to this point and how I think more applications oriented think about math. As a meche I was looking at maths in what I think was a practical yet backwards thought process that dictated math functions the way it does because that's the way the world works; but I think mathematicians would say math functions the way it does because of the way that people decided to define it is as a logical construct, regardless of how reality works. Which I would say is much more accurate and leaves the door open to interesting ways types of constructs. Math only functions how it does because of how we define it, it just so happens the world was nice enough to allow its self to match up with some of out logical patterns that we like to call 'math'.

Either way, back to geometric algebra.
Some of its useful characteristics:
Geometric Algebra naturally models geometric things we tend to care about in a concise fashion,  it can be extended to n dimensions, and structures that represent imaginary numbers are naturally formed by the algebra without actually having imaginary numbers. Remember those weird things where $i^2 = -1$? That is an 'imaginary' number. In geometric algebra (what I consider one of the most useful properties) you can represent more than just $i$, the algebra can be used for quaternion representations where the imaginary numbers are extended to $ijk$ or extended even further to represent arbitrary set of 'imaginary' constants which would all have the property $n^2 = -1$ while remaining orthogonal to each other in an whatever dimensional space.
If you're an engineer you might realize the utility of that last bit, it allows you to perform rotations of abitrary dimension using rotors which are kind of like generalized versors.

While I don't know of any applications where you would want to use >6 dimensions but I think it's kind of nice that geometric algebra gives you the option.

For a bit of history on Geometric Algebra http://catdir.loc.gov/catdir/samples/cam033/2002035182.pdf

Otherwise I'm going to talk about some of the technical details of geometric algebra. This are defined in terms of the geometric product, which is the fundamental  operation of geometric algebra, it is denoted by a lack of symbol ,similar to what we do with multiplication. It has the properties of multiplicative associativity, and distributivity over addition. In the following example $a,b$ and $c$ are multivectors but you can think of them as normal vectors right now. The geometric algebra rules that:

1.Associative: $a(bc) = (ab)c$
2.Distributive: $a(b+c) = ab + ac$

Note the geometric product is non commutative, I think that this property is best thought of as a feature because it ends up giving the outer product of the geometric some important characteristics. The inner and outer products of the geometric algebra are defined in terms of the geometric product as:

outer product: $(ab-ba)/2 = a \wedge b$

inner product: $(ab+ba)/2 = a \cdot b$

geometric product in terms of the inner and outer product: $$ab = a \cdot b + a \wedge b$$

And the outer and inner products are analogous to the cross products and dot products of normal vector math how ever they have some subtle differences that I wont go into right now.

More on the outer product:
The outer product is the antisymmetric part of the geometric product. Also from now on the outer product will be noted as $\wedge$ in equations. This property of antisymmetry has some useful effects, and results in something almost the same as a cross product. The cross product of two parallel vectors is 0. similarly the outer product of two vectors that are scalar multiples(a.k.a. parallel) will also result in 0.

$$a \wedge b = - b \wedge a$$
if  $$b = a$$
$$a \wedge a = - a \wedge a$$
$$\therefore a \wedge a = 0$$

If vectors are orthogonal then the following is true: $ab = a \wedge b$. The result of vector $vector2 \wedge vector1$ is not a vector, it is of greater dimension or 'grade', a vector is of grade 1, a plane is of grade 2 and a volume element would be of grade 3. When two things are wedged together their grades add as long as they are not linear multiples of each other.

$$a , vector, line$$
$$a \wedge b, grade 2 plane$$
$$a \wedge b \wedge c, grade 3 volume$$
$$a \wedge b \wedge a = - a \wedge a \wedge b = - 0 \wedge b, grade 0$$

This is to show some of the basic properties of geometric properties of geometric algebra but I don't have time to write a text book so I'm just going to show a few more things about the outer product right now.  Consider two vectors $a$ and $b$ with orthonormal bases (fancy terms for $\hat x$ and $\hat y$ ) $e_{1}, e_{2}$ and scalars $a_{1} , a_{2}, b_{1}, b_{2}$.

Consider the following:

$$a \wedge b = (a_{1} e_{1} + a_{2} e_{2}) \wedge (b_{1} e_{1} + b_{2} e_{2})$$
Remember in geometrric algebra stuff distributes over addition so:
$$a_{1} b_{1} e_{1} \wedge e_{1} + a_{1} b_{2} e_{1} \wedge e_{2} + a_{2} b_{1} e_{2} \wedge e_{1} + a_{2} b_{2} e_{2} \wedge e_{2} = a_{1} b_{2} e_{1} \wedge e_{2} + a_{2} b{1} e_{2} \wedge e_{1}$$

and the outer product anti-commutes so:
$$= ( a_{1} b_{2} - a_{2} b_{1}) e_{1} e_{2}$$

If you are familiar with the vector math this may be apparent but the outer product of two vectors results in a planar element with a magnitude of the parallelogram spanned by the vectors $a$ and $b$. This is the same as a cross product except that the cross product would produce a third vector perpendicular to the other two rather than a plane spanning the two vectors. This pattern continues with higher dimensions, the outer product of 3 vectors would produce a signed volume element with the magnitude of the spanned parallel piped. In fact this would hold to n-dimensional hyper volumes!

I mentioned before that one of my favorite properties of geometric algebra was how it treated imaginary numbers. Lets take a look at how 'imaginary numbers' occur as a result of the geometric algebra. Consider orthonormal vectors of magnitude 1, $a$ and $b$. The inner product is 0 for orthogonal vectors so in this case $ab = a \wedge b$.

$$(ab)^{2} = abab = -aabb = - (aa)(bb) = -1$$

That's right. $(ab)^{2} = -1$. The imaginary numbers naturally appear out of the geometric algebra. Part of the nifty thing is is that it does not require anything to define this besides the geometric product, and isn't actually dependent on a number of dimensions to exist besides having more than two. In this way you can construct multiple 'imaginary' planes and perform rotations higher dimensional systems in the same manner as a lower dimensional system. Some of you guys might note the possibility of the Euler equation to be applied here which does happen. Infact is allows us to construct the powerful rotor which allows arbitrary rotation across a vector. But that is for another time.

End of geomtric algebra for now next time I will talk about the inner product and general screw motion.