Friday 6 April 2012

StepStuck

When I built my Mendel I used A3977 stepper drivers. Before that I did some maths to show that the component values need to be carefully selected to match the motor in order to achieve 8× microstepping. Makerbot produced a board with four potentiometers and I published settings for motors popular at the time.

Since then Pololu stepper drivers have become popular (and the StepStick clone), but they only have one thing that you can adjust: the current. They also have 16× microstepping, which makes the range of component values that work even smaller. I was always pretty sure the off-time would be wrong for the motors we use and while commissioning my second Mendel90 I could hear that it was wrong, so I decided to look into it.

When stepping one motor at a constant speed you should hear a single pitch at the step rate. If the off-time is too short then the lowest current microsteps cannot be achieved, the motor pauses twice every 16 microsteps so you hear a lower pitch sound as well.


If you step the motor very slowly (G1X10F1) you can hear a sequence of steps with a pause.


The reason for this is that the lowest current step when ×16 microstepping is 9.8%. If the current is set to 1A then that is only 98mA. The minimum on-time for the chip is fixed at 1μs and my formula predicts the off-time needs to be at least 54μs with 1.65Ω motors. That would require a 47k resistor but the value fitted is only 10K. That gives an off time of 12μs which isn't even long enough for 8× microstepping. The situation is even worse on the Z axis with two motors in parallel.

The problem with increasing the resistor to 47k is that the switching frequency drops to 14kHz, which is audible. So my conclusion is that the A4983 is not really suitable for driving such low resistance motors. The A3977 allows you to control the minimum on-time so you can avoid the switching frequency becoming too low.

Later Pololus and some StepSticks use the A4988 chip. That has an interesting section in the datasheet: -
Low Current Microstepping. Intended for applications where the minimum on-time prevents the output current from regulating to the programmed current level at low current steps. To prevent this, the device can be set to operate in Mixed decay mode on both rising and falling portions of the current waveform. This feature is implemented by shorting the ROSC pin to ground. In this state, the off-time is internally set to 30 μs. 
Conceptually an easy mod to do, simply short out R4, but due to the size and location of the resistor and the age of my eyes it was not at all easy. I applied the mod to a StepStick and it worked, the steps are now regular, no missing beats. Running is a bit quieter but I think the motors are more noisy when stationary. More investigation is needed.

What to do with my A4983 Pololus? Well if I increase the current to 1.3A and change the resistor to 36K then the minimum frequency is 17kHz, which is ultrasonic to me nowadays due to the age of my ears. Alternatively switching to 8× microstepping and using a 22K resistor keeps it above 30kHz and the current can be 1A.

I don't think constant off-time choppers are the best idea. The current range is too limited and the switching frequency varies wildly. As the two halves of the chip run at different frequencies they can generate beat frequencies in the audio band.

The other thing I don't like is that they regulate the peak current so there is an offset of half the ripple current which can make the first step inaccurate.






Tuesday 13 March 2012

Mendel90 files

I have put the Mendel90 files on GitHub. There is the OpenScad source code plus some Python scripts that, given a machine configuration, will generate all the STL files for the printed parts,  DXF files for the sheets, SVG drill templates, a master BOM with a matrix showing where the parts are used and sub-assembly BOMs for each of the sub-assemblies.

Two standard configurations are included: Sturdy90 is the MDF version with 10mm rods that I have had running for three months. Mendel90 is an acrylic version with 8mm rods and the same build area as a Mendel that I have assembled but not run yet. The generated files for these two configurations are also on GitHub.

The directory structure is as follows: -

├───imported_stls       The pulleys and gears that I use but don't have OpenScad source for.
├───mendel                 Generated files for the Mendel90 variant.
│   ├───bom
│   ├───sheets
│   └───stls
├───Prusa_retrofit       A Z motor bracket that allows the Mendel90 x-axis to be fitted to a Prusa.
├───scad                    The OpenScad source.
│   ├───conf               OpenScad configuration files.
│   ├───utils                Utility modules for making objects, such as polyholes.
│   └───vitamins          Models of the non-printed parts.
└───sturdy                  Generated files for the Sturdy90 variant
    ├───bom
    ├───sheets
    └───stls

