Thursday 7 February 2013

System test and new software.

The whole machine is now together and I'm working on the software.

The Reprap Gen2 host software seems to have some strange race conditions - sometimes extruder on/off gets stuck in the wrong position for the actual firmware state, and sometimes the temperature sensed jumps up and down by 25 degrees. After a few minutes unable to diagnose the problems in the (now very outdated) software, I decided to write my own firmware and host software.

So far my version doesn't print, but it does give me full and accurate control over all the hardware. Screenshot:






The dials and LEDs use a library called SteelSeries - you can find it here .
The emergency stop button works too - it stops all motors and turns off the heater.

Using this interface I tested all the min/max sensors, temperature control, stability, extruding parameters and can count the steps between the limits etc - all needed to calibrate the machine.

Next step will be to add the 3d printing functionality to the host software.
Here's a video showing the screen and hardware working together - first, the Z axis is lowered until it detects a limit and stops. Then it is ordered to rise until it hits the other limit. Finally, the heater is turned on and monitored as it rises to about 50 deg.


Rebuilt Z axis.

I've now mounted the new (working!) extruder on an improved Z axis. There's less (almost zero) play due to constant pressure on one side. I could probably reduce the height by mounting the extruder closer to the end of the moving section but at this stage it doesn't matter.

The min/max sensors are weakly attached so they break off if something goes wrong. A captive nut is used as before.





After a long break working on other projects, I've returned to the Lego reprap. I gave up for a while because the extruder just didn't work properly. I kept getting jams in the nozzle I'd made - actually this is a known problem with the very early design reprap nozzle.

This time I bought a J-head IV nozzle from hotends.com .

I eventually came upon a good method of driving the filament using lego. I pinch the filament between two rollers. To work effectively the rollers have to be stiff enough to generate sufficient friction, but elastic enough to allow some slippage. They should rotate in opposite directions at the same (very slow) speed to pull the filament in.

I used two of the black lego driving shafts in adjacent holes as the rollers. They're driven by an old Lego technic motor. To achieve the extreme gearing in a small package with minimal friction losses, I've used worm gears to reduce the rotation speed. (I believe the lego motor has no internal reduction.)

The rollers have a section of grey Lego plastic tube slid over them to reduce the gap and because the tube is more flexible than the shafts. So it makes it tighter and gives some flexibility to the grip.

And.. finally, I have a working Lego extruder (albeit the nozzle is not lego, but lego was never going to survive the temperatures for extruding)!

I've included some pics and a video of the extruder working, hopefully the pics make it clear how this all works. Some of the pics show some plastic that's been extruded. The extruder is mounted on a temporary Lego frame for testing.










Sunday 19 February 2012

All 3 axes working with limit sensing


The repstrap was tested with a program that "exercises" each axis between its limiting points detected by the opto-endstops. For us, this is the only way to be sure that the axes will operate properly when used by the reprap software. It also allows us to look for any wires that might snag or parts that are moving in undesirable ways. The program is included at the bottom in case anyone else wants to use it ...

We did find an issue with using pin 13 for the max-Y sensor; swapping this to pin 15 solved the problem, but is concerning as we know no reason why pin 13 should not work. Luckily we'd plugged everything into a breadboard with jumper wires so this change took all of 30 seconds.

I've included some more photos of the device as it stands now. During this fine-tuning session we've started to benefit from using Lego - wherever moving parts risked hitting each other, or needed some reinforcement, it was easy to alter the Lego construction to fix things up.So you will notice some changes in construction compared to earlier photos, and there will be more to come.






// remember to select board - ladyada adafruit is atmega168

//which opto enstop are we using?
//this is for the H21LOB
//#define INVERTED 1
//this is for the H21LOI
#define INVERTED 0

#define USE_MOTORS 1

// Stepper X
#define  gndPinX 0
#define stepPinX 2
#define  dirPinX 3
#define  minPinX 4
#define  maxPinX 9

// Stepper Y
#define  gndPinY 0
#define stepPinY 10
#define  dirPinY 7
#define  minPinY 8
#define  maxPinY 15//13 for some reason doesn't work with pin 13!?

// Stepper Z
#define  gndPinZ 0
#define stepPinZ 19 // a5  (a0 = d14)
#define  dirPinZ 18 // a4
#define  minPinZ 17 // a3
#define  maxPinZ 16 // a2

void setup() {
  Serial.begin(9600);
  Serial.println("Starting stepper exerciser.");

  pinMode(minPinX, INPUT);
  pinMode(maxPinX, INPUT);

  pinMode(minPinY, INPUT);
  pinMode(maxPinY, INPUT);

  pinMode(minPinZ, INPUT);
  pinMode(maxPinZ, INPUT);

#if USE_MOTORS
  pinMode(stepPinX, OUTPUT);
  pinMode(stepPinY, OUTPUT);
  pinMode(stepPinZ, OUTPUT);

  digitalWrite(stepPinX, LOW );
  digitalWrite(stepPinY, LOW );
  digitalWrite(stepPinZ, LOW );
#endif 
 
  pinMode(dirPinX, OUTPUT);
  pinMode(dirPinY, OUTPUT);
  pinMode(dirPinZ, OUTPUT);

  digitalWrite( dirPinX, HIGH );
  digitalWrite( dirPinY, HIGH );
  digitalWrite( dirPinZ, HIGH );
}

