Skip to content

JerryLee310/CatPrinterBLE

 
 

Repository files navigation

Cat Printer BLE

This is a command line program that provides basic functionality to use one of the most recent models (as of March 2025) of Cat Printers: model MXW01. It can load any image, it will resize it to the proper resolution and apply a dithering pattern to smooth the gradients after the color reduction.

It requires the .NET 8 Runtime and it supports only Windows for now.

Why

I recently acquired one of these thermal printers to be able to print small labels quickly. The main problem is that these kind of printers require using a proprietary and shady Chinese phone application that requires creating an account and who knows what else they do under the hood.

I searched for an open source alternative, and even though there are multiple projects that have successfully reverse-engineered similar printers, my specific model, the MXW01, seems to be fairly recent, works very different to other models, and it is barely understood. The only project I've found that has been able to implement some functionality to make this printer work (https://github.com/eerimoq/moblin?target=https://github.com), is iOS specific, and doesn't implement all the features.

So I wanted to try to do my own program as a fun challenge. I've never worked with Bluetooth or BLE before, so it's been a learning experience. The aforementioned project served me as a starting point, but then I was able to do my own discoveries by further reverse-engineering the Chinese app.

Features

This program does not aim to be an editor where you can easily add images and text that can be printed. This will load an existing image that you can create in any image editing software, resize it to the resolution this printer uses, convert it to monochrome or grayscale and apply some dithering to smooth the gradients.

  • Many image formats supported, like BMP, GIF, JPEG, PNG, TGA and WebP.
  • Print in two modes: Black and white monochrome (1 bit per pixel) and grayscale (4 bits per pixel).
  • It supports several dithering algorithms: Bayer2x2, Bayer4x4, Bayer8x8, Bayer16x16 and FloydSteinberg.
  • Get the status of the printer, which provides information about the battery level, if it has paper, its temperature, and its current state (Standby, Printing, Feeding paper, Ejecting paper, No paper, Overheated, Low battery).

Usage

Print an image

CatPrinterBLE (-p  | --print) <intensity> <print_mode> <dithering_method> <image_path>

Example

CatPrinterBLE -p 100 1bpp FloydSteinberg "C:\CoolCat.png"

Parameters

  • intensity: How dark the printing will be. Values from 0 to 100.
  • print_mode: The amount of colors that will be used for printing. Possible values:
    • 1bpp: Monochrome, pure black and white. Faster printing, lower quality.
    • 4bpp: 16bit grayscale. Slower printing, higher quality.
  • dithering_method: The dithering pattern that will be used for the color reduction. Possible values:
    • Bayer2x2
    • Bayer4x4
    • Bayer8x8
    • Bayer16x16
    • FloydSteinberg
  • image_path: The path to the image to print.

Eject paper

CatPrinterBLE (-ep | --ejectPaper) <line_count>

Ejects the paper a specific amount of lines.

Example

CatPrinterBLE -ep 20

Parameters

  • line_count: The amount of lines to eject.

Retract paper

CatPrinterBLE (-rp | --retractPaper) <line_count>

Retracts the paper a specific amount of lines.

Example

CatPrinterBLE -rp 20

Parameters

  • line_count: The amount of lines to retract.

Get the status of the printer

CatPrinterBLE (-ps | --printerStatus)

It provides information about the battery level, if it has paper, its temperature, and its current state.

Get the battery level

CatPrinterBLE (-bl | --batteryLevel)

It provides the current battery level. This can also be shown with the -ps command.

Show the device info

CatPrinterBLE (-di | --deviceInfo)

Prints some device information. Useful for testing purposes.

Get the print type

CatPrinterBLE (-pt | --printType)

This returns some information abou the "print type" or maybe "printer type". I still haven't figured out what this means exactly. Types are decompiled phonetically written Chinese. This can also be obtained with the -ps command.

Get the "Query count"

CatPrinterBLE (-qc | --queryCount)

No idea what this is, but the printer supports this command that returns some FF values. The name query count comes from machine translating some Chinese comments in the decompiled app code. I probably shouldn't expose this...

Changelog

You can check the changelog here.

Roadmap

There are some commands / features that I still haven't figured out, so it would be nice to reverse-engineer them so the program is more feature complete. But they're not high priority as the most important stuff is already implemented.

I don't plan on supporting other printers for now, as I don't have any other printer to be able to make tests.

Graphical User Interface (GUI)

A modern GUI application is now available! The GUI provides all the same functionality as the command-line version but with a user-friendly interface.

Features

  • Visual Connection Management: One-click scan and connect with status indicator
  • Print Settings: Adjust intensity, select print mode, and choose dithering algorithm through an intuitive UI
  • Paper Control: Easy-to-use buttons for paper eject/retract
  • Real-time Logging: Color-coded activity log with timestamps
  • Device Status: View battery level, printer status, and device information

How to Run the GUI (运行方式)

Pre-compiled Version (预编译版本)

The easiest way to run the GUI is to use the pre-compiled version in the Releases folder:

  1. Navigate to the Releases folder in the project directory
  2. Double-click CatPrinterGUI.exe to launch the application
  3. No installation or .NET runtime required - it's a self-contained executable!

最简单的运行方式是使用 Releases 文件夹中的预编译版本:

  1. 进入项目目录中的 Releases 文件夹
  2. 双击 CatPrinterGUI.exe 即可启动应用程序
  3. 无需安装或 .NET 运行时 - 这是一个独立的可执行文件!

Building from Source (从源码构建)

If you want to build from source, the GUI version is located in the CatPrinterGUI folder:

cd CatPrinterGUI
dotnet build
dotnet run

To publish as a standalone executable:

dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true -p:EnableWindowsTargeting=true

Requirements

  • Windows 10 version 19041 or higher (Windows 10 版本 19041 或更高)
  • Bluetooth Low Energy (BLE) adapter (蓝牙低功耗适配器)
  • MXW01 thermal printer (MXW01 热敏打印机)

About

Experimental implementation of the MXW01 Cat Printers.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • C# 100.0%