The top level directory contains the build scripts. To make all the files for a machine run: -
    make_machine.py machine_name

To make just the bom, sheets or stls run bom.py, sheets.py or stls.py machine_name.

machine_name can be mendel or sturdy. To make your own variant copy scad\conf\mendel_config.scad or scad\conf\sturdy_config to yourname_config.scad and edit it. Then run make_machine yourname.

To view the model of the whole machine open scad\main.scad. It will take about 8 miniutes to render but after that you can pan and zoom it at reasonable speed and changes takes less time to render.

To view a sub-assembly open the individual scad files. Set the exploded flag in config.scad to make exploded views.

scad\conf\config.scad contains constants that should be independent of machine variant, for example screw clearance hole sizes. It includes machine.scad that is generated by the build scripts to include the configuration for the specified machine variant.


Thanks to sevikkk (Vsevolod Lobko) for making the scripts work on Linux as well as Windows.


I will put the build instructions in the RepRap wiki soon. These will mainly consist of the exploded views of each of the sub-assemblies with the list of parts in it. Unfortunately OpenScad can't export images from the command line at the moment so they have to be made manually in the GUI.

On my todo list is to add scripts to make images of all the STL files, PDFs from the SVG files using inkscape and produce the BOMs in spread sheet format using OpenOffice. I also need to write a script to tile the SVG files to allow them to be printed on A4 sheets and taped together like the Darwin bed template.

Thursday 16 February 2012

Mendel90 finishing touches

I have tweaked a lot of things since building the prototype. The design is fully parametric meaning each part works out how big it should be from basic parameters like the desired build volume, rod diameter, the motor sizes and the layer height used to print it. That means any little modification can change everything slightly, which is why I won't release the files until it is finished. For example, if I increase a screw hole clearance then the brackets might get a bit bigger and that will knock on to moving the holes in the sheets and may increase the sheet size slightly. I also want the drill templates to be accurate so every part that needs a mounting hole had to be modelled, even the cable clips and wire holes.


The cable clips are designed to keep the limit switch wires away from the motor wires to prevent crosstalk. The hole sizes are calculated from the wire size and the number of wires using circle packing rules and so are the holes through the frame for the wires.

The printed holes that need to be accurate sizes are polyholes if they are vertical, truncated teardrops if they are horizontal. I added on half the layer height to all the horizontal teardrops and nut traps to allow for the staircase effect of the layer sampling.

Another change that had a lot of little knock on effects was to allow thin sheets to be used for the vertical parts of the frame, requiring nuts on the back. That necessitated moving the buttresses and fixing blocks to avoid clashes. The net result is that you can specify the thicknesses of the sheets and whether to use nuts. If using nuts it will calculate the the screw length just long enough to work with a Nyloc nut and generates a clearance hole in the sheet. When not using nuts it calculates a screw short enough to not go right through, generates a pilot hole and adds a star washer under the screw. If the sheet is hard it generates machine screws and a hole to be tapped, otherwise it generates a wood screw.

In order to standardise the screw lengths I made all the parts of the brackets that take a screw the same thickness.

I want the BOM to be accurate and remain that way, so the model includes everything apart from the hot end and the electronics. I haven't used any libraries so there are no dependencies apart from OpenScad itself.


