Use arduino as a virtual printer

Hi everybody,

I'm actually working on an arduino project where I would use the arduino Uno as a "virtual printer" : basically I need it to be detected as a printer and be able to send ("print") a basic .txt file to the arduino. I looked into various things such as Winows Driver Kit, specifications, forum posts, etc. but I don't know where to start. In some places I saw it would be possible to change an old generic serial printer driver, or that i would have to change the soft on the atmega16u and other things. If anyone had an idea on the approach to take and a fiew hints on how to succeed he would be gladly welcome! :)

Thanks in advance

What are you connecting to, and which port? USB? DB9 serial?

basically I need it to be detected as a printer and be able to send ("print") a basic .txt file to the arduino.

So you just need to send some text statements from a .txt format file to the arduino?

OR

in addition you need to get the arduino print the .txt file text on paper also?

Google suggests that in windows you could just add a generic text mode printer associated with the Arduino's serial COM port:

http://www.kbytes.co.uk/Articles.asp?articleid=58

Check my parprinter class in this thread, might be helpful. It is derived from print class so it understands enough basic datatypes ( int , float , text) to be able to print text files.

KeithRB: What are you connecting to, and which port? USB? DB9 serial?

I'm connecting it to an USB port as it is.

NI$HANT:

basically I need it to be detected as a printer and be able to send ("print") a basic .txt file to the arduino.

So you just need to send some text statements from a .txt format file to the arduino?

OR

in addition you need to get the arduino print the .txt file text on paper also?

I stock the data in an SRAM and then send it through BT to a smartphone ; this is why I say my arduino is a "virtual printer" ^^

PeterH: Google suggests that in windows you could just add a generic text mode printer associated with the Arduino's serial COM port:

http://www.kbytes.co.uk/Articles.asp?articleid=58

I will try this tomorrow morning, seem's interesting to me : hope it works :)

robtillaart: Check my parprinter class in this thread, might be helpful. It is derived from print class so it understands enough basic datatypes ( int , float , text) to be able to print text files.

I think the link is missing?

sorry here it is - http://forum.arduino.cc/index.php?topic=190948.msg1411619#msg1411619 -

PeterH: Google suggests that in windows you could just add a generic text mode printer associated with the Arduino's serial COM port:

http://www.kbytes.co.uk/Articles.asp?articleid=58

I tried it with a txt file containing only "test" but windows catches an error and the printing do not proceed :( On the arduino I use Serial.available but maybe I should create another object?

Pierrej: I tried it with a txt file containing only "test" but windows catches an error and the printing do not proceed :(

What's the error?

Verify that you used the correct COM port associated with the Arduino.

You might need to initialise the COM port speed/stop/parity settings before printing.

PeterH:

Pierrej: I tried it with a txt file containing only "test" but windows catches an error and the printing do not proceed :(

What's the error?

Verify that you used the correct COM port associated with the Arduino.

You might need to initialise the COM port speed/stop/parity settings before printing.

Just stating "error : print in progress" I checked and it is the same com port (com3), where do I find the good settings for the com port?

what are your current settings of that com port?

e.g. it should NOT use hardware handshake as the Arduino does not do that,

Bites per seconde : 9600 Data bites : 8 Parity : none Stop bite : 1 Flow control : none

I don't think hardware handshake is activated but could not find the option :/

flow control = none means no HW handshake otherwise there would be something like RTS/CTS ( XON/XOFF is a SW handshake)

Sorry for my late answer. You think that with these settings it should work? On the tests I runned it did not seem to do anything :s

maybe time to post your code so we can replicate the (not) working of the printer