Friday, November 27, 2009

Mine is bigger than yours

Finally got my new big stepper motor. It was bigger than I had realized and took some effort to mount to my system.

Then I learned to drive it. Turns out my greatest enemy is inertia. What I've built is just so damn heavy and massive I can't just start off the motor at full speed. Being a half-assed physicist I should know that already. But I guess experience is also needed.

So to get the motor running properly - careful speedup, slowdown and backslash delay at return need to be coded. Actually. I'm making this all up as I go, don't have any formal education and doing inertia calculations seems like a pain. So I try and see what works.

But basically I need to reduce weight. All that steel and heavy aluminium beams I'm moving along take a lot of effort. And cause excessive shaking of the whole machine resulting in some jitter at the printed page. Also the HP printer carriage is designed to slant forwards and backwards at different stages of the rail. The movement of the whole assembly though causes it to shake at the wrong places, more distorting the printed page.

However. It's not all that bad. Please enjoy my latest print:

The page is starting to look pretty nice:

Saturday, November 14, 2009

Chariots of Fire

I added my old USB chip (FT 232RL) to the game so that I can both control and get diagnostics from the microcontroller. The MCU runs at 20MHz now and I think it wouldn't keep up with the printer at any slower frequency. Getting diagnostics allowed me to plot the main roller/motor movement sequence:

I had a lot of trouble figuring out when to turn the paper sensor on. To understand what the printer does I had to rebuild the old printer from the pieces I had. And I discovered that there's a lever that is pushed when the printer head moves to the very right. When this lever is pushed - no paper is fetched if the roller turns. And paper fetching is actually done with roller turning backwards. But adding another sensor is a pain so I just deduced from the roller movement when it expects the paper sensor to turn on.

This happens when the roller moves backwards, then sits still for 450-600ms, and then moves again backwards. A few cm after that I will turn the paper sensor on and printing commences. The paper-on period is between the two vertical tics on the image.

Another thing I discovered is that the printer is, well, too fast for my rig. It scrolls paper through at mindnumbing 12cm/second. While my rig can probably do 2-3cm/second. However I can control this by printing my stuff inside a box/frame. That forces the printer to slow down. But even that is not enough, the edges get distorted due to slow movement. I need a stronger stepper motor.

This shows my completed rig, with everything I've built so far attached:

There were a few quirks getting the printing working though. Had to add a few hacks. But after some fiddling it finally started working.

The printed page from this video looks like this:

It is a bit fuzzy but it's mostly down to the printer head being too much distance away from the paper surface, paper being slanted and also the print head itself is slanted. So lots of fiddling to do to get to better quality.

Phase 1 successful. I need to give this project some rest now as I've lagged behind my other responsibilities.

Thursday, November 12, 2009

Progress

I can report some progress. The paper jam errors I got before are over. Printer now properly initializes, cleans itself and goes into idle mode. The problem was with my motor response timing and the way I had coded it. Fixed now. I also modularized my designs so everything goes through the energy chain now.

Initialization sequence can be seen from this video:

Printing still does not work though. When I try to print I eventually get a paper/cartridge jamming error. But what I've got now is I think a purely software problem. Will have to try new things again to resolve this.

Update-update. Now I get an out-of-paper error. Yay. Need to figure out now when to turn the paper sensor on. But first I'm going to get some diagnostics.

Reverse engineering

So after the hassle I decided to reverse engineer the optical paper roller position sensor so that I can fake it digitally. I attached a set of wires to it to see what was happening:

After running oscilloscope I determine what each wire did. Only two of them had a changing signal when the wheel turned - we've got a 2 channel encoder. This is what the wires represent:

  • BLACK (pin 1) - ground, 0V
  • BROWN (pin 2) - channel 1
  • BLUE (pin 3) - +5V
  • RED (pin 4) - channel 2
  • ORANGE (pin 5) - +3.3V
  • YELLOW (pin 6) - the other side of the LED

The sensor has pretty much the same layout as Avago's AEDS-965X. Here's a picture off that item's PDF file:

So what was left was to desolder the sensor and attach proper wires I could fake my own signal on:

Now with wires there I could start generating a circuit. I spent a better part of the night trying to make it work. It tended to just crash the printer. Finally I realized it was an electrical problem - I was drawing way too much current from the +5V source - apparently there's a really weak current pump behind it.

