Monday, 26 March 2012

Cost comparisons

I am as interested as the next guy in saving money. I also want to make my own things.

One of the items I have been interested in making is the 20mm T-Slot from Thingiverse shown below:
Say for sake of argument I was wanting to build a Prism:
This uses 9 x 400mm lengths of 20mm aluminium profile extrusion.

Now the volume of a 400mm section of the Plastic T-Slot with 100% solid fill is about 90cc.

The cheapest price I can find for ABS at the moment is Buy 3D Ink, where it is $39.95 for 3lb of 3mm filament (without shipping to the UK), this equates to about £18.30 per Kg, or £0.0183/g (there may well be cheaper product out there, but bear with me for now).

An average price for PLA is about £0.21 a metre from Faberdashery, where it is £21.00 for a 100m coil, about 880g (again without shipping) or £0.0238/g.

ABS is about 1.04g/cc
PLA is about 1.379g/cc

So to make the item would require 93.6g of ABS filament (1.04*90) or 124.1g of PLA filament (1.379*90).

So our manufacturing costs for each item would be £1.71 for ABS (93.6*£0.0183) or £2.96 for PLA (124.1*£0.0238), so looking at total costs of £15.39 for ABS (9*£1.71) or 26.64 for PLA (9*£2.96) for the 9 lengths of 400mm T-Slot.

Ignore for the moment potential difficulties involved with joining several 100m pieces together to make a 400mm length, acetone apparently works quite well as a glue for ABS, other items are more suitable for PLA.

Now consider the cost of buying the actual aluminium extrusion instead from KJN, at £2.90/m (with a free cutting service), which equates to £1.16 per 400mm length and £10.44 for all 9 pieces (again shipping has been ignored).

Here is a classic example where the industry standard, off the shelf item is substantially cheaper than attempting to manufacture the part yourself.

I am all for innovation and making as many parts for yourself as possible, but really fail to see the point when it works out 47-155% more expensive than buying an off the shelf product.

Now making the motor mounts, weird shaped brackets, one off items, etc, is where these machines come into their own - very low setup costs for small production runs (one or just a couple) for bespoke items that you would be hard pressed to locate in any shop and would cost a small fortune to have someone manufacture for you.

Just remember, that just because you have a 3D printer and you potentially can make just about anything you set your mind to, doesn't mean it will be cheaper than ordering it from someone who sells huge quantities of an equivalent product and can leverage economies of scale.

Monday, 12 March 2012

More stepper testing

Looks like I may indeed have destroyed one of my stepstick drivers due to my own stupidity, of course you can't measure current across 2 pins, you can only measure it in-line, now the diagram did show this, but I was obviously not thinking at the time, and the description was not idiot proof!

The dead driver is probably due to me shorting it out across 2 of the motor pins whilst attempting to measure the current.

After yet more reading about the stepper drivers, I came across the following post stating which current sense resistors are used on the various stepper drivers.

I then checked the parts list associated with the bare board version of the ones I have and they list 0.05R - same as Pololu, not the same as A4988 stepstick.

so my calculation should be: Motor Current = Vref / ( 8 * Rs ), where Rs is 0.05 (or Motor Current = Vref * 2.5).

I was now able to accurately determine how much current was being made available, I started at 1A and worked down.

I tried all sorts of settings and was becoming increasingly concerned that something else was wrong, because I could cause an axis to move in the + direction for about 180 steps and then it would simply stop!

After which none of the X+ or X- buttons had any effect. I later discovered that HomeX allowed a further X+ steps (again about 180) before it would stop.

I had no idea what I was doing wrong, fortunately some of the people of the reprap forum pointed out that I was probably activating my endstops and these were preventing further movement.

After tricking the board into thinking it had a normally closed endstop (simply shorted the terminals), I could now cause the motor to move in both directions (home was obviously a bit confused).
Here we see the full test setup, with MicroSD card, Bluetooth module, endstop cheat and stepper motor, power is supplied by 19V laptop brick.

Saturday, 10 March 2012

Stepper testing

First things first, I need to make a cable that can connect from a stepper motor to the connectors on my sanguinololu.

The stepper motors use JST 2mm pitch 6 way connectors, with a similar 4 pin connector for the wires that are actually connected.

The connectors I have installed on the sanguinololu are JYK .1" (2.54mm) pitch 90 degree headers.

I have plenty of the equivalent JYK female connectors and pins to go in them.

I intend to purchase a bunch of pins for the JST connectors, so I can simply reuse the connector, but use longer wires  - a pack of suitable pins from RS is £1.60 for a pack of 50, which should be more than enough at 6 per stepper.