I modelled the belt twists and the tension loop to get an accurate assembly diagram and length on the BOM (hopefully I haven't tested that yet). I also modelled the cable strips to get their lengths. The one to the extruder was tricky as it is completely free-form and the ends differ in X, Y and Z. I modelled it as half an ellipse with a shear transform to gets the ends in the right place. It is probably not mathematically accurate but looks about right. Interestingly there isn't a simple formula for the circumference of an ellipse as there is for a circle, only numerical approximations.

I redesigned my fixing blocks to have slotted holes to allow a bit of adjustment. I also changed the hole depth to allow the same screws to be used as elsewhere and cut away some plastic that wasn't adding much to the strength.



RepRap firmware uses a bottom limit switch that needs a fine adjustment. It also needs a coarse adjustment to allow for different nozzle lengths. I found this difficult to accommodate because of limited space at the bottom of the z-axis. This is the design I arrived at after much deliberation: -



The switch is mounted on a lever that is hinged at the bottom by a thin section of plastic and sprung against a screw adjustment by two rubber washers. An extra type of vitamin but I am not impressed by printed springs.


I developed exploded diagrams to make the build instructions. A picture like this with its bill of materials should be self explanatory.

The z-couplings don't need as much clamping strength as the ones I designed for the Prusa (they only need to rotate the screw and not hold the weight of the x-axis) so I was able the make them slimmer, which was necessary to avoid a clash with the z-motor bracket when using NEMA14 motors on the Huxley sized machine.


As you can see two pictures above I also added some pointers on the lead screws. These can be set to face the rods when Z is homed and can then be used to observe if the two motors have got out of step and whether the z-limit switch is repeatable.

This is what the Mendel size machine with 8mm rods looks like with a 6mm acrylic frame and a 10mm base (without the bed).


Note that to make transparency work in OpenScad you have to draw the transparent objects after all the things you might be able see through them.

The hole cut through the gantry is just big enough to make the Y-carriage. I prefer to make my Y carriages from DiBond as I think they are a bit lighter and handle heat better, but acrylic should be OK and it seems a shame to waste such a big bit. I wouldn't recommend it on the MDF version as that is thicker and so even heavier. I have seen people mount PCB beds directly on MDF but I found that even when spaced off and insulated it warps enough to keep throwing the bed out of level.

I offset the Y-axis to allow the ribbon cable for the bed power to be central. That makes it easier to attach the wires to the PCB. I don't think there is any problem with the belt being nearer to the two bearing side, in fact it is probably better.


I had to slim down the back of the Y-idler bracket to prevent a clash with the bar clamp on the Huxley90. The overly long bolt is simply to reduce the number of unique fasteners. Similarly the cable clips could use smaller screws but I kept them the same as the other base screws. On the Mendel90 the base screws are M4 or No6, on Huxley90 they are M3 or No4.

I used a hacked up D connector shell on the prototype with hexagonal posts for locking. To remove those as vitamins and I designed a printed version that uses normal M3 nuts and screws for the locking. It also has a cable clamp optimised for the ribbon cable and its supporting plastic strip.


Again an exploded view makes it clear how the captive parts fit.


I also crudely modelled the tie-wraps because the 10mm bearings require longer ones to be on the BOM.


Modelling the wing nuts showed that one can clash with the X-end if it is oriented in some directions. Fortunately the bolts are captive hex heads so you can rotate the head and try again if the nut happens to stop where you don't want it. I am currently using M4 extruder mounting screws but I see the Prusa2 has moved to M3. I think that would solve the clash with smaller wing nuts but there are a lot of extruders and hot end designs using M4 I think, so I am not sure if I will follow. In any case it is simply a configuration parameter if you are printing your own.

You can see that I added a small part to the belt tensioner. It works a lot better than the Nyloc I had in the design before.

I also added some more nut traps to make assembly easier. Even a pair of "flying" ones inside the X-motor bracket. You can just see one here:


I have done a lot of changes the make things scale correctly for a Huxley sized version. This uses 6mm rods and NEMA14 motors.




I need to make a smaller extruder though as a Wade's is way too big. I plan to do a mini Wade's with a NEMA11 motor for 1.75mm filament. That will make the carriage smaller and reduce the width of the machine.

I also want to make a parametric PCB heater design to allow arbitrary machine sizes.

So as you can see I have put a lot of work into this since Christmas. In fact nearly all my spare time, until 2am a lot of evenings. I get really ticked off when people demand that I release the files before it is finished. Unlike a lot of people I don't put half baked things on Thingiverse, only tried and tested designs.

As all the parts have changed a little bit I am in the process of printing all the Mendel sized 8mm ones to check them. I will then release the design on GitHub. I had wanted to release it with make files to generate all the STLs automatically but it seems the command line option of OpenScad is currently broken so people will have to make their own if they change any of the parameters.