Readit News logoReadit News
hansonkd · a year ago
I did something similar with a receipt printer.

a thermal usb receipt printer is like $75 dollars and easily controlled by python. Super easy to print out images and QR codes. and the autocut functionality makes it easy to segment messages. Additionally the receipt printer is nice because you can activate the bell inside as an additional "notification" and has an extra control for a cash drawer that I am thinking of hooking into to control a light or something.

I had it set up for emails and every morning it would print off my calendar.

I think the interface works well especially if you pair it with a physical control like buttons or NFC reader. That way you can issue "commands" and get output. Like I had one NFC card to make it print my calendar, one for unread emails, etc.

I have some more features I want to add to it. Its very fun way to cut down on screen time, but ironically i have spent more screen time coding with it and setting it up then it probably has saved me. lol.

autoexec · a year ago
Receipt printers are fun but take care not to buy toxic paper https://www.consumerreports.org/cro/news/2014/03/the-health-...
z2 · a year ago
The most mainstream phenol free thermal paper out there is one made from a branded chemical "pergafast" which is supposedly based off of urea. This is increasingly the type used by big brand stores where the paper is advertised as BPA and BPS free. It appears safe in studies so far in terms of not being absorbed through the skin nor endocrine disrupting, but is also known to be highly toxic to aquatic life. There's another chemical related to vitamin c branded "Alpha Free" but it's harder to find.

https://www.sciencedirect.com/science/article/abs/pii/S02732...

amelius · a year ago
Does this warning also hold for thermal label printers?

I have this one: https://www.creativebloq.com/reviews-niimbot-d110

kragen · a year ago
Assuming BPA is what you're worried about (it's not "toxic" by the usual definitions but still something you may want to avoid) there isn't another mainstream option.
gzalo · a year ago
I wonder if it's feasible to make diy Thermal paper using lemon juice, like the old "invisible ink experiment"
nik282000 · a year ago
Great minds. My thermal printer spits out the weather every morning and if any important devices fall off my network it prints a notification.
aschmelyun · a year ago
Receipt printers are a blast! I had a project from a couple years ago printing out GitHub tickets using a similar setup to what I have for this dot matrix printer.
ustad · a year ago
Whats the printer you have? I’ve been thinking of getting one and did not know about the notification and external feature you mention.
hansonkd · a year ago
I have a Rongta RP331.

The thing I wish it could do different is that when printing a single line, the autocutter hides it, so you have to line feed about 5 times until the line you printed is visible.

If i did it different, maybe i would try to find a printer that is able to do reverse line feed so I can "peek" at a single line and then not waste paper. but i think those are about 3-4 times more expensive.

PaulHoule · a year ago
There are a lot of cheap Chinese dot matrix printers. As an American if you search by mm size you will find those, if you search by inches you will find more reputable (and culturally sensitive) brands.

I bought two Chinese printers, one burned up pretty quick when I was testing it but I might have been printing too much black. The other is fine I think but really I am not so motivated to make thermal prints when I have a good quality inkjet. (My best thermal print was a small Lusamine

https://safebooru.org/index.php?page=post&s=view&id=1821741

which demonstrates how Nintendo official art is designed to render on cheap screens like the Nintendo 3DS)

mtoohig · a year ago
Please share some of your code, I would like to see and get a feel for some personal ideas.
Instantnoodl · a year ago
I use Thermal Printer for a different use-case (TTRPG stuff). Feel free to check it out :)

https://github.com/BigJk/snd

hansonkd · a year ago
I am currently working on an "input" interface to scan resposnes that I write from my typewriter and am planning on releasing a github repo on it when im done. conveniently you can type directly on the receipt printer if the response is short.

Right now all my credentials are hardcoded so i can't push out what I have without some cleanup, but I can point you to some of the libraries: python-escpos and nfcpy were what I used for the bulk of it.

meling · a year ago
Last paragraph made me laugh