Many years ago when I was into rewiring my beach buggy, I bought a pair of MSD ratchet crimpers that have interchangeable jaws.
I also have various additional sets of jaws, the best tool suited to crimping the pins for the JST connectors according to Rapid (who I bought them from) is this tool which as far as I can tell has the same jaws as these, which I just happen to have.
Some cutting, wire stripping and crimping later and we have a test cable:
The actual wire I intend to use is the same thickness as that on the test cable, it is 6 core alarm flex from Wickes at £9.99 for 50m.

I quickly mocked up the test rig as described on the sanguinololu page of the reprap wiki, power is from a 19v laptop brick for the motor and a LM7805 voltage regulator providing the 5v feed (that's the relocated PIC18F4550 chip in the background).
The sharp eyed among you will notice that the order of the wires on the test cable have changed, this is because I was reading 1A 2A on the sanguinololu board as one coil based on A+ and A for the coil on the motor details, rather than 1A 1B as a coil - wiring is much neater, all straight through from connector to connector.

I make my own breadboard jumper wires by cutting up sections of solid core CAT5 network cable, costs next to nothing and I can have as many as I like of whatever length I want, a 1m cable makes hundreds.

Double checked the coil windings on the motor with a multimeter set for resistance.

Powered up the circuit and the motor just sits there and vibrates, shaft is not exactly locked in place either.

Try turning the trim pot and the noise level decreases and the shaft feels locked in place (not very scientific I know) although the stepstick did become quite warm on the heatsink.

The sanguinololu wiki page implies that I should see 0.500A across the coil windings, I see nothing notable, and my multimeter autoranges and still picked up nothing.

Plugged the stepstick back into the sanguinololu board and connect via Printrun, with a motor attached, I try pressing the X+1, X+10 and X+100 buttons - nothing.

I also tried connecting up my microSD card and reading from that - nothing.

Maybe it's the marlin firmware? reload sprinter and try again - well I can see the microSD card again, so that's a good start, the X movement buttons also cause the motor to turn, albeit with loads of vibration and the shaft is no longer locked when still again.

Looks like marlin still thinks it is on the wrong board type, loads more digging around the configuration required here then.

I have a search around the web and eventually find this post by nophead, which details how to set the voltage via the vref connection (that just happens to be present on the trim pot wiper as well).

Try again with the X buttons, still not happy with the movement, still seems to be skipping and is not locked when still.

Neither the motor nor the stepstick are even warm to the touch, but suddenly the motor stops responding.

I have since checked everything I can on the stepstick, continuity, resistance of every component and pin voltages when live, the only thing different on this board to any of the others is that the others all show the 19V from the power brick on all motor pins, whilst this one shows 10V and 0.25V.

Now from what I have read about these drivers, they should current limit to a maximum of 1A regardless of where the trim pot is set (adjusting merely lowers this figure), and I can't believe I have damaged the motor - all resistances show the same as another stepper.

Currently I am at a loss as to what happened, I have rechecked all the boards for potential shorts and can find none.

On the plus side, I have been reading up on I2C bus at tronixstuff and found that the user Malx has a fork of the marlin firmware on github that uses the LiquidCrystal_I2C Library.

Now this is a much more interesting way of attaching an LCD - 2 pins requires that are already exposed  on the sanguinololu board.

Friday, 9 March 2012

Firmware and Making Fumes

I was browsing through the new items on Thingiverse when I found an item that made use of a screen and referenced a different firmware - Marlin.

I had a quick read and thought it would be worth a try, cloned the github repository, downloaded yet another version of Arduino (0.22), I now have 4 different versions installed!

Adjusted the configuration.h file and compiled - first stumbling block, seems a fair bit more configuration is required, not exactly an out of the box solution!

Some more tweaking of the various pin header files later and we have something that will at least compile.

The preferred serial speed is 250000, so I updated my other bluetooth module to the nearest approximation of 230400 and adjust the Marlin config accordingly, communications work seamlessly.

I was having a closer look at the pins intended for use with the LCD and it would appear that since this code was originally written for use on an Ultimaker, or Arduino Mega based Ramps board, where there are loads of I/O pins to spare, I was going to need to define some alternatives for me to be able to use the available pins on the sanguinololu board that I am using.

There are just about enough available - I need 6 pins for the LCD, 1 for the SD card, 3 for the encoder, and one for the beeper - there are 10 available, so I will have to forgo the beeper.

Pin definitions as assigned in Sd2PinMap.h for available pins as I have chosen to use them are:

Physical Pin #Pin NameAssigned Pin #Use
40A031SD card SS
39A130Encoder 1
38A229LCD RS
37A328LCD EN
36A427LCD D4
5B44LCD D7
22C016Encoder C
23C117Encoder 2
16D210LCD D5
17D311LCD D6

Some of these pins are labelled differently on the sanguinololu board: B4 is shown as D12, C0 as D16, C1 as D17, D2 as D10 and D3 as D11, these can all be determined by looking at the Extension Header section of the sanguinololu schematic.

Having spent enough time playing on the breadboard, I decided it was high time I actually soldered up the board.

I have another ATmega644p chip, so the one I have been testing is still on the breadboard.

I followed the instructions on the Reprap Wiki regarding what order to install the components, but left out all of the ones associated with the FTDI chip.

Looks like my Soldering skills aren't too rusty after all.

Had a few issues soldering the stepstick drivers, solder did not want to stick to the board, or flow down the pins. A liberal application of flux soon sorted that out though along with a load more smoke. 
Finished sanguinololu board with an ATmega644p in place and stepstick drivers installed. 
Hooked it up to my USBasp programmer via the 6 pin ISP header and burnt the bootloader, then attached my serial programmer to the 6 pin TTL interface and loaded the Marlin software.

Replaced the programmer with a bluetooth module and then connected via PrintRun - we can see the board via bluetooth.

You may also notice I have added some legs to the circuit board, these are from my huge stock of spare screws and standoffs from numerous scrapped PCs.

Saturday, 3 March 2012

MicroSD Adventures

My MicroSD adapters arrived in the post today, so I thought I would give one a try.

I moved the PIC18F4550 onto a separate breadboard as I seem to be running out of space for experimentation at the bottom of my current breadboard, plus I want to wire up the MicroSD adapter somewhere close to the pins it actually uses.

7 pins worth of header strip and 6 wires later (using the pinout mentioned in the last post) and I am ready to try it out.
Ribbon cable is only providing power, (plus it is easier to leave the pins for the USBasp firmware programmer connected than work out the correct pins again from scratch), I really must make a USB power cable - I have enough random USB cables, I can afford to cut one up for the job! You will also see the serial programmer still attached but with no USB cable connected.

Fire up Pronterface - promptly fails to start due to wxPython not being installed (previous tests have all been run from Pronsole which is purely command line).

Download and install wxPython and try again, still no joy - seems my Mac Mini is only 32 bit, so needs an additional environment variable setting first "VERSIONER_PYTHON_PREFER_32_BIT"needs setting to "yes" and then it starts without issue.

Connect to the Bluetooth connection, no message saying that the SD card is not present, so that looks good, upload an STL file, nice and fast, rendering takes a few seconds, and then try to save to the SD card - seems to be rather quick, so I check the SD card and there are no new files on it.

Try a few gcodes to access the card reader - M21 - SD Init failed - hmm...

Maybe the card is in the wrong format, so I try reformatting it, still no joy, double and triple check the wiring - all looks good.

I then notice that whilst inserting and removing the MicroSD card, the light on the adapter goes out - perhaps we have a bad connection (after all it is not soldered to the pins), just resting on them.

I lift up the board so that the opposite edge is making contact with the pins and try the M21 code again - no failure response this time, so I try M20 and am rewarded with a list of files from the MicroSD card - success.

Rather than continue to hold the adapter in place, I locate something to wedge it into the current position.

I then try uploading the gcode to the MicroSD card, boy is that slow, I can see why people generate the gcode and load it onto the SD cards from their computers - 39 seconds to generate the gcode file for Pirates of the Caribbean Coin, over 3 minutes to upload it to the MicroSD card via the "SD Upload" button! would be less than a second to upload via a USB adapter to the MicroSD card.

I use one of these:
Cost me £0.99 a couple of years ago, you can pick them up on eBay for about £0.44 now with free shipping from HK or China! Absolutely tiny (25x12x2mm), 10 times faster than trying to use full size SD adapters. and you don't need a media card reader slot either.

eBay sellers in HK and China sell these sorts of things as loss leaders to inflate their feedback and sales history, costs them more in postage than they are selling the item for, so why not capitalise on that sales strategy? I will make up a suitable cable for the MicroSD adapter so it can connect to the Sanguinololu board in the same way as the SDSL, I added a bunch of female 10 pin IDC connectors to my last order from Rapid, they worked out at less than £0.10 each and use ribbon cable, of which I have plenty, although I could just as easily use individual pin connectors.
I am still not happy with my Prusa frame, despite having adjusted it again so that all of the bars are equal lengths and distances from each other, it still does not sit flat, nor are some of the bars parallel or making true squares. I am in agreement with Nophead on his blog, where he analyses the triangular structure, and all but states that it is not fit for purpose.

Still I will persevere with the structure, most of the items I have purchased can be used on another design at some point in the future, at the very least it needs to be capable of producing some replacement parts, or parts of whatever replacement I decide to build, as stated on the opening posts of this blog, There was never an intention for this initial build to be the end goal.