Thursday, 28 April 2011

Alternatives to amazon downloader

I'll keep this short, because I've just spent in excess of an hour trying to get Amazon's official, propitiatory downloader for linux Fedora 13 to work. The problem is that Amazon's binary is dynamically linked to old versions of C++ Boost libraries which are not part of Fedora 13 or beyond. Trying to install the old libraries and all their dependencies is a nightmare.

The solution is Pymazon. It works, its open source, its python (so installing it is a child's play) and best of all it is better than Amazon's official offering.

Also Clamz exists but I've not used it so cannot vouch for it.

Saturday, 16 April 2011

Inverted Pendulum Part I

Foreword (no technical content)

For the best part of a year, I've been hoarding an old Dell Deskjet 720. As printers go, this was a pretty crappy printer. The ink cartridges or 'cash cows' as I like to call them, were only officially available through Dell and therefore very expensive. The Lexmark driver (for it was actually a Lexmark at heart) was closed source and buggy and the print quality was poor. All of these are probably explained by the fact Dell were giving them away free when I bought my first computer about 6 years ago. Here is what it is supposed to look like:
I had been toying with the idea of taking it apart and making something out of the parts but didn't really come up with any good ideas. There are already lots of projects such as RepRap which use printer parts to make rapid prototyping machines or similar CAMs. I don't really have the space or need for any of these at the moment so the printer went un-hacked.

Earlier this week I came across this project - a self balancing one wheeled robot. This reminded me of the inverted pendulum lab experiment which I'd done during my time at Southampton University. Labs generally weren't much fun, but I remember enjoying this one so I set about making an inverted pendulum out of printer carriage and some other parts.

Step 1: Tear-down
So far this has been the most fun part. I'm not sure how people can make those really long winded videos/slide shows of incrementally taking apart their newly bought I phone. Once I started disassembling the printer I soon forgot about photographing anything which is why there is a large gap in the photo sequence below:

This part was quite interesting. Most desktop inkjet printers use aqueous inks. Aqueous inks are volatile and if a print head is left exposed to the air for long (which could be a matter of minutes for some inks) then the water will evaporate from the nozzle plate leaving the less volatile pigments to block up the nozzles. In commercial inkjet printers, a lot of money and effort is spent trying to prevent the nozzles from drying up and becoming blocked between prints. In this Dell printer, there are two suction cups (one for black, one for colour) which are pressed up against the nozzle plate when the carriage reaches the extreme of its travel. Below is a close up of this mechanism. When the printer is switched on, the carriage moves left, pushing the suction cups down and out of the way.

The right end of the transport is shown below. The carriage, which by this time has been stripped down as much as possible, travels along the heavily greased steel dowel.

At the opposite end, a 24V DC motor is coupled to the drive belt. The belt was surprisingly easy to remove. The cog at the other end of the printer is mounted on a spring loaded assembly which makes it easy to remove and fit the belt.

I decided to leave the paper feed rollers in place, since I may find a use for them later. They too are spring loaded, so it is possible to feed fat media, such as a bare PCB through the mechanism without breaking anything.

A stepper motor which I currently know very little about drives the paper feed mechanism.

Step 2: The electronics

Not shown in these picture is a self contained 30V 0.4A power supply which fits into the back of the printer. It has two rectangular contacts which mate with the large steel contacts shown in the right of the picture below. This is the main print controller board which I have spent a little time inspecting. There is a Lexmark IC in the centre of the board which doubtlessly does the grunt of the data processing. The rest of the board is made up of a 1K Atmel EEPROM chip, two switch mode power supplies, a status LED, ribbon cable to carriage, stepper motor controller and DC motor controller. In the top left of the board is a photointerrupter which, coupled with a plastic flange, acts as the product detect, to notify the print controller that the leading edge of the paper has arrived at, or a known distance from, the print head.

The second and much smaller board is mounted behind at the rear of the carriage. It is linked by a flexi-pcb. This board has a single IC marked SC90105 which is about all I could deduce. I couldn't find a datasheet for the part so I can only guess at what it is for. Since this board connects directly to the electrical contacts of the printer cartridge, I'd guess that this is a shift register with high current outputs for driving the individual nozzles. I'm more used to working with industrial inkjet print heads, which are much different.

The black plastic block on the right is an optical, quadrature linear encoder. It has a slot through which the linear strip passes. The strip is printed with black bars to interrupt the photo beam inside the sensor. This is the part I'm most interested in, as I need to be able to track the position of the carriage in order to keep the pendulum near the centre of the transport.

Before disassembling the electronics any further, I powered up the electronics, outside of the printer confines, from my bench power supply. I was forced to power it at my power supplies limit of 20V, instead of the 30V it is designed for, but fortunately this was not a problem since I was only interested in the logic level signals. More of a problem was the 1mF capacitor on this board which caused my power supply to current limit for the best part of a minute while it charged up.

I concentrated on the encoder, trying to work out the pin out by viewing the signals on a scope whilst moving the linear strip. Once I acquired some extra hands, this was easy. The part has few markings and none that correspond to a data sheet. For this reason I post the pin out below:

The pitch of the encoder connector is not quite 0.1" so I was forced to straighten the right angle connector to lengthen the contacts enough to fit into standard strip board. The result was fairly neat and is shown below.

I did a quick test to check that the encoder could still travel unhindered along the rail.

The outputs of the encoder are either low voltage CMOS 3V3 or NPN/PNP. I'm not sure which yet. Now I have abstracted the encoder from the rest of the printer I can hook it to an MSP430 microprocessor and begin work on decoding the quadrature encoder outputs. I've done this on an FPGA before but not on a microcontroller. Should be pretty straight forward though. The board on the left is an old IO board from the Student Robotics project circa 2006.

Its been a while since I've done any electronics and some of my tools were showing signs of neglect. It turns out that an old Brillo pad is a great stand-in for a proper soldering iron sponge. The impregnated soap makes a difference from the usual soldering smell.