Thursday, October 30, 2008

Wednesday, October 29, 2008

subversion URL

svn+ssh://@cssgate.insttech.washington.edu/home/INSTTECH/_tces455/svn/

Tuesday, October 28, 2008

Mill is MOVING!!!

Edward and I got the mill moving using the bresenham line algorithm.
Video Proof:


Code here

Saturday, October 25, 2008

why they're called "sketches"

i've figured out why arduino programs are called "sketches"
the arduino programming environment is an offshoot of "processing" right? well processing is mostly designed for writing qraphics programs, and what is a graphics output? a drawing or a "sketch".

bresenham algorithm in 3d

static long x = 0,y = 0, z = 0;

void move(long x2, long y2, long z2)
{
long dx = x2 - x;
long dy = y2 - y;
long dz = z2 - z;

long x_inc;
if (dx < 0)
x_inc = -1;
else
x_inc=1;

long l = abs(dx);
long y_inc;

if (dy < 0)
y_inc = -1 ;
else
y_inc=1;

long m = abs(dy);
long z_inc;

if (dz < 0)
z_inc = -1 ;
else
z_inc=1;

long n = abs(dz);

long dx2 = 2^l ;
long dy2 = 2^m ;
long dz2 = 2^n ;

if ((l >= m) & (l >= n))
{
err_1 = dy2 - l;
err_2 = dz2 - l;
for (long i = 1;i<=l;i++)
{
if (err_1 > 0)
{
_step(Y);
err_1 = err_1 - dx2;
}
if (err_2 > 0)
{
_step(Z);
err_2 = err_2 - dx2;
}

err_1 = err_1 + dy2;
err_2 = err_2 + dz2;
step(X);
}
}
else if ((m >= l) & (m >= n))
{
err_1 = dx2 - m;
err_2 = dz2 - m;
for (long i = 1;i<=m;i++)
{
if (err_1 > 0)
{
_step(X);
err_1 = err_1 - dy2;
}
if (err_2 > 0)
{
_step(Z);
err_2 = err_2 - dy2;
}
err_1 = err_1 + dx2;
err_2 = err_2 + dz2;
_step(Y);
}
}
else
{
err_1 = dy2 - n;
err_2 = dx2 - n;
for (long i = 1;i<=n;i++)
{
if (err_1 > 0)
{
_step(Y)
err_1 = err_1 - dz2;
}
if (err_2 > 0)
{
_step(X);
err_2 = err_2 - dz2;
}
err_1 = err_1 + dy2;
err_2 = err_2 + dx2;
_step(Z);

}
}
}

Wednesday, October 22, 2008

assembly in arduino

I've just discovered that the arduino supports inline assembly.

guide to avr Assembler commands

http://www.avr-asm-tutorial.net/

examble:
asm volatile(
// DDRC = 0010 0000, ie. PORTB5 is OUT
"ldi r16,48\n"
"out 0x27,r16\n"
);

Startrek looms ever closer...

I have found yet another link between our reality and the wonderful scifi world of StarTrek: Transparent Aluminum! I know it isn't really relevant to our class, but I thought it was interesting enough to share.

Monday, October 20, 2008

Thursday, October 9, 2008

proposed hardware interface

here is a proposal for the hardware interface.
comments please

/**************************************
*movement types
*LINEAR is the expected movement
*COS starts out full speed and tapers to 0
*SIN is the opposite
**************************************/
#define LINEAR 0
#define COS 1
#define SIN 2
/**************************************
*enumeration of the axis movement selected
*allows for easy scaling later
**************************************/
#define AXIS_X 0
#define AXIS_Y 1
#define AXIS_Z 2
/**************************************
*sets the feedrate
*@param feedrate feedrate in steps/min
**************************************/
void set_feedrate(float feedrate);

/**************************************
*this queues up a move to be executed upon call of start()
*if feedrate is set to 0, movements will happen at maximum rate.
*@param axis The axis to move.
*@param destination final location for this axis (in steps)
*@param movement_type specifies the movement rate modifier
*@param degrees_start specifies where on the sin/cos curve to start (required if movement_type != 0)
*@param degrees_end specifies where on the sin/cos curve to end (required if movement_type != 0)
**************************************/
void add_move(char axis, long destination);
void add move(char axis, long destination, char movement_type, int degrees_start, int degrees_end);

/**************************************
* call this to start a movement.
* this is only called after all axis movements are entered.
* @return 0 upon success, non zero if error
**************************************/
int start();

/**************************************
*returns the current location of the axis (in steps)
*@param axis axis to read
*@return selected axis location in steps from home
***************************************/
long get_axis_location(char axis);

/**************************************
*gets status of machine
*returns 1 if all systems go.
*@return status bits
**************************************/
unsigned int status();

Wednesday, October 8, 2008

Arduino Reference Material

http://www.arduino.cc/en/Reference/HomePage

A simple DC Motor Controller

I found this article that explains the basics of how to get your motor to give feedback to a microcontroller and then control the speed of the motor.

Wednesday, October 1, 2008

gcode references

I think I'll try to beat Mr Gutmann to the punch, and post my favorite resources for G-Code.
There's wikipedia of course, the NIST website also has one, it is in reference to their interpreter, but I see no reason why we can't use it as a resource. Cncezpro.com seems to be the reference Mr. Gutmann prefers, and he also pointed out this one. I personally prefer the one by the NIST because it seems to give a deeper view into the inner workings of a proper gcode interpreter. It mentions the use of variables and mathematics.
the line
g0 x[#1550 + 3.6] y1.6
would be interpreted as Rapid move to (<value at register 1550> + 3.6, 1.6)
this probably isn't neccasary for drawing the roadrunner, but if we want to replicate a industrial control as much as possible, i think this is information worthwhile knowing, or at least considering.

Channel 8 = Free Visual Studio

https://downloads.channel8.msdn.com/

Class on Wed October 1st

View gcode stuff at http://www.cncezpro.com/

We will need write some code to parse our gcode.