Saturday, 22 December 2012

Prusa i3

Well I am still not happy with my Prusa frame, but I have not completely given up on it yet.

I have glued the Nylon Screw Insulators into the various holders and glued these into the X axis ends, these slide reasonably well along the smooth rods, but will probably be better with a little silicone spray or light grease.
I have also bought a set of printed Prusa i3 parts for £25.00 + £4.00 P&P on Ebay  which I did not think to be a bad price, no extruder, but I am not bothered about that and if anything am happy to be spared the cost.
One of the things I like about this printer, and some of the other recent printers (Mendel 90, Quantum Ord Bot, Printrbot, etc), is that the Z axis steppers are at the bottom, adding weight and stability where it is required, rather than at the top where they are simply adding to the instability of the frame, with potentially pendulous mass and vibrations high up on the frame.

Another thing I like about this printer is the relatively small number of printed parts and all of the other parts are low cost and easily obtained, I believe this will actually be a fair bit cheaper to build than a Prusa i1 or i2.

I believe the parts are those shown as the JoFinal set on GitHub and can be seen here used with this laser cut SeeMeCNC frame:
The frame and bed is not a bad price at $32.00, however shipping to the UK would be more than the cost of the frame, making it a bit expensive, now if someone were to offer these at around £20.00, then I am sure they would sell well.

The metal version of the frame can be seen here, however this is never going to be cheap when a 500x500x6mm sheet is around £40.00 including shipping before any cutting.
The printed parts require a little work as they do not all fit the bearings, rods, etc quite right, and the captive M5 nut has no hope of fitting in the X motor end and idler, so some work required there as well, but I am generally pleased with the parts, on the plus side the holes for the motors all line up well.

As a result of this and also wanting to make use of some T2 belts from various printers I have scrapped, they just happen to be the compatible with the drive gears that came with my stepper motors, so no additional cost, but I need to adjust the sizes of the bars and boards in order to make use of them. So I modelled all the parts in Sketchup and adjusted the bar lengths and axis locations until the belts I had would work.

The print area is 215x215x250mm despite the footprint of the printer being smaller than the official dimensions, I don't really see the point in making the axes any longer/wider, it just means longer belts and rods for no real gain in print area unless you want to print serious overhangs beyond the "standard" heated bed, or make a much larger heated bed yourself.
The Bowden extruder is a variation on the Eventorbot extruder.
Here is my version, it is intended to be made from a single block of aluminium, but could just as easily be printed, again the drive gear came for free with the stepper:
The Hot end is a variation on the Huxley Hot End
Here is my version, which uses 3mm filament instead of 1.75mm, mainly because I already have suitable pneumatic fittings for this size of tubing:
The nozzle is from a set of LPG gas jets, the heatsink and fan are items that I have from my collection of old PC hardware (remember never throw anything potentially useful away :o)

I ordered 10 x LM8UU bearings for £3.24 and free shipping from a Hong Kong seller on Ebay, these arrived quite quickly, although unfortunately the package was damaged in the post and 2 of the 10 bearings fell out and were not received. The package when it arrived was enclosed in a plastic bag from the Royal Mail apologising for the state of the package - I am taking the matter up with the Royal Mail and the vendor.

I also ordered 10 x 624ZZ bearings (4x13x5mm) for £4.80 + £0.90 P&P, as these are used instead of 608ZZ bearings (8x22x7) with these printed parts, some 5mm studding at £0.46 a meter, and additional nuts, washers, etc, from Orbital Fastners (I needed to buy some other stuff from them anyway so now was a good time to place the order, especially as it is free next day delivery on orders over £20.00).

The board I intend to use is melamine coated MDF from Homebase at £7.99 for a sheet 1200x220x15mm. If I cut this down the middle and then into the lengths I require, it should be perfect, and just one or 2 cut edges to worry about sealing. I can also use it full width for the Y bed.

Wednesday, 10 October 2012

