0
\$\begingroup\$

I'm working on a project in which an arduino should emulate a thermal printer. I'm currently using an Arduino UNO R3 board with ATmega16U2 controller to handle the communication between USB and the ATmega328 microprocessor. I used the FLIP suite from ATMEL to erase the firmware in the ATmega16U2 and reprogrammed again with the arduino firmware. Which are the steps to take in order to make the board appear in the computer as a USB printing support? Is there any firmware available? What I need is basically to be able to use the arduino board with a standard windows printer driver and to catch the messages sent to the emulated printer. I checked out the LUFA library but I do not have it clear how to use it.

\$\endgroup\$
  • 2
    \$\begingroup\$ If you can find a driver for a simple serial printer, you likely won't need to change anything about the Arduino's USB-serial interface. Given that thermal printers often go in dedicated/embedded systems like point of sale setups, I'd think that those with serial (rather than proprietary USB) interfaces would be fairly common - at least far easier to still find than modern desktop printers with a serial interface. Conversely, if you must emulate a specific thermal printer, you will need the details of its USB protocol which you might glean from the manual, or a Linux driver (if available) \$\endgroup\$ – Chris Stratton Mar 18 '13 at 15:32
  • \$\begingroup\$ I'm aware about the possibility of using a serial interface with the windows driver, but unfortunately this is not possible. I really need to use a USB interface and the arduino should appear like the printer itself. I need to emulate a specific printer. What do I need to know about the USB protocol? Would it be enough if I could obtain the original firmware of the printer and I would flash it into the ATmega16U2? \$\endgroup\$ – Francesco Mar 18 '13 at 15:53
  • \$\begingroup\$ No, the printer firmware will almost certainly not work on your board. You will have to understand most of how the computer talks with the printer. Often this is poorly documented - that's why I was suggesting trying to find the source code of a linux driver, to take advantage of someone having already figured that out, often by reverse engineering. However, if you are using the OEM windows driver, you may have to implement even more of the original functionality in your firmware beyond what an open source driver might use. Needless to say, this is not a beginner project. \$\endgroup\$ – Chris Stratton Mar 18 '13 at 16:25
  • 1
    \$\begingroup\$ Also, there's a fundamental problem with your question. You claim, for unstated reasons that you cannot use a serial printer's driver. That seems to say that you must use a specific USB printer's driver, but then your question would be unanswerably incomplete due to the failure to state which printer that is. \$\endgroup\$ – Chris Stratton Mar 18 '13 at 16:28
  • \$\begingroup\$ @Francesco Hi, have you made any progress on this? I am looking for the exact same thing and I would really appreciate it if we could discuss it in person! \$\endgroup\$ – Uri Abramson May 10 '16 at 11:08
3
\$\begingroup\$

edited to add: related question

You need to change the USB ID from the Arduino to match the code that Windows would expect to see from your printer. Here is a sample list. And an example from that list:

03f0  Hewlett-Packard
    0004  DeskJet 895c
    0011  OfficeJet G55

03f0:0011 appearing on the USB means the device appears to Windows as a HP OfficeJet G55. You can determine this number easily if you have one of the printers physically. Plug it into windows and Computer -> Properties -> Device Manager find the device, open it, click the Details tab, select Hardware Ids dropdown and the manufacturer ID and device ID are in the "Value" window.

The next part (and hard part) is to then program the Arduino to do what you need/want with the data once attached to Windows. Oh, and how to program the Arduino when Windows thinks it is a printer. THAT, I can only say what I already have and no more, as I haven't done this before. Normally, when I would dev USB or serial like this, there's an ethernet back door I use for programming the target system.

Sounds fun, please update with your progress, I'd like to learn from this.

\$\endgroup\$
  • \$\begingroup\$ @David - the Arduino model in question does not use an FTDI chip. Those were superseded a few years ago, though other vendors still sell clones and derivatives of the old boards using that part. The USB interfaces on the newer Arduinos are based on a USB-enabled member of the ATMEGA family and are reprogrammable, though there's still the gaping challenge of figuring out what exactly it is going to have to do to emulate the unspecified printer needed. \$\endgroup\$ – Chris Stratton Mar 19 '13 at 0:47
  • \$\begingroup\$ Ah, my mistake; the last Arduino I used was the Duemilanove, so I shouldn't have assumed that the hardware was still the same. Good to know that they've made it more flexible. \$\endgroup\$ – David Mar 21 '13 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.