Wireless Printing
Wireless Printing
If you're like me you kept the old Beeb that you had in the eighties but any centronics based dot-matrix printers and fan-fold paper have long gone. When I'm developing code I occasionally like to print some of it so I can scribble modifications while I'm scratching my head. I therefore decided to see if I could send print from the serial port to my wireless printer. It seemed to be a fairly straightforward project that my simple mind could cope with (I thought).
The hardware involved is an RS232 <-> TTL converter and a Wemos Di.
The first test was to see if I could send something to the printer successfully so I wrote some code for the Wemos to connect wirelessly to the printer and had some early success by wrapping sample text with HP PJL and PCL magic. The next test was to receive some text from the Beeb via the serial port and barring some wiring issues this seemed to work OK too. The problems started when I tried to combine the two. As I received characters from the Beeb I sent them on to the printer with the PJL and PCL wrappings. However, since the WiFi is interrupt driven I found that the Wemos was dropping characters, even at slow baud rates, as the cheapo TTL converter I had didn't support handshaking lines.
To cut a long story short, I bought another converter from Tronisoft with handshaking support and I'm now printing at 9600 baud without problems.
I've now enhanced the code so that it can be configured for the WiFI and printer from the Beeb.
If anyone is interested I can post more details and I'm happy to share the code.
The hardware involved is an RS232 <-> TTL converter and a Wemos Di.
The first test was to see if I could send something to the printer successfully so I wrote some code for the Wemos to connect wirelessly to the printer and had some early success by wrapping sample text with HP PJL and PCL magic. The next test was to receive some text from the Beeb via the serial port and barring some wiring issues this seemed to work OK too. The problems started when I tried to combine the two. As I received characters from the Beeb I sent them on to the printer with the PJL and PCL wrappings. However, since the WiFi is interrupt driven I found that the Wemos was dropping characters, even at slow baud rates, as the cheapo TTL converter I had didn't support handshaking lines.
To cut a long story short, I bought another converter from Tronisoft with handshaking support and I'm now printing at 9600 baud without problems.
I've now enhanced the code so that it can be configured for the WiFI and printer from the Beeb.
If anyone is interested I can post more details and I'm happy to share the code.
BBC Model B 32k ICL issue 3, WE ROM/RAM board, Speech Processor, TurboMMC, PiTubeDirect
BBC Master 128
BBC Master 128
Re: Wireless Printing
I am very interested in this project since I am working on a printer driver for the ElkWiFi board. The part to communicate with the wireless lan is already done as you can read here.
So if you already have some software to convert the plain text to PCL and send it to the printer that would save me a lot of work
Besides that, can you also post some pictures and a wiring diagram?
And can you also connect to a webserver to download a file? If so, then that will be a useful alternative for BBC and Master owners who want their computer online.
So if you already have some software to convert the plain text to PCL and send it to the printer that would save me a lot of work

Besides that, can you also post some pictures and a wiring diagram?
And can you also connect to a webserver to download a file? If so, then that will be a useful alternative for BBC and Master owners who want their computer online.
FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN
MAN WOMAN

Re: Wireless Printing
Hi roland. I can certainly share my PJL/PCL code and I'll upload some pics and a circuit diagram.
BBC Model B 32k ICL issue 3, WE ROM/RAM board, Speech Processor, TurboMMC, PiTubeDirect
BBC Master 128
BBC Master 128
Re: Wireless Printing
Here are some code fragments that should get you started (in cpp):
I haven't done any formatting of the text yet, I'm just printing what the Beeb sends. You may find these useful for PJL/PCL info if you want to format the text:
https://developers.hp.com/system/files/ ... Manual.pdf
http://www.hp.com/ctg/Manual/bpl13210.pdf
Code: Select all
WiFiClient client;
const char* UEL = "\033%-12345X";
const char* PJL_Start_Job = "@PJL JOB NAME = \"BeebPrint Job\" DISPLAY=\"BeebPrint\"\n";
const char* PJL_Language = "@PJL ENTER LANGUAGE = PCL\n";
const char* PJL_End_Job = "@PJL EOJ\n";
const char* PCL_reset = "\033E";
const char* PCL_wrap = "\033&s0C";
const char* PCL_left_margin_portrait = "\033&a5L"; // 5 chars in
const char* PCL_right_margin_portrait = "\033&a75M"; // 75 chars in
const char* PCL_top_margin_landscape = "\033&l4E"; // 4 chars down
const char* PCL_left_margin_landscape = "\033&a0L"; // 0 chars in
const char* PCL_right_margin_landscape = "\033&a110M"; // 110 chars in
const char* PCL_underline_on = "\033&d0D";
const char* PCL_underline_off = "\033&d@";
const char* PCL_simplex = "\033&l0S"; // single sided
const char* PCL_duplex = "\033&l1S"; // two sided, long edge
const char* PCL_portrait = "\033&l0O";
const char* PCL_landscape = "\033&l1O";
bool landscape = false;
bool duplex = false;
...
sendPJLHeader(client);
sendPCLHeader(client);
// Send text
sendPCLFooter(client);
sendPJLFooter(client);
...
void sendPJLHeader(WiFiClient client) {
client.write(UEL);
client.write(PJL_Start_Job);
client.write(PJL_Language);
client.write(UEL);
}
void sendPJLFooter(WiFiClient client) {
client.write(UEL);
client.write(PJL_End_Job);
client.write(UEL);
}
void sendPCLHeader(WiFiClient client) {
client.write(PCL_reset);
if (duplex) {
client.write(PCL_duplex);
}
if (landscape) {
client.write(PCL_landscape);
client.write(PCL_top_margin_landscape);
client.write(PCL_left_margin_landscape);
client.write(PCL_right_margin_landscape);
} else {
client.write(PCL_left_margin_portrait);
client.write(PCL_right_margin_portrait);
}
client.write(PCL_wrap);
}
void sendPCLFooter(WiFiClient client) {
client.write(PCL_reset);
}
https://developers.hp.com/system/files/ ... Manual.pdf
http://www.hp.com/ctg/Manual/bpl13210.pdf
BBC Model B 32k ICL issue 3, WE ROM/RAM board, Speech Processor, TurboMMC, PiTubeDirect
BBC Master 128
BBC Master 128
Re: Wireless Printing
Thanks, this looks quite simple. Once I establish a TCP connection with the printer I only need to send some control codes and the text. Just like on my good old Seikosha SP180-AI dot matrix printer BITD 

FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN
MAN WOMAN

Re: Wireless Printing
Here are some pics:
BBC Model B 32k ICL issue 3, WE ROM/RAM board, Speech Processor, TurboMMC, PiTubeDirect
BBC Master 128
BBC Master 128
Re: Wireless Printing
and here is a circuit diagram:
the labelling of the connections on RS232<->TTL modules can be inconsistent so it may be necessary to swap TX/RX and CTS/RTS.BBC Model B 32k ICL issue 3, WE ROM/RAM board, Speech Processor, TurboMMC, PiTubeDirect
BBC Master 128
BBC Master 128
Re: Wireless Printing
Well that's really simple hardware compared to my ElkWiFi board. But the Elk has no serial port so I had to make it complicated
Can you also download files from the internet with this interface? Assuming you write the correct software for it. How do you give instructions to the D1, like connect to a WiFi network, establish a connection with the printer and so on?

Can you also download files from the internet with this interface? Assuming you write the correct software for it. How do you give instructions to the D1, like connect to a WiFi network, establish a connection with the printer and so on?
FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN
MAN WOMAN

Re: Wireless Printing
I guess you could download files but I haven't written the code for that. The D1 can be programmed like an Arduino and there are libraries for connecting to Wifi etc. I could attach the complete code if you're interested.
BBC Model B 32k ICL issue 3, WE ROM/RAM board, Speech Processor, TurboMMC, PiTubeDirect
BBC Master 128
BBC Master 128
Re: Wireless Printing
You are really a great help for me. Thanks to you I did some experiments and it seems that printing via the network is just as simple as on a good old matrix printer from BITD.
On my Mac I did a telnet to port 9100 of my printer and it responded:
Then I pasted just a small piece of text to the open telnet session and .... it came out of the printer. Just plain ascii in courier format. This is really great, I never thought that printing could be sooooooo easy
So, the next thing I am going to try is to connect from my Elk to the printer and just start dumping data. The ESP8266 has a pass-through mode which is great for this purpose. Thank you for starting this topic
On my Mac I did a telnet to port 9100 of my printer and it responded:
Code: Select all
MacDevelop:~ roland$ telnet 169.254.141.196 9100
Trying 169.254.141.196...
Connected to 169.254.141.196.
Escape character is '^]'.

So, the next thing I am going to try is to connect from my Elk to the printer and just start dumping data. The ESP8266 has a pass-through mode which is great for this purpose. Thank you for starting this topic

FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN
MAN WOMAN

Re: Wireless Printing
On my BBC I set my wifi modem to my laser printer using commstar
ATDT10.1.1.251:9100
Back in basic
*FX5,2
*FX8,7
*FX6,0
Control B to start sending data to printer
Control C to stop sending data.
I had to press GO on the printer to start printing.
ATDT10.1.1.251:9100
Back in basic
*FX5,2
*FX8,7
*FX6,0
Control B to start sending data to printer
Control C to stop sending data.
I had to press GO on the printer to start printing.
Re: Wireless Printing
Does vdu 12 or Ctrl- L start the print job just before ctrl-c?
FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN
MAN WOMAN

Re: Wireless Printing
Yes, CTRL - L does start the print job
Re: Wireless Printing
On the Electron it's also starting, for more information look here.
FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN
MAN WOMAN

Re: Wireless Printing
Yes, on a page printer you need to tell the printer that you've finished sending the data for that page, by sending Page Eject (ie, Form Feed).
Whereas on a line printer you need to tell the printer you've finished sending the data for that line by sending a Line Feed (or causing an automatic line feed with a Carriage Return).
Otherwise, how does the printer know you've finished sending the data for the print unless you tell it you've finished sending the data for the print?
Code: Select all
$ bbcbasic
PDP11 BBC BASIC IV Version 0.32
(C) Copyright J.G.Harston 1989,2005-2020
>_
Re: Wireless Printing
I asked him if CTRL+L did start the print job just because of what you said
However, yesterday I noticed that my OKI laser printer also starts to print after the data communication (over the network) has timed out. But I don't think we can compare that with a dot matrix line printer.

However, yesterday I noticed that my OKI laser printer also starts to print after the data communication (over the network) has timed out. But I don't think we can compare that with a dot matrix line printer.
FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN
MAN WOMAN

Re: Wireless Printing
I have built a prototype Arduino interface for the printer port, so that when data is sent to the printer port, it sends data out at 9600 baud.
Connected to the Arduino is an ESP8266 which I have programmed to connect to my printer via WiFi.
The prototype is small enough to fit under the BBC and takes power from the user port.
I'm using a Brother laser printer, CTRL+L starts printing or just wait a few minutes and the printer starts.
Connected to the Arduino is an ESP8266 which I have programmed to connect to my printer via WiFi.
The prototype is small enough to fit under the BBC and takes power from the user port.
I'm using a Brother laser printer, CTRL+L starts printing or just wait a few minutes and the printer starts.