Panelolu

I was having a look at the various Panelolu designs.
More specifically at how to wire one up at the Think3dPrint3d website and decided that I needed to have a go at simplifying the wiring for use with an I2C connected LCD.

I am not using an SDSL per se, but an off the shelf Micro SD card reader that is a fraction of the cost (£5.84 vs £13.20 inc P&P)

This could potentially be done even cheaper with a standard SD card reader that can be had for about £1.14 from Ebay
If I believe I can use just 12 pins for all of the panel connectivity. If I use a couple of Dupont 2x3 connectors, then the other pins will still be available for any other uses that may come along, as they can stack side by side.
The great thing about Dupont connectors is that they are easy to change pinouts - just lift the flap that holds the pin in place, pull out the pin and move it to another slot. If you have any cables with single ends, 1x2, 1x4, 1x6 ends, you can easily change it to a different configuration if you have the appropriate connector or simply want to change the arrangement of pins from one end to the other to quickly make a custom cable.

Typical prices for Dupont pins and connectors - all prices from Ebay

100 x female pins £1.90
100 x male pins £2.25
100 x 1x2 pin connectors £1.63
100 x 1x3 pin connectors £1.63
100 x 1x4 pin connectors £2.25
100 x 1x6 pin connectors £2.25
100 x 2x3 pin connectors £2.32
40 x 1 pin female - 1 pin female wires £1.21

I use a ratchet crimper with replaceable jaws, but you can just as easily use a pair of needle nose pliers instead.

Here is the Schematic I mocked up, you will see that the PCF8574P chip handles all of the connectivity to the LCD.
I intend to use 90 degree header pins on the LCD panel and some 1x6 Dupont connectors, connection to the Micro SD board is again 90 degree header pins, a 1x6 Dupont and a 1 pin Dupont or 1x3 pin and 1x4 pin (as I need 7 pins) - total cost of connectors (3 x 1x6 connector, 1 x 1x1 connector, 2 x 2x3 connector, 30 x male pins) is about £0.80, with another £0.08 for 90 degree header pins.

Encoder - £6.19 for 10, Pots - £1.41 for 10, switch - £0.08, 2004 LCD - £4.24 and some perfboard.

If you can make do with a 1602 LCD, these can be had for £1.34.

So total parts cost for I2C Panel about £2.60 (includes cost of PCF8574P) , then add either Micro SD or standard SD, 2004 or 1602 LCD, and price varies from about £5.00 (standard SD and 1602) to £12.50 (micro SD and 2004) all in.

OK, the STL file for the panel may also need a little tweaking for my internals, but overall should be pretty simple to do.

Sunday, 7 October 2012

ATmega1284P, Marlin and I2C

I bought a few items from RS on a visit to their Hounslow branch and revived my account that had been dormant for nearly 10 years!

JST 2mm pitch 6 way connectors for running new wires to my Steppers (50 pack for £3.30)
Crimp Contact Pins for the connectors (50 pack for £1.60)
ATmega1284P-PU Microcontroller (£4.55 each)
Nylon Screw Insulator Rail bushings for my cast Prusa parts (50 pack for £3.67)

Not all parts were in stock at that branch, so I arranged for out of stock parts to be posted to me (one of the perks of an RS account is that the postage is free).

RS are often not the cheapest, but they do have hard to locate parts, like the JST connectors, and I do not need to worry about building a large order to offset postage costs of places like Rapid or Farnell.

The ATmega1284P from RS is half the price of the cheapest one I can find anywhere else - cheapest I can find is on Ebay for £7.99 with £1.20 postage.

I replaced the ATmega644P chip on my breadboard with the new 1284P chip, updated the settings in Arduino for "Mighty" and burned the bootloader and then uploaded the latest version of Marlin that actually compiles with a current version of Arduino (1.0 or 1.0.1) - all good so far.

