A while ago they’ve been airing reruns of the old black&white Addams Family series that I watched at my sister’s place. In one scene they’ve shown Gomez reading ticker tape, losing $1,000,000 just moments after he earned them, and my eyes immediately landed on a make-up brush holder my sister uses. That thing, I said to myself, looks similar to his stock ticker…
Even though a receipt printer hodge-podged in a brush holder is a far cry from the original device, replicas that can be purchased online have an asking price of tens of thousands of dollars. Moreover, I’m not in 19th century New York with telegraph wires providing me with stock market information… so I said what the heck 🙂
Cheap Bluetooth thermal printers, also known as “cat printers” due to the motif on some.
The left one only works through a phone app called “iPrint”, the other only thru “Fun Print”.
With ticker tape also having been treated as confetti in the days long gone, it has now become “unobtanium”, especially here over the pond, where I don’t think they were in use at all. However, paper receipts are still ubiquitous, and so are their printers.
The cheapest ones can be bought from, as I like to say, “Far Eastern marketplaces” as kids’ toys. Although these take regular 57mm thermal paper, they’re cheap for a reason. And one of the reasons is that they can only print via a certain smartphone app that, in order to work, requires – in addition to Bluetooth to talk to the printer – also internet access, GPS and location services turned on. As a bonus, you get to see what the others have printed, too. What just happened to the picture you sent out to print, is a rhetorical question. 🙂
Circuit boards from both sides.
Normally, these have 4-character Bluetooth identification, which is sometimes appended with a portion of their MAC address.
The right one identifies as MX01, the left one as SC05-C6A5. And they compete against each other – the one that prints via “iPrint” will not do it via “Fun Print”, and vice versa.
Thankfully the data protocol these use has been partly reverse-engineered, but not all types work, and some of these printers that share the same case have a completely different PCB inside. With my tests I was able to print through both of these, via NaitLee’s implementation that I modified slightly.
From the hardware standpoint I got rid of the lithium battery and wired in a connector for a five volt supply. It needs to be rated at least 2.5 amps; with a 2 amp adapter the printer sometimes stopped halfway through when printing larger-density images.
Now, since this battery was connected in permanently, a button was used to activate the printer by holding it for 2 seconds. To get rid of this button and make it ready automatically upon powerup, I’ve added a simple monostable NE555 circuit with a 2 second time constant. If this is actuated longer, these printers sometimes print out a QR code where to download their app, and their MAC address.
Stock market quotes and account status printout from data provided by XTB.
Code available on my GitHub repository.
Software-wise, this is a Python script utilizing NaitLee’s Cat-Printer-Core, as mentioned above. This talks to the printers via Bluetooth Low Energy using the “bleak” library of Python. Sometimes this fails to establish the Bluetooth link with some cryptic error such as “GATT services unavailable”, in which case it helps to bring the printer closer to the computer, perhaps flipflopping the system Bluetooth setting on and off to help it.
To get market prices there are services and brokers that expose their public APIs, such as Yahoo Finance, XTB, Interactive Brokers and so on. Since IBKR requires a client application on the system to use the API and it won’t work on a lite account, I decided to try out the XTB API (by the way I am not sponsored by them in any way), so that’s what my script is using. It works for a demo account as well as for a real one. They do have a bug I found (at the time of writing this article) where the backend returns zeros for account balances and profits, if the positions are opened through an “Investment Plans” wizard and not the classic way. These values do show up in their UI (“xStation”) fine, so I guess it’s a new feature that’s not yet been completely integrated.
This data is retrieved into text, and since these “cat printers” are designed to print monochrome PBM bitmaps with a fixed width of 384px, then so it becomes. After printing, the script waits until the next data retrieval or an Escape keypress, which disconnects the Bluetooth link. It is not disconnected right after the completion of a single print, as these printers will enter a sleep state if no connection has been present for a couple of minutes, requiring to press and hold the powerup button again. Since it runs from an adapter, there’s no such worry.