void loop() {

  int stepperSpeed = 400;

  Serial.print("Speed: ");
  Serial.println(stepperSpeed);

  while( true ) {
 
#if USE_MOTORS
      digitalWrite(stepPinX, HIGH);
      digitalWrite(stepPinY, HIGH);
      digitalWrite(stepPinZ, HIGH);
      delayMicroseconds( stepperSpeed );
      digitalWrite(stepPinX, LOW);
      digitalWrite(stepPinY, LOW);
      digitalWrite(stepPinZ, LOW);
      delayMicroseconds( stepperSpeed );
#endif 

      if( isBlocked( minPinX ) ) increase( dirPinX );
      if( isBlocked( maxPinX ) ) decrease( dirPinX );
      if( isBlocked( minPinY ) ) increase( dirPinY );
      if( isBlocked( maxPinY ) ) decrease( dirPinY );
      if( isBlocked( minPinZ ) ) decrease( dirPinZ );
      if( isBlocked( maxPinZ ) ) increase( dirPinZ );
  }
}

boolean isBlocked( int optoPin ) {
//  Serial.print("pin ");
//  Serial.print( optoPin );
 
  boolean blocked = true;
 
  if( digitalRead( optoPin ) ) {
     if( INVERTED ) {
       blocked = false;
     }
  }
  else { // read false
    if( INVERTED ) {

    }
    else {
       blocked = false;
    }
  } 

//  if( blocked ) {   
//    Serial.println(" is blocked." );
//  }
//  else {
//    Serial.println(" is open." );
//  }
 
  return blocked;
}

void reverse( int dirPin ) {
  digitalWrite(dirPin, !digitalRead(dirPin) );
}

void increase( int dirPin ) {
//  if( axis == MIN2MAX ) {
    digitalWrite( dirPin, HIGH );
//  }
//  else {  // max2min
//    digitalWrite( dirPin, LOW );
//  }
}

void decrease( int dirPin ) {//, int axis ) {
//  if( axis == MIN2MAX ) {
    digitalWrite( dirPin, LOW );
//  }
//  else {  // max2min
//    digitalWrite( dirPin, HIGH );
//  }
}

Monday 13 February 2012


Improved Lego Z axis. There's still that corkscrew motion; I think that's something wrong with the end of the threaded rod. I will try to file it flat... But overall much happier with the mechanism. Key improvements included moving the sliding part closer to the captive nut, use of the gears to hold the toothed track in place, and putting the flat sliding surface on the side nearest the point at which the force is applied by the captive nut.

I'm hopeful that bolting everything down tightly (it's roughly assembled right now, everything is hand-tight) will make it serviceable. Now moving on to testing the opto-endstops and writing a program to exercise with limit-sensing.


Thursday 9 February 2012

Z axis redesign

So the original Z axis wasn't good enough. After dismantling to diagnose, the flexing problem is due to the uneven end of the threaded rod where it meets the motor and the seat for the bearing needs to be more secure. This is relatively easy to fix I think.

The play in the Z axis needs a more fundamental rethink. The original design used a pair of interlocked cages that slid against each other.

After some experimentation, I found that the Technic toothed track part with some medium sized gears can produce a very tight fit, but still move smoothly. Again, the moving part is surrounded by other lego beams giving a smooth surface for it to slide on. It is more compact than my original version.

This is the new design, with a total movement of 17 lego studs. In the following pictures you can see the sliding part in different extreme positions and from different sides; the main negative aspect is that it looks like a sub-machine gun!

Here's a video showing that there is no visible play in any direction:

Extruder details

I've taken some shots to show how the extruder will (hopefully) work. The hot parts will be milled from brass and insulated with a nylon barrel as normal. Lego won't take the heat. The extruder insulator will be bolted into a lego assembly, and the feed rod will be drawn in using lego gears, motor, and a pair of pulley wheels that pinch the rod. The lego motor also needs a reduction gearbox (easy to make with lego). In these images, the extruder is shown partly dismantled because I'm rebuilding the Z axis and the way the extruder is mounted.

The extruder is basically a sandwich of about 7 layers. From the motor, we reduce the rotation speed then use gears to drive 2 pulley wheels in opposite directions with a small gap between them. The gap is a great fit for my plastic feed rod (a short piece is shown, I have a reel) but I had planned to put rubber bands on the pulley wheels if it was not a tight fit.

In this video you can see that the mechanism pulls the rod through the extruder and is quite stiff (I can lift the extruder via its grip on the rod). With luck, this will be stiff enough to extrude. If I need to change the gearing, this is easy in Lego. The Reprap electronics allow speed control, and according to this page my Technic motor will not draw too much current at 9v in the worst case (a stall) (however, I might be running it at 12v, but the rod will slip before the motor will stall? I hope.)