Dowloaded the LiquidCrystal_I2C library and put the files in the relevant Arduino directory, then started splicing it into Marlin, very little to it as it happens - every file that has a reference for LiquidCrystal just needs to have an equivalent one for LiquidCrystal_I2C added.

Configuration.h

change
//LCD and SD support (Manual definitions if not using ULTIPANEL)
#define ULTRA_LCD  //general lcd support, also 16x2

to
//LCD and SD support (Manual definitions if not using ULTIPANEL)
#define I2C_LCD 0x27  // I2C LCD Panel (overrides the LiquidCrystal library with LiquidCrystal_I2C) - value is I2C Address for LCD
#define ULTRA_LCD  //general lcd support, also 16x2

ultralcd.h

change
#include <LiquidCrystal.h>

to
#ifdef I2C_LCD
  #include <LiquidCrystal_I2C.h>
#else
  #include <LiquidCrystal.h>
#endif


and
extern LiquidCrystal lcd;

to
#ifdef I2C_LCD
  extern LiquidCrystal_I2C lcd;
#else
  extern LiquidCrystal lcd;
#endif

ultralcd.ino

change
#include <LiquidCrystal.h>

to
#ifdef I2C_LCD
  #include <LiquidCrystal_I2C.h>
#else
  #include <LiquidCrystal.h>
#endif

and
LiquidCrystal lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7);  //RS,Enable,D4,D5,D6,D7

to
#ifdef I2C_LCD
  LiquidCrystal_I2C lcd(I2C_LCD, LCD_WIDTH, LCD_HEIGHT);
#else
  LiquidCrystal lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7);  //RS,Enable,D4,D5,D6,D7
#endif

Then re-compile and upload to the bigger ATmega1284P chip.

Everything worked fine, except that when I connect to the chip from Printrun, the printer no longer comes online.

Now this could be because I don't actually have a connection to an I2C chip or LCD display at this moment in time, I will have to wait until I have one to prove one way or the other.

I have a bunch of 8 bit I2C Expander chips on order (10 x PCF8574 for £3.71) but they seem to be lost in the post at present, looks like I will need to have the Ebay vendor resend them.

An alternative, but slightly more expensive option is an I2C LCD interface board.
These can be had on Ebay for as little as £2.44 each, I can wire my own for about £0.70 with the chips mentioned previously (37p for the I2C expander, 3p for the transistor, 25p for the potentiometer and a few more pennies for the pin headers and some perf board).

The main benefit of using the I2C version is that only 2 pins, SCL (D16) and SDA (D17) are required, along with a 5V and GND, and these can be spliced from any existing supply pins, compared with 6 dedicated pins for running the LCD directly.

In addition, any other I2C devices can be added with no extra pins being required as it is a bus based technology.

A unique address for each I2C device, which can be set by choosing which of the 3 Address pins are connected to 5V on the 8 bit I2C Expander:

Address pins A0, A1 and A2 make up the last 3 bits of a 7 bit binary number, so the available range is from 0100000 (32 decimal or 0x20 hex) - 0100111 (39 decimal or 0x27 hex).