At least you did something cool with your screen time!

AStonesThrow · a year ago
Whatever vendor(s) decided that the restaurant industry needed to switch over to thermal printers, I hope Cory Doctorow has a chat with them.

"Let's just tape this thermal receipt to your to-go container, and ... refund? What do you mean refund?"

bombcar · a year ago
Thermal printers are cheaper because you only have to buy paper, no ribbon or ink.

However, thermal receipt printers at restaurants seem to be among the cheapest ones around - you can get thermal printers that result in receipts that withstand decent temperatures (but, obviously, not all).

Many shipping labels are printed by direct thermal printers and those labels stand up quite well. Check Zebra for examples.

whartung · a year ago
So, curiosity today.

One of the things that this person does is simply echo to /dev/lp0.

Which is all you did back in the day. Shove text down the interface, and the printer printed.

Now, while we have very fancy modern printers, they're still printers with a long legacy. Even back in the day, early HP laser printers worked like this. Shove data down the wire, and it printed (Courier 10, 66 lines per page). Only the Apple Laserwriter didn't really do this (I don't think) because it was an exclusively PostScript printer. Instead, you shoved PostScript down the wire.

As the printers evolved, the language that was sent to them got more complicated. But even so, they still had a long line of backward compatibility.

So, if I plug a USB printer into a computer, and ls > /dev/usbXXX, will it print today? Does that still "just work"?

If I do that with an EPSON and send it EPSON MX-80 escape codes -- does it still work? It wouldn't surprise me either way, but I'm just curious if someone knows. They're very black boxy today (to me anyway).

(Anyone else remember the joys of getting reports to fit on pre-printed, multi-copy NCR forms? What fun that was!)

slsii · a year ago
I just tested this on OS X, which doesn't expose printers through /dev/ in the way you're describing as far as I can tell. But apparently lp exists on OS X, so you can do echo "Hello printer" | lp -d <printer_name>, and find the name through lpstat -p.

And sure enough, this works! Just tested on my new printer.

blenderob · a year ago
Wow! What a delightful exchange this is! Curiosity asked and answered in 12 minutes! I literally got goosebumps on my arms as I read your comment and reached the last part where you say "this works!"
hawski · a year ago
With macOS there is this one off topic thing regarding printing that always gets me. I once had a company Macbook and it connected to my old Brother printer without problems and only then (after almost ten years of having the printer) I discovered it has double sided printing. It just worked. I always wondered if there is a way to connect somehow to this machinery to get a macOS printer driver or whatever and emulate whatever is needed for this to work on Linux.
account42 · a year ago
The question then is, does this lp utility just feed the text directly to the printer or is it just a legacy compatibility layer that goes through the normal printing APIs to do its thing.
sgt · a year ago
Works for me as well. This is a network printer available via WiFi.
jolmg · a year ago
> One of the things that this person does is simply echo to /dev/lp0.

> So, if I plug a USB printer into a computer, and ls > /dev/usbXXX, will it print today? Does that still "just work"?

Both of the following worked for me:

  printf 'hello\f' > /dev/usb/lp0
  printf 'hello\f' | nc -N $printer_ip 9100
This is on a Brother laser printer. Its programming guide is linked next to its manual online. The language is PCL, but you don't really need to know much about it to get simple stuff printed.

Neither of the above involve CUPS. Using the `lp`/`lpr` executable like in other comments requires the printer to be registered with CUPS first.

For `ls >`, the printer expects DOS line endings. `\n` just moves to a new line without "returning the carriage", so you need to pipe through `sed 's/$/\r/'` or use `nc -C`.

With the USB connection, you can print multiple times to build a single page and it won't come out until you provide the form feed. With the TCP connection, the page will be printed when the connection is closed.

mrighele · a year ago
> Using the `lp`/`lpr` executable like in other comments requires the printer to be registered with CUPS first.

In modern Linux distros, lp/lpd are usually shims provided for backward compatibility, but it doesn't have to be that way. For example FreeBSD seems to provide support for lpd without for cups [1], although I don't see any real advantage in doing that.

[1] https://docs.freebsd.org/en/books/handbook/printing/

dasfsi · a year ago
I have an Epson LX-350, bought new a few years ago. It connects via USB (but there's also serial and parallel ports). When connected via usb it appeared as /dev/usblp0 or something like that, and yes just cat'ing to it worked. And presumably the customers who buy these things new want them compatible with whatever processes they already have (for the last 30-50 years), so it supports both ESC/P 2 as you'd expect and IBM's escape codes (which I didn't expect and the old matrix printers I had from the 90's didn't).

What's perhaps more surprising, my macbook had an inbuilt driver for generic epson printers and it worked. It was not very good, it printed as graphics but it was there for some reason.

Not sure about modern inkjet and laser printers though. An inkjet Epson I used to have once did support raw ESC/P codes though, but it was 20 years ago.

r3trohack3r · a year ago
You can even do this with network printers, netcat a pdf to the open port and it will print.

https://retrohacker.substack.com/p/bye-cups-printing-with-ne...

rwky · a year ago
Just did this with my HP Envy injket and it worked, had no idea this was a thing it's very cool.
pm215 · a year ago
Back when I was at school in the 1990s, there was a dot matrix printer in the computer room still, which was the default printer for any of the computers on the network. One of the classic user errors was that somebody would try to print a document from Word and it would send a load of PostScript to the dot matrix printer, which would dutifully print it all out as PostScript source, wasting paper and printer ribbon until somebody told the printer to stop...
userbinator · a year ago
So, if I plug a USB printer into a computer, and ls > /dev/usbXXX, will it print today? Does that still "just work"?

For those who want to look into the horse's mouth, USB printing device class:

https://www.usb.org/sites/default/files/usbprint11a021811.pd...

"Printers have two different types of commands: those that transfer data, and those that control the USB interface or printer interface. The host prints something on a printer by delivering data on the Bulk OUT endpoint. This data may take the form of PostScript, HP PCL, or any other PDL. This data may also be encapsulated in a PCP, such as IEEE 1284.1, or something that is vendor-specific. In addition, the data may also be simple text, or it may be a proprietary PDL."

The rest of the spec makes it very clear that this is intended to work exactly like a standard parallel port at the "application layer". Use the bulk OUT endpoint to write data to the printer, and the bulk IN to read data from it. There is a status request that returns the same signals (out of paper, etc.) that a parallel port has.

If I do that with an EPSON and send it EPSON MX-80 escape codes -- does it still work?

ESC/P and ESC/P2 which followed are backwards-compatible and based on the MX, so likely yes.

Deleted Comment

zzo38computer · a year ago
> Only the Apple Laserwriter didn't really do this (I don't think) because it was an exclusively PostScript printer. Instead, you shoved PostScript down the wire.

It would be possible to write a PostScript program that emulates ESC/P (or PCL), although then you would have to send an entire page (or a page break) before the page would be printed, unlike the old dot-matrix line printers that you can print one line at a time, PostScript can only print one page at a time.

mmmlinux · a year ago
Its not like a laser printer can really print line by line though.
gpvos · a year ago
Well, that's easy to check out as long as you have a printer connected. It's going to depend on the printer. Doesn't work on my Brother laser printer on Linux, even if I send some valid Postscript to /dev/usb/lp0 . Piping it to lpr works of course, as long as you have a default printer selected.

Once you've established that you can print basic text, you can expect that the printer's escape codes will work.

userbinator · a year ago
Doesn't work on my Brother laser printer on Linux, even if I send some valid Postscript to /dev/usb/lp0

It's probably expecting ESC/P or PCL. Laser printers also usually wait for a formfeed before they will process a page.

yellowapple · a year ago
> So, if I plug a USB printer into a computer, and ls > /dev/usbXXX, will it print today? Does that still "just work"?

I can't attest to whether piping directly to the device works, but I routinely do stuff like

    lpr -o raw -P $SOME_CUPS_PRINTER < $SOME_FILE
Back when I was doing warehouse IT work I'd hand-write ZPL code and shove it directly into Zebra printers for things like asset tags, printed instructions on equipment, etc. This was also my approach for various tools I wrote to automate the printing of packing slips and shipping labels - except these programs had to run on Windows machines, and I tell ya hwat Windows sure doesn't make it as easy as CUPS does.

More recently I dusted off that particular skillset in order to print a bunch of labels for my kitchen. ZPL really ain't that bad of a language; sure beats trying to write PostScript or PCL by hand :)

TacticalCoder · a year ago
> So, if I plug a USB printer into a computer, and ls > /dev/usbXXX, will it print today? Does that still "just work"?

Many commented that it still works... This brought back good memories of sending native PostScript files to an HP LaserJet 4M+'s IP address, over the LAN, using netcat. Amazing stuff.

The gotcha of course is when the shit hits the fan: it can quickly degenerate into pages upon pages of garbage getting printed.

On the plus side back when things were, and still are, simple like that, typically just turning the printer of and terminating the command and you'd be good to go. As opposed to, say, weird spoolers/cache sometimes relaunching print jobs people thoughts were long gone.

kalleboo · a year ago
> it can quickly degenerate into pages upon pages of garbage getting printed

This is still a thing... I was setting up a modern Brother laser printer in FreeBSD (Brother only supplies Linux "PPDs" which run a bunch of binary blobs with Ghostscript and weird stuff) and figured it was easy enough so I did it remotely. Could only watch helplessly on the security camera as the printer spit out every page in it's paper cassette covered in junk... Remote stop commands did nothing.

kjellsbells · a year ago
God, that's a flashback. Desperately running NET STOP SPOOLER on an NT print server and then deleting some large SHD file because someone sent 789 pages of manuals to the printer. Sigh.
heroiccocoa · a year ago
I wish we could go back to this uncomplicated UX. I just spent literally 2 hours setting up a brand new Epson ET-2850 printer for my dad. I'm quite disgusted at how slow, bloated and disjointed the process was. The printer ships with an android app, which worked fairly well, and, on the Epson website, some Microsoft Windows software, which was one of the worst software experiences I've ever had. The Wi-Fi setup is totally disjointed on the printer, app and windows release. You enter the Wi-Fi password via the app, which should then forward it to the printer. That's fine, it's better than using the dreadful printer interface. The printer saw the right SSID right away. No confirmation was given whether it connected or not. No big deal.

The software on their website was a Windows executable .exe file that seemed outdated even 10 years ago. To complete the last few steps, the printer network connection had to be set up once again, even though I had already previously connected it. Each attempt would take around 10-20 minutes, only to fail. The network errors and troubleshooting steps were incredibly generic and unhelpful. The worst part, until that point, was that the printer shipped with outdated firmware, and I did an online firmware update via the printer itself, confirming that the printer's Internet connection had indeed already been established. Rebooting the printer did not help. It turned out that, despite only just downloading the Windows executable that same hour from the Epson website, they were shipping an old version .exe, with some bug that causes the network setup to not be detected. However, it never prompted me to update. Only after restarting the Windows computer, and then re-opening the .exe, did some update trigger, and it allowed me to finish setting through to the last step of the installer to download the rest of the bloat and let the printer appear in the list of available printers on the network on the computer.

I then did a test print via an iPad. Took about 15 seconds.

housel · a year ago
Depends on when "back in the day" was; even in the mid-to-late 80s, especially if you were on a multi-user system, on BSD 4.2/4.3 local and networked printer access went through the Line Printer Daemon (still available on the BSDs).

For PostScript printers, there was a filter application (provided by Adobe) that would turn plain text (without the %! magic) into PostScript.

femto · a year ago
It's not installed by default, but the BSD (lp) interface is still available in Debian with

$ sudo apt-get install cups-bsd

fionaellie · a year ago
Wow. That brings back a lot of memories. Those escape codes, figuring how to insert a form consistently (line it up with the mark on the left, maybe click it three times or press an insert button to suck it in a bit), then continual adjustments until things mostly fit. Good memories!
fluoridation · a year ago
In my experience, inkjet printers can print line by line like teletypes, but laser printers can't.
jahewson · a year ago
I guess your printer driver is free to emulate an LPT if it wants to.
userbinator · a year ago
Thankfully even USB-connected printers emulate an LPT (see the other comment I left in this tree) and are very likely to accept one of the standard command sets as well as just plain ASCII.

It's similar to the terminal emulation situation: despite being decades old, the VT100 has become a de-facto terminal command set due to its popularity.

saomcomrad56 · a year ago
I wonder if this works with a sharp M205 I have in storage.
kn100 · a year ago
I discovered this in the most amusing way ever accidentally a few years ago.

https://x.com/normankev141/status/1146547923758538755?t=oZrj...

text of tweet: So I bought a networked printer recently and as you do decided to try connecting to it a few different undocumented ways. I tried telneting to it. It turns out that whatever you type, it prints typewriter style. That was a pleasant and hilarious surprise. #internetofshit

ale42 · a year ago
Matrix printers can actually do quite a lot... depending on the models, you can change fonts, use bold, underline, sometimes italic, double-width and double-height characters and even graphics (although often are relatively low resolutions like 90 or 180 DPI).

One funny thing I did once for a escape-room-like game, was a box with only a parallel printer connector on it. When connected to the printer, it was parasite-powered from one of the control lines of the parallel port (it was just a tiny PIC microcontroller drawing a few hundred µA) and was sending a hint to the printer.

bitwize · a year ago
Back in the day, one of the first desktop publishing programs out there was called Fancy Font by SoftCraft. It was a CP/M and later DOS program, so not a WYSIWYG page layout tool like PageMaker. Instead it used text documents formatted with a simple markup language.

It originally worked by taking advantage of the high-resolution graphics mode present in Epson dot-matrix printers, which were capable of platen microadjustments as small as 1/3 the pitch between the pins in the print head, allowing for 3 times the vertical resolution the head alone could give. Fancy Font rendered the text on the computer and sent it as graphics in this special high-resolution mode, yielding results that were as close as you could get to typeset for home equipment in the early 1980s.

Later versions of Fancy Font had drivers for early laser printers like the OG HP LaserJet. But when the Mac came out... the writing was on the wall for such a system.

schlauerfox · a year ago
My dad had a 4 color dot matrix printer in the 90s. Printing the pharaoh head from deluxe paint II took FOREVER but actually looked pretty. The paper was really warped after though. Still have it, but no idea where 4 color ribbons would be sourced.
sitkack · a year ago
You could probably make your own multicolor ribbon.
smartmic · a year ago
I remember printing huge banners in landscape mode on those endless paper rolls, basically ASCII art stuff which commands like figlet would produce today on a terminal (maybe it still supports printers as output?)
aschmelyun · a year ago
I’ve been wanting to explore more with this design-wise. There’s literally dozens of pages in the manual regarding font sizing, emphasis, italics, sub and superscripts, etc.

Maybe for version 2.0!

layer8 · a year ago
It would be fun to have a terminal that understands ESC/P, supporting different fonts and CPI and the like.
seanw444 · a year ago
That's pretty cool actually.
Animats · a year ago
I had this machine connected to a news feed for years.[1] It's the mechanism from a Model 14 Teletype tape printer. It's still in my living room, and the tape feeds out into a wire basket. It's driven by a Python program running on an old EeePC subnotebook.

[1] https://aetherltd.com/refurbishing14.html

aschmelyun · a year ago
That is absolutely fantastic. I've always wanted to get my hands on one to mimic a ticker-tape with updating stock/crypto prices. One day!

Also, EeePC is something I haven't heard about in so long. That took me back!

sixothree · a year ago
Beautiful machine.
Lonestar1440 · a year ago
Legitimately great product idea, I think? Just the idea of a personalized (truly! by you! Not by MSN or whomever), off-screen news feed every morning is cool. The idea that I could *also replace my alarm clock with a dot matrix printer* is even cooler.

I could easily customize the php to hit my own news sources, but wouldn't know where to begin doing the hardware side on my own. Probably many others in this spot.

I'd buy it, for way more than the cost of an old printer, if it was available on the market!

tomjen3 · a year ago
As someone who did something similar back in the day - it is actually pretty easy since you literally have to connect the printer (hardest part, as you will need adaptor cables) and then write to a dev output, which is just a file (assuming you want to run this on Linux).
efreak · a year ago
> assuming you want to run this on Linux

If you're in DOS (not NT/XP+, not sure about 9x), you can use the debug command to write to the serial and parallel ports. You can also use `ECHO > COM1` for serial, or for the parallel port `ECHO > LPT1`

bityard · a year ago
Neat. Reminds me of when I (briefly) worked at a radio station. I forget basically all of the details now, but I'm pretty sure it would automatically dial up some Associated Press number, fetch the latest headlines, and send them to a dot-matrix printer. This was in the late 90's and it ran MS-DOS.

In case the author is reading: on most printers of the day, you could set the font via control codes and many printers even had variable-width fonts.

canpan · a year ago
This is great! I am currently thinking about getting a weekend paper newspaper like FT weekend. Reason being: I read news on my phone too often. And the news create negative emotion without being useful. News on paper and only once per week would make me more relaxed. His paper printer news daily would be great to bridge the gap in between!

On a side node: I love the dot matrix printer! Is there any hackable open source printer like this available?

i5heu · a year ago
I cannot recommend FT. I tried to get their physical paper, never got one and although I made 3 calls and wrote about 10 mails to them they only would escalate my ticket after I unsubscribed and demanded a refund, this was after 3 weeks and a lot of time on my side.

That is why I am also super interested in just printing news from the net for myself, so I do not need to keep watching on a screen.

eponeponepon · a year ago
Are you in the UK and within some short distance of civilisation? If so, you very likely have a newsagent near by you and there's a surprisingly good chance they still do a paper delivery round.

Obviously if you're in a hut up a mountain or live in Norfolk then this may be less useful advice for you.

PaulHoule · a year ago
For a while I’ve been printing “three-sided cards” which have an image on one side and a QR code with documentation on the other side

https://mastodon.social/@UP8/111013706271196029

the “third” side is the web site linked by the QR code.

I got bored with photography and made up a character who goes around with a cheap lens and always keeps the aperture around f/18 or more, uses heavy processing, color grades and shoots a standard non-standard aspect ratio so it looks like he’s using some weird camera from an alternate timeline.

I just started printing this series and came to the conclusion that 4x5 can be easily made by cutting down a 4x6 but instead of cutting it I’d have an inch to put in a QR code and documentation on the front: similarly I could cut down a 5x7 to a square 5x5 and fit documentation in there. I have a few boxes of glossy paper that aren’t printable on the back and I think I’m going to use the, that way. (Found out later that instagram has a 4x5 standard and that my sports photos taken with a good lens really look good in that format)

One question though is what the documentation looks like and I am split between: (1) minimal changes to what I have, (2) some kind of fake dot matrix or other effect that looks like an old printer that might have been built into that fantasy camera or (3) something that makes he most of what the inkjet printer can do.

left-struck · a year ago
I genuinely want to understand your comment but I feel like it, or I, are missing a lot of context. Almost every paragraph seems to be completely unrelated to the last one.