Instant Digital Camera

I had read that it is easy to hack nintendo gameboy cameras, e.g. this seattlerobotics article. I figured that a good first project would be to make an instant digital camera - that is, attach a printer to the camera.  Since digital printers are soo good, trying for quality is a losing proposition.  I took the other route, using a printer that I grabbed off of a calculator, allowing 12x12 resolution.  Below is the camera, you can see an image of me taking a picture of it with a real camera.

Here is a closeup of the screen.  The bars on the bottom left are an exposure histogram.

Here is the print.  I use double-strikes for the darkest regions, empty for light, and single-strike for inbetween.

You can see that correspondance between the print and the screen, but at this resolution its just abstract.  Here are a couple prints of your humble narrator.

Getting the printer to work was a lot of fun.  The print wheel, which you can see below, has the numbers and symbols engraved on it.  Once per revolution, the paper feeds one line.  By firing a hammer at just the right moment, you make the mark of a particular character.  Actually, you can see below that there are only three solenoids, so there are 48+ firing positions, as each solenoid covers 4 colums with 12+ characters apiece.  Fortunately, the printer provides a timing signal for each position; its just a matter of mapping signal position to character.

The solenoids don't actually fire a hammer.  Instead, they move vane out of the way, enabling the firing of a spring-loaded hammer when the rotating cam comes into position (more clearly visible below).  Also, after each linefeed, I need to move all of the vanes (fire all of the solenoids) for a few milliseconds else the vanes get jammed on the hammers.  I don't know the reason for this feature.

Controlling the gameboy camera is kind of tricky, since the documentation is really substandard.  I downloaded some example programs before coming up with a collection of settings which kind of work.  The code for my camera is here, it includes a fair amount of testing code that I used to get a reasonable set of parameters.  I settled on some moderate edge enhancement since I want to show faces (we look for lines, e.g. around the mouth, nose, and eyes, to detect faces).  I also do some exposure adjustment.  If you read the code, you'll see that I use the AVR's A-to-D conversion.  Unfortunately, its a bit slow, a faster d2a chip would have allowed for a better frame rate.