Typical connectivity to an LCD panel as follows (image from Pavel Bansky's website):
I don't have any BC548B NPN transistors, plus they are end of life anyway, however I do have a C945 which should be a close enough substitute, but since this is only really for adjusting brightness I will probably just connect it to either a resistor or a potentiometer and adjust manually.

I also ordered some stepstick A4983 units from Ebay, these ones do 1/16 microstepping and are only £4.43 each, so nearly half the price of the previous ones I bought from Denmark and free shipping from China.

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.

Wednesday, 22 February 2012

Wireless communication success

Well after loads of trial and error and lots of searching on the web, I am finally able to talk to the ATmega644p chip on my breadboard via a bluetooth connection.

There were 2 issues:

First, I have no RST pin on my bluetooth module, so I had to find a way of generating one.

This involved attaching a wire to the place where the "status" pin would be connected (basically looped through from the status LED, that actually connects to pin 32 of the HC-05 board that is soldered onto the module) then connecting this via a 1uF capacitor to the reset pin of the ATmega644p.

Now when I power up the board, initially both the ATmega644p and the BT module flash until a connection is established.

Once a connection (like from Printrun) is made, the capacitor delays this connection to the reset pin allowing the chip to reset one last time and then keep that pin held high and allowing programming to happen.

Second, I had the RX and TX pins connected backwards, once this was sorted, Printrun was able to see the "printer" as online. It would seem that these pins are connected differently to my CP2102 programmer, despite being labelled the same.

Still I have never known any harm come from connecting these the wrong way round, and often found this to be a suck it and see exercise to locate the correct orientation of the 2 pins - TX-TX and RX-RX never actually achieves anything - 2 sides attempting to talk on one pin but both listening on the other.
Further tests have shown that I don't actually need the status pin connected for Printrun to talk to the chip, if I had sorted problem 2 first, I would have noticed this sooner, though it may still be required for wireless re-programming should I feel the need to do this from avrdude or Arduino.

I have been having a closer look at the Sanguinololu schematic:
I am wondering if one can get away without needing to install the FTDI chip at all, especially if you have access to an external serial programmer like the CP2102. all the pins for the USB2TTL connector loop through to the relevant pins on the ATmega644p chip, and all of the pins required for flashing the bootloader are available via the 6 pin ISP header (also used by the SD board).

This would mean a potential saving of 5 components:

IC100 - FTDI chip
PS1/PS2 - USB connector
C8, C11 & C15 - 0.1uF Capacitors
C16 - 4.7uF Capacitor

The FTDI chip and USB connector are the most expensive components on the board after the Stepper drivers and the ATmega644p chip, a programmer like the CP2102 can be had on eBay for as little as £1.83, the FTDI chip alone costs more than that, and without it, there is no SMD soldering required at all.

I have since seen this confirmed by some of the postings on the forums, though it is far from obvious on the Wiki, or the github home of this product.

I have ordered a couple of microSD card adapters:
These worked out at £5.84 each including postage, which is only slightly above the bare board price for SDRamps, just over half the price of a populated SDRamps and about a third of the price of an SDSL (Sanguinololu version).

It also has a built in voltage regulator, so works with 5V or 3.3V (same as SDRamps and SDSL) and will use the same pins on the ISP header (actually only 6 of the pins used by the other boards are required anyway), despite them using a 10 pin connector:

SanguinololuADPmicroSD
5V5V
GNDGND
MOSIMO
MISOMI
SCKSCK
A0CS

Saturday, 18 February 2012

Delta Robot

Just for giggles, I thought I would have a go at designing a delta robot, I have no idea how stable it would be, or if it would be anywhere near accurate enough to use as a 3D printer, or even a pick and place machine.

I was initially inspired by a couple of designs on Thingiverse, the Yazoo Polybot:

the Yazoo Polybot - Cranberry Edition:

So I came up with the following:
Which after some further tweaking and looking in detail at several commercial items it became the following:
Every time I see one of these, I can't help thinking about Jeff Wayne's "War of the Worlds" and the tripod like exo-skeletons used by the alien invaders from Mars:
Anyway, I have no idea if I will even build this, it does not look too expensive to build, EMC supports Kinematic coordinates, I intend to build a bunch of PMinMO TB6560AHQ based Stepper drivers:
I already have all of the parts, and recently placed an order with ITead Studio for some of these boards ($9.99 for 10 boards of less than 5cm x 5cm - Spring Festival discounted price), so the total cost of each board including all of the parts will be £4.35, the cheapest equivalent one I can find on eBay is £12.01.

These drivers with a different set of power resistors (I have 0R22 currently, which will allow 2.27A, I have some 0R15 resistors on order which will allow 3.3A) will be used on my PCB CNC Machine.

A recent addition on Thingiverse is the Rostock:






Bootloading and Arduino

My USBasp programmer arrived in 3 days (wow that was fast), seems it came from a supplier just down the road from me, rather than direct from HK.

I downloaded and installed the Arduino 1.0 software, downloaded and configured the Sanguino add-on software, connected up the programmer to the breadboard, select the relevant options in Arduino and attempt to upload the bootloader.

Well it barfed a lot but I think (after much googling) that it may have worked - no "successfully uploaded" messages, just a long pause, stops and then displays a load of messages about "pipe stalled".

I connected up the debug led to pin 1 and on power on or pressing the reset button, this flashes a couple of times - this apparently means that there is a bootloader present - yeah finally some progress.

I also located some newer information relating to using this version with an ATmega644p at maniacbug's blog, along with a link for a version of the bootloader that will actually compile, since none of the other ones I can locate will.

Next, I download sprinter from github and attempt to compile/upload this to the newly bootloaded chip.

First hurdle - Arduino has had a major rewrite for version 1.0, and it would seem that the Sanguino and reprap community are somewhat behind the curve here.

Downloaded Arduino 0.23 as this supposedly works with the most recent version of Sanguino, more tweaking, still no joy, bootload from this version fails outright as well.

Apparently I am not alone with having issues with this version.

Downloaded Arduino 0.18 and the appropriate version of Sanguino for this, well these actually compile the sprinter software, so that in itself is progress,

The only version that seems capable of uploading the bootloader is 1.0, and the only version that will compile the software is 0.18 - oh joy.

Also version 0.18 of Arduino does not support the upload of software via the programmer unlike version 1.0, so a serial programmer is required.

I have one, a PL2303 USB to RS232, however it does not have a pin for connecting to the reset pin of the ATmega644p chip, so another programmer is required, a CP2102, that is more compatible with AVR chips:
A massive £1.82 spend on eBay and a few more days wait later and I have the item and can hook it up to the board.

My Mac does not recognise it, so a quick search for a CP2102 driver, which I located at Silicon Labs website, install and restart - hey presto we have a new serial port called SLAB_USBtoUART that I can select within Arduino.

Some minor cabling updates to the breadboard and we try again - fails with stk500 errors cannot communicate.

A bit more googling, and find a work around that suggests pressing the reset button 4 seconds after selecting the "upload to board" option from the software - this seems to have the desired effect, the debug light flashes quite a lot at varying speeds and eventually stops.

Again, no nice "your upload was successful" message, but I believe it did actually upload something, so let's test if we can talk to it.

Locate my installation of Printrun and fire it up, then after I locate the correct syntax to connect to my specific serial port, it claims that the printer is set up - wahey looks like we made it.

Now you may ask - "why go to all this trouble and not just solder up the board already and then program it via the USB port like everyone else?"

Well, partly because I don't actually want to use the USB connection, I want to talk to the board via bluetooth, and if I solder the USB connector, it will prevent me from soldering on the pins for the TTL header, and partly, just to see if I can.

I bought a couple of Bluetooth modules from  eBay, £11.70 for two:
so much cheaper than the BlueSMiRF items from Sparkfun Electronics at $64.95 a piece!

I may yet find that the cheaper items cause issues, but we shall see, serial communication should only need transmit and receive - hell, I used to use a broken paperclip to cross connect RX and TX between the B serial port of one Sun Microsystems Sparc 5, 10, 20, etc machine to the A serial port of another to provide a makeshift console (no other pins connected), provided you selected the correct baud, parity, data, stop bits, etc it worked just fine.

My Mac Mini and my work Windows laptop can both see the Bluetooth module quite happily, I just need to connect to it via something like putty and change the baud rate to something a bit faster than 9600, this was achieved by connecting it to my PL2303 adapter and then issuing some AT commands via copy and paste (as you can't type them fast enough on a keyboard).

Printrun can connect to the bluetooth device, however cannot confirm the printer as online, let's wait and see what it thinks when we actually have a FTDI TTL chip sat in between the ATmega644p and the Bluetooth module, when the Sanguinololu board is all soldered up.

As a side note, I also discovered that if I have any kind of USB connection to my breadboard and connect up the 5V line, I don't actually need the voltage regulator circuit, as it will be provided by the USB connection.

Sunday, 29 January 2012

DAPA bootload the ATmega644P - Ah...No.

Having built myself a breadboard Sanguino in order to apply a bootloader to the ATmega644p, I decided the quickest way forward would be to build a parallel programmer or DAPA, I mean how hard can it be? a male DB25 and a couple of resistors right?

The inspiration for this came from a couple of places: Arduino website and the Reprap wiki.

Well I already have all of the required parts, one of many headshells I just happen to have lying about (I hoard and almost never throw anything potentially useful away - drives my wife nuts :o)

I like these head shells as you can wire them up however you like and then just connect them together with standard network cables, allowed me to carry all modem/terminal male/female DB25/DB9 combinations with just half a dozen head shells and a network cable (very useful for serial communication between unix boxes or for console access, just build the cable you require from 2 head shells and a network cable).

Here are the parts required for this little project:
Solder the resistors into the middle of 3 of the wires and cover with heat shrink to avoid shorts once it is all assembled.
Push the pins into the required
This one actually actually takes RJ11 connectors, and only has 6 pins so I replaced the outer shell with one for an RJ45 connector no point wasting pins unnecessarily (they are pretty modular) as I don't actually have any RJ11 connectors to hand, but do have some network cable with an RJ45 attached (some previous project) I do have a crimp tool for this if I actually needed to make it from scratch.
Connect it up to the breadboard, ignore the setup on the left, that is a PIC18F4550 also awaiting programming it will become a HID keyboard for my Mame cabinet.
I also make use of sections of the network cable as jumper wires for the breadboard - saves buying specialised cables, and I can have as many as I like and cut them to whatever length I like pretty much for free as I just happen to have loads of this cable (did I mention I hoard?).

Well the power source became a bit of an issue - I bought a Skytronic 0-40V bench top power supply a few years back on Ebay, however beyond turning it on I never actually tested it, turns out it has a fault somewhere - it turns on and displays 0.5V, but you cannot increase or decrease the voltage.

I took it apart and found a loose wire that was not pushed into its header correctly, however even after pushing it back in, it still won't put out anything other than 0.5V (something to troubleshoot further another day).

So on to a different power source option, I have a couple of transformers that powered our last set of DECT phones (recently replaced as they had pretty much stopped working), they have 4 wires in the cable and supply 7V in both AC and DC, so 7V DC it is as the input, just need to reduce this slightly to 5V and we are good to go.


Add a quick voltage regulator circuit (see the datasheet for the LM7805) and we now have a good 5V supply (about 20p worth of parts and all re-useable as none were soldered).

Install the Arduino software on my laptop, add the Sanguino host software, download and install the giveio.sys lpt driver, select Sanguino with ATmega644P as the board type and Parallel Programmer as the Programmer and hit Burn Bootloader.

Oh dear - can't open the lpt port - giveio won't start, even if I try manually as administrator I get error 1275 driver has been prevented from loading. After much searching and trying various work arounds, all to no avail, it seems that Windows 7 (and Vista) 64 bit operating systems will not allow unsigned drivers to load.

So much for that approach, my choices now are install an old O/S, just so I can bootload this microcontroller, or bite the bullet and actually spend some cash on something current that can do the job.

Well no harm done, all it cost me was some time and a few pennies worth of parts. I have now decided to use an USBasp programmer and whilst I could probably make one, I doubt I could even buy the parts for anywhere near the cost of the one I ordered from Ebay at £2.69 and free postage from Hong Kong, hopefully it will arrive in a few days and we can try again to stick a bootloader on the microcontroller.