My Three Sons; Mike, Robbie, and Chip

A project log for HP 82240B IR Receiver and Printer Interface

This is an IR receiver and interface for adapting a commodity receipt printer to be 82240B-compatible.

ziggurat29 3 days ago0 Comments


I was tired of waiting for my printer to come in from China, so I bought a similar one that ships statewide. Then I realized I actually had a printer on-hand all along from a project some 4 years back. No sooner than I dug up the old printer, the other two arrived the same day. Sheesh. So now I have an embarrassment of riches.

Now, I mount the printers and do intial tests with the integrated system -- finally!


In impatience to receive my printer module, I went back to eBay and looked to see if a similar module is available from domestic shipping, which should take less time. There was, and not for not much more cost. Further, as best as I can tell, this is the more premium module on which the other module claims compatibility. This is the APS EPM203-MRS. Moreover, I could find a real datasheet on this model. Still, it would take a week or two to get it in.

Well, this morning (Friday; sorry, late post. It takes me more time to compose these posts than it does to do the work on which I'm reporting!) I awoke with the realization that I actually already have a thermal printer from a project I was doing for a client some 4+ years back. That was a 'Kashino CSN-A2-T'. I did dig that up.

Then when the mailman came, a miracle: both my domestically ordered APS module /and/ my Chinese 'GoojPrt' module arrived! Yikes! Too many printers! Here they are:

Mike, Robbie, and Chip -- err... 'Kashino', 'GoojPrt', and 'APS EPM203-MRS'.

They all three have 'TTL' serial, which I measured to be 3.3 V logic (happily; so I don't have to add level shifters). Howver, the Kashino out-of-box only does 'hail, Mary' style serial, and by that I mean there is no flow control. I can open it up and hack it it onthe controller board (it's there), but the Kashino is now less relevant since my other modules came it.

To my dismay, the APS printer module is just the module -- no connecting cables! Yikes! But there was unexpected hope, because the GoojPrt did come with cables. Here is the 'unboxing':

Fortunately the important connectors are the same on the GoojPrn and the APS, so the Gooj wires will work in both instance. And... since I need to solder the other end of the cable to the controller board, and since the wires are pretty long as it is, that means cutting each in two. So, another set of cables! Yay for wasting money on too many printer modules! I cut the cable assemblies and soldered some pin header terminations on one pair, which will be convenient for me to stick it in a breadboard and/or connecting to the FTDI adapter for testing before getting into the real code for the controller board.

Now, time for a sanity check.

I never could find documentation on the GoojPrn, but it looks suspiciously like the APS unit. I found documentation on the APS unit, and have some for the Kashino, too. The Kashino claims that you hold down the Paper Feed button while powering on, and a test print will spew out. The APS claims that you hold down the Online/Offline button while powering on, then click Paper Feed twice, and then releasing the Online/Offline. OK. None of this worked at all on any of the three printers.

The Kashino and the APS printer just could not be made to do anything interesting with those buttons sequences, and the GoojPrt would only print CP437 once and stop. WTF? Incidentally, the GoojPrt and the APS both come with a strip of paper that is the test page printout, so I know what it should look like. If one came with the Kashino, it's been lost to time. On the Kashino, it just did a paperfeed like the paperfeed button should do, and the APS simply gave me a blank stare. Ah, the joys of documentation on these things.

In desperation to see something interesting happen (I mean, surely all three can't be broken?) I went ahead and wired them up to my FTDI. I guessed on COM port speed -- apparently the Kashino is 19,200 and both the GoojPrn and APS are 9600 -- and sent a simple "Hello!" message. Yay! It printed! So wtf could be the problem?

Moving on again, I tried concoting a binary file of an image. I first had to process a monochrome bitmap and then hex-edit it with the printer commands. It should print by dumping the data to the printer.

This totally did not work; all I got was random junk from the GoojPrt. On the other hand, I don't really have a datasheet for the Gooj, only the APS and Kashino, so maybe the language is different. It definitely is different between those two printers for things like graphics. (Text mode is a no-brainer). Since the APS and Gooj have the same connector, and also because the APS has hardware flow control, I decided to hook up the APS, and concoct the image in it's native language for which I have real docs.

The results were not exciting:

Ugh. What NOW! I do get a little printout of the graphics, then it croaks and all Hell breaks loose. I decided to pull back and make a file with just a few graphics lines, and that worked OK, and I could still emit "Hello!" just fine in between and then send more graphics just fine. Hrmrmrmrmm!

I went to Google and searched and searched and at best I could find some reference to folks having somewhat similar troubles and flashing firmware. In desparation I did something a little dumb: I flashed the GoojPrt with firmware intended for the Kashino. I don't really know what I was thinking, but it does work -- sort of. The buttons no longer function, but all the printer is OK. I can't generate a test page from the buttons anymore, but I can do the same by issuing the command over the serial port.

It wasn't entirely stupid for my to flash the Kashino firmware -- I guessed that the units were very similar because I could issue the same commands (that I could make work) on both those units. It was an act of desparation for me to flash in this manner, but it is still working enough. But it did not really solve my problem, so I do regret it. Plus, I can no longer feed paper from the front panel buttons. :(

I fiddled with this for hours, and eventually went to bed, defeated and dejected.

Then I awoke the next day with a kooky idea: let's look at the power bus. I mean, I'm using a regulated 7.2V 1A power supply, SURELY that is enough, right?

Well, I hooked it to the scope and the V+ line did take a dip when printing my message. But still not a shocking amount. So I tried it with the 'Test Page' on the GoojPrt unit, since that's the only one that did anything when I used the magic button sequence.

Well, that caused a much bigger dip. It then occurred to me that maybe what was happening is that the dip was going below the point that the on-board regulator could accept and still maintain it's 3.3V output, and that the processor might be resetting. It was a little difficult for me to notice at first, because the printer has the annoying habit of flashing the online LED when it is online, so the flicker of the LED due to board reset was not really visible versus the flicker of the LED in normal operational mode.

I tried printing out a longer text message: "Hello, I love you. Won't you tell me your name?" and the printer did reset on that message. So, more black dots == more heat == more current == more power demand, and too much for my 7.5V 1A (!) supply to deliver. (Or it has a different taste in musik.) So I pulled out a 5V 3A supply (I didn't have a 7.5V one, but 5V is within operating specs). SURELY that would be enough, right?

That worked... better! I did get most of the test page printout until it got to "FontB" and then it failed. The FontB printout section has a denser print, so probably the power suck again. Coincidentally, I noticed something: Oh, Jesus, the wire carrying power was quite warm! OK, stupid me, I used too low a guage power line (I was using one of those breadboard jumper wires with the Dupont ends), and was measuring on the hot side of it, so even the dips I saw were doubtlessly smaller than on the other side of that wire. Stupid monkey, stupid!

I substituted a bigger piece of wire and then: Bingo! I got the image!

(sorry, blurry; need a tripod) Sweet mystery of print, at last, I've found you!

OK, I feel a little silly for the power thing; but, Sweet Jesus! this thermal does suck the power down!

However, you may notice the space between the two images. I did not put that there. The APS unit put that there. This might be aesthetically pleasing in some practical receipt printing cases, but I do not want that space at all, since I am rasterizing all my output, and need it to stack up without gaps. I did notice an oddity: If I send the images in rapid succession, then they ARE contiguously, but if a pause a bit, the printer adds the gap. Ugh; I don't have time for this.

In desparation, I formulated a Kashino image and connect the GoojPrt, and that did not exhibit the gap. Yay! For that. But, the image was quite faint. Boo! For that. There is a command to increase the heating time, making the print darker, but then that returned me to the rebooting problem, even with the thick wires. I even added a 1000 uF cap in hopes of supplying transient demand, but to no avail. Sigh. I decided to move on and deal with the faint output for now so that I could finish code, and I'll come back to upgrading the power supply later (I'll have to get one; I don't have a 7.5V 3A). Anyway, all this is wired through the breadboard now so that I can swap connections easily, so all the more reason to move on for now.

I suspect that the APS unit has a better electrical design than the GoojPrt, but that I can still use the Gooj if I can get a beefier supply.

Now, enough of hand-crafted graphics commands -- time to code some rasterization!


Having gotten past printer quirks, it's time to implement the rasterizer fer real. I think this (at least!) should be straight-forward, especially since my previous work involved me manually cooking up printer commands to realize a successful graphics print-out. The biggest additional work is the integration into the rest of the system, and I think I have that implemented and tested enough such that that will not be too onerous.