I also realized that my motor-on sensor was not working 100%. After fixing that it started working like a charm. Here's the basic circuit I used:

So can I print stuff now? Not really. The printer has some really fancy mechanics inside of it. I think it runs the motor at several power levels and expects it to get stuck on some gear or lever. As that doesn't currently happen it eventually ends up in an error. I'm not really sure how to fix this properly as I didn't take any proper measurements or recordings on how the printer actually is supposed to behave. There are lots of gears and systems inside it and I didn't really investigate how they all work in unison.

So more to do. Perhaps I still do need a second version of that printer so that I could properly observe its workings in its prime to replicate them.

But all in all I believes this reverse engineering and sensor faking was a success.

Wednesday, November 11, 2009

Driver

Finally my stepper driver arrived. Now I don't need to use my own home-grown driver circuit.

The benefits are: DIP-switch controllable current (up to 4.2A, my own circuit only does up to 1.5A) and sub-stepping up to ludicrous levels (using Allegro A3955 I get only down to 1/8 steps). And it's very easy to use. Just plug it in and it does its work. I just have two pins to worry about - direction and pulse. It steps the stepper itself. The downside of course the price.

Unfortunately the speed I hoped for did not really materialize. If only slightly. Currently I'm unsure if it can keep up with what the HP control circuit expects. If not - need to get a better stepper motor. But that's easy - just need to plug it in, driver takes care of the rest.

And on another note I found out why my printer got paper jam errors. The contraption to move the sensor was just not fast enough. I down-geared it by around ~1:4.45 because the encoder wheel has 1200 dashes while my stepper does 400 steps. Instead I should have relied on sub-stepping the motor and attached the encoder directly. If I overdrive the motor I can almost get it to work. It even started scrolling out the paper when the paper sensor was on. But its checking systems move it forw-back very sharply and the stepper tends to jam on that.

I don't feel like rebuilding the stepper thingie right now so am instead reverting to reverse-engineering the sensor. I've already attached wires to it and it seems to indeed be a two-channel system. Though I haven't really got the sense of all the pins, only two of them seem to have any sensible life in them as can be seen on the following picture:

As you can see the green leads the yellow - two channels being covered by the encoder strip as it moves.

Tuesday, November 10, 2009

Remote sensing

The printer's paper motor runs on 32V. To get the signal from that I'm going to use an optoisolator. But the motor can run both ways and so I need to protect the LEDs inside the optoisolator from the huge reverse voltage.

Now I'm not absolutely certain this is the way, but I went with protecting them using another diode plus adding a big resistor to take care of the reverse current still leaking through.

And this is the resulting circuit. Seems to work fine so far. The optoisolator I'm using is HCPL 2631.

Unfortunately I can't report success yet. I get paper jam errors no matter what I do at the moment. Have to investigate more. Perhaps the stepper is too jumpy. Or too fast. Or too slow. I think I need to get another printer of this kind to get a solid reference and make a comparison.

Monday, November 9, 2009

The fifth wheel

I have a problem. The paper roller of the printer has an encoder wheel attached to it. So the printer uses that to determine how much it has scrolled the paper on. It's all driven by a simple DC motor.

Now as I don't have the roller anymore but I move the printer itself instead. How do I tell the printer board how much it has moved. I basically have three options:

  • Attach a roller to the side of my table and have it roll on something. While it seems simple and straightforward I see several problems. For one making such a mechanical system is actually not that simple. Secondly I want to move the printer around myself, as it needs to move backwards. If the printer board sees it - it'll detect a malfunction and panic. Also the printer logic has some redundant roller moving on itself - its head cleaning cycle for one - I don't want to move for that.
  • The second idea would be to reverse engineer the sensor and feed the printer with fake electrical signals. The problem here is that I have not managed to find a specification for this sensor. And as I'm not familiar with them I don't really know where to start. It seems to have 6 leads. Two are probably for the emitter led, and the others are probably two pairs for two phototransistors. So it's probably a two-channel sensor.
  • The third and the silliest option is to use a separate stepper motor to drive the encoder wheel myself. So I can fake it for the printer properly. And that's what I've done for now. Later on I should try reverse engineering the sensor itself using an oscilloscope. But for now, I went with the silly solution.

Here I used the timing belt of the actual printer's paper motor. But I reassembled it between two aluminium pieces. The stepper motor is the same I